Vous êtes sur la page 1sur 123

Janardan Bhagat Shikshan Prasarak Sansthas

CHANGU KANA THAKUR Arts, Commerce, Science College New Panvel (W) A PROJECT REPORT ON

Electricity Management System


By

Ms.YOGITA SHAHAJI SHINDE.


Under the Guidance Of

Prof. Ms. Sonam D. Nikam


Submitted to

University of Mumbai

2011-2012

Janardan Bhagat Shikshan Prasarak Sansthas CHANGU KANA THAKUR ARTS, COMMERCE & SCIENCE COLLEGE, NEW PANVEL (W)

A PROJECT REPORT ON

Electricity Management System


Submitted to

University of Mumbai
By Ms.YOGITA SHAHAJI SHINDE

Under the Guidance Of Prof. Ms. SONAM D. NIKAM

Department Of Computer Science

CERTIFICATE
This is to certify that the project entitled Electricity Management System Is successfully completed by Ms.Yogita Shahaji Shinde, Roll No:-38 Examination Number ______ under the guidance of Prof. Ms. Sonam D.

Nikam , during the academic period of 8th June, 2011 to 15th January ,2012 as
per the Syllabus, and the fulfillment for the completion of the B.Sc. degree in the Computer Science of University of Mumbai. It is also to certify that this is original work of the candidate done during academic year 2011-2012.

Place: Date:

Internal Examiner

Head of Department

Principal

External Examiner

ACKNOWLEDGMENT

It is always a difficult task to acknowledge all those who helped me a lot doing this project. Nevertheless I have made an attempt through this report to express my deepest gratitude to all those who have contributed in making of this project either directly or indirectly. It gives me great pleasure to present my project on Electricity Management System. This is my first milestone in B.Sc computer Science.

I would like to express my sincere thanks to my project guide Prof. Ms. Sonam Nikam who helped me throughout the project.

I would also extend my thanks to our principal Dr. S.T.Gadade for his support and facilities given to us for the same.

Last but not the least I am also thankful to my department head Prof. Mrs.P.M. Jadhav who encourage me and gave me moral support during my project. I would like to thank all my teaching and non-teaching staff of computer science faculty who helped me in completion of my project.

INDEX
Sr.No. 1 Title Preliminary Investigation Organizational Overview Description Of System Limitations Of Present System Proposed System & its Advantage Feasibility Study Stakeholders Gantt Chart System Analysis Fact Findings Event Table Use Case Diagram Entity Relationship Diagram Activity Diagram Class Diagram Object Diagram Sequence Diagram Collaboration Diagram State Diagram System Design Converting ERD to Tables Relationship Diagram Component Diagram Package Diagram Deployment Diagram System Flow Chart Structure Chart System Coding Menu Tree List of Tables with Attributes & Constraints Program Description with naming Conventions Program Listing Validations Test Cases, Test Data, Test Results Screen Layouts & Report Layouts System Implementation & Uploading Future Enhancement References & Bibliography Page No. 6 7 9 10 11 13 17 18 19 20 21 22 23 24 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 46

5 6 7

117 119 122

Chapter 1

Preliminary Investigation

Organizational Overview
An intelligent and effective use of available resources is the key to any successful venture. The Electricity Management System it is aimed at the improvisation of power distribution losses or damages as well management on demand side. Including all field data levels. One of major finding of the research was the realization that a systematic approach to their requirement information was lacking in these organization due to variety of constraints.

Organizational Chart

Electricity Management System

Section office

Customer

Employee

Manager

Description of System

In present non-computerized maintenance in Electricity Management System all the jobs are performed manually. All the records of new connections, maintenance information, estimation of materials, meters information are written in different register. So managing them is very complex process. As the job is done manually, it has its own limitations and lots of paperwork. Preparation of individual reports is very tedious and time consuming job, and still its authentication is debatable and cannot be verified easily. The records done are not easy to maintain in files or registers which can be destroyed anytime by any person. Searching of records from files for particular syntax is very difficult. Any manual error can lead to wrong result.

Limitations Of Present System

As all the information is store, it requires large number of registers maintaining for new connection information, maintenance information, estimation information, meter information. Retrieving data is very hard process as it done manually in the form of paperwork. The storage of information is costly and there are possibilities of duplicate data. The chances of human error are high as there are number of registers. The current system needs through knowledge about the system and hence continuous monitoring is required. Some of the special cases are very difficult to tackle in the current system.

10

Proposed System

To overcome the difficulties and constraints that are in the present interacting with many of the work process that is taking place in the Electricity Management Office. In this System we maintained the difference type of the information. Such as new connection procedure, estimation of materials, meter checking, maintenance information etc. And also maintaining the records of continuity of Electricity supply and carry out regular maintenance works of lines. The Proposed System provides quicker access to information easier generation of reports cut down all manual errors.

11

Advantages of Proposed System All manual calculation of bill or all the money management will be
performed by the computer automatically. This system will provide timely report information.

It will produce report for customer, bill information. The computer can hold amount of data in its storage device. The operation and speed of the computer is very high. We can calculate result and print any report within seconds. Any difficulties we can solve easily. A database application can be stored in computer effectively. It is very user friendly and easy to handle. So the computerized system
is more suitable than the manual system.

12

Feasibility Study 1. Software Specification:Software requirements for this system are as listed follows:

FRONTEND BACKEND OPERATING SYSTEM

: : :

Microsoft Visual Basic 8.0 MySQL Windows XP

2. Hardware Specifications
Minimum hardware requirements for this System are listed below: Processor RAM HARD DISK NETWORK : : : : Pentium-4 256MB. 80GB. LAN.

13

FRONTEND: - MICROSOFT VISUAL STUDIO 2008

VB.Net Visual Basic .NET is the next generation of Microsoft's popular Visual Basic programming languages. Some programmers refer to the new incarnation as VB 7, but this is incorrect. Visual Basic .NET is actually not backwards-compatible with VB6, meaning that code written in the old version will not compile under VB.NET. In fact, the languages are sufficiently different that many programmers consider them independent. As a language, Visual Basic.NET has the following traits: Object-Oriented Visual Basic 6 included limited support for object-oriented design. Encapsulation was supported with Public and Private data types in Classes, as well as special accessor/mutator pairs called Properties (a feature unique to Visual Basic). Polymorphism received crude support through the Implements keyword, which would require that one class implement all of the methods in another, skeleton class. Inheritance was neglected completely. As of VB.NET, all of this has changed. As with all .NET languages, VB.NET includes full-blown support for object-oriented concepts, including simple inheritance. Unlike most other OOP languages, everything in VB.NET is an object, including all of the primitives (Short, Integer, Long, String, Boolean, etc.) as well as types, events, and even assemblies. Everything inherits from the Object base class. .NET Framework As the name implies, VB.NET runs on top of Microsoft's .NET framework, meaning the language has full access to all of the supporting classes in the framework. It's also possible to run VB.NET programs on top of Mono, the open-source alternative to .NET, not only under Windows, but even Linux or Mac OSX.

14

Features of vb.net:1.LINQ Support LINQ essentially is the composition of many standard query operators that allow you to work with data in a more intuitive way regardless. The benefits of using LINQ are significant Compile time checking C# language queries, and the ability to debug step by step through queries. 2. Expression Blend Support Expression blend is XAML generator tool for silverlight applications. You can install Expression blend as an embedded plug-in to Visual Studio 2008. By this you can get extensive web designer and JavaScript tool. 3. Windows Presentation Foundation WPF provides you an extensive graphic functionality you never seen these before. Visual Studio 2008 contains plenty of WPF Windows Presentation Foundation Library templates. By this a visual developer who is new to .NET, C# and VB.NET can easily develop the 2D and 3D graphic applications. Visual Studio 2008 provides free game development library kits for games developers. currently this game development kits are available for C++ and also 2D/3D Dark Matter one image and sounds sets. 4. VS 2008 Multi-Targeting Support Earlier you were not able to working with .NET 1.1 applications directly in visual studio 2005. Now in Visual studio 2008 you are able to create, run, debug the .NET 2.0, .NET 3.0 and .NET 3.5 applications. You can also deploy .NET 2.0 applications in the machines which contains only .NET 2.0 not .NET 3.x. 6. JavaScript Debugging Support Since starting of web development all the developers got frustration with solving javascript errors. Debugging the error in javascript is very difficult. Now Visual Studio 2008 makes it is simpler with javascript debugging. You can set break points and run the javascript step by step and you can watch the local variables when you were debugging the javascript and solution explorer provides javascript document navigation support.

15

BACKEND:MYSQL

MYSQL MySQL is a relational database management system (RDBMS) that runs as a server providing multi-user access to a number of databases.. Applications which use MySQL databases include: Joomla,WordPress, MyBB, phpBB, Drupal and other software built on the LAMP software stack. MySQL is also used in many high-profile, largescale World Wide Web products. Platform Used:MySQL is written in C and C++. Its SQL parser is written in yacc, and a homebrewed lexical analyzer named sql_lex.cc. Many programming languages with language-specific APIs include libraries for accessing MySQL databases. These include MySQL Connector/Net for integration with Microsoft's Visual Studio (languages such as C# and VB are most commonly used) and the JDBC driver for Java. In addition, an ODBC interface called MyODBC allows additional programming languages that support the ODBC interface to communicate with a MySQL database, such as ASP or ColdFusion. The HTSQL - URL based query method also ships with a MySQL adapter, allowing direct interaction between a MySQL database and any web client via structured URLs. The MySQL server and official libraries are mostly implemented in ANSI C/ANSI C++.

16

STAKEHOLDERS
Stakeholders are anyone who has an interest in the project. Project stakeholders are individuals and organizations that are actively involved in the project, or whose interests may be affected as a result of project execution or project completion. They may also exert influence over the projects objectives and outcomes. The project management team must identify the stakeholders, determine their requirements and expectations, and, to the extent possible, manage their influence in relation to the requirements to ensure a successful project. The following are examples of project stakeholders: Project Developers Project Developers is one who develops software for customer. In my project I am the first stakeholder i.e. Project Developer. Project customer Project Customer is one who pays for the developed software. In my project the contractor is the second stakeholder i.e. Project Customer. Project user Group Project User group are those people who use the software on daily basis for the Project Customer. In my project employees are the third stakeholders i.e. Project User Group Project Testers Project Testers are those who test the software. In my project myself, my project guide are the fourth stakeholders i.e. Project Testers.

17

Gantt Chart

18

HARDWARE SPECIFICATIONS

Chapter 2

System Analysis

19

Fact Findings

Introduction The Current System is the manual one, hence is not speedy, accurate, efficient as well as time consuming. An essential part of the system analysis, which enables the developer to understand & the system correctly. It is undertaken to obtain details of the system. To understand the physical flow of the information through the current system. Collect various information through various fact finding techniques. Identify the procedural difficulties experienced by the user. Study the bottlenecks find out the redundant work being performed in the system. Fact Finding Techniques Employed 1. Interviews Information was obtained from the employees at the organization by interviewing them at the location and time convention both. 2. Document Searching An extensive study of existing document an official correspondence was done to understand the present working status of organization.

20

Event Table
SR NO 1 EVENT Customer enquiry for new connection Customer registration Checking connection details Bill generation Bill payment TRIGGER Customer information Check customer detail Look up for connection details Look up for bill Details Bill fulfillment Look up for payment details Complaint details Solution details Supply details Check previous records SOURCE Customer ACTIVITY Enquiry about new connection Register customer Check about the connection Checking bill details Paying bill RESPONSE Get information Registration confirmed Connection given Get bill details Get payment Get information Get complaint details Get solution DESTINAT ION Employee

Employee

Manager

Employee

Manager

Employee

Manager

Customer

Employee

Check the payment status Complaints from customer Providing solution Continuity Of supply Updating records

Employee

Check about the payment Checking the complaints Checking solution details Checking supply details Updating records

Manager

Customer

Employee

Employee

Manager

Employee

Get information Record is update

Manager

10

Employee

Employee

21

Use Case Diagram

Customer enquiry Place new order Paying bill Giving complaints Customer Customer registration Check connection details Bill Generation Employee Check payment status Providing solution details Manager Continuity of supply Update records

Customer

22

Entity-Relationship Diagram

Manager

Complaint

Section office

Employee

Customer

Bill

23

Activity Diagram

Idle

Customer enquiry

Check customer details

Check connection details

Connection provide to the customer

Bill generation

Generate receipt

24

Customer place the complaint

Checking the complaints

Complaint solved?
Yes

No

Provide solution

End

Continuity of supply

25

Class Diagram

Compliant Manager Mang_id Name Address Contact no Insert() Update() Delete() Employee Emp_id Name Address Contactno Insert() Update() Delete()
*

Check

Cust_id Name * Meterno Subject Date Insert() Update() Delete()


* Various type 1

Customer Cust_id Name Address Initainlreading Meterno Type Insert() Update() Delete()
1 1 payment

Bill Cust_id Name Prereading Presentreading * Amount Meterno Insert() Update() Delete()

Generate bill

26

Object Diagram

:Manager :1 : Sahil :Panvel :9856421223 Insert() Update() Delete() :Employee :1 :Sachin salunkhe :Panvel :99442330
*

:Complaint
*

:1 :Yogita :E120002 :Related to bill :1/14/2012


* 1

:Customer :1 :Yogita :Panvel :0 :E120002 :Residential


1 1

:Bill :1 :Yogita :0 :150 * :412 :E120002


1

27

Sequence Diagram
Customer Employee Manager

Customer enquiry Get information Customer registration Check details of Connection Place order Get Connection Checks details of Customer connection Calculating bill Paying bill Check the Payment Records Place Complaints Provide solution Check complaint status Continuity of supply Updating record

28

Collaboration diagram

Customer

1. Customer enquiry 2. Get information 5.place order 6. Get Connection

7. Calculating bill 8. Paying bill 10.placed complaints 11.provide solution Employee 14. Update records 3. Customer Registration

4. Check details

Manager 12.check solution status

9.check payment details

29

State Diagram

IDLE Customer enquiry for new connection Customer registration Check connection details

Bill generation

Bill payment

Check the payment status

Complaints from customer Providing solution Continuity of supply Updating records

30

Chapter 3

System Design

31

Converting ERD to Tables

Sr.No

TABLE NAME

PURPOSE This table is use to store, retrieve and information about the customer. The fields are custid,name,add,meterno,initialreading,type This table is use to store ,retrieve and information about the employee. The fields are empid,name,address,contactno This table is use to store ,retrieve and information about the Manager. The fields are managid,name,address,contactno

Customer.sql

Employee.sql

Manager.sql

This table is use to store, retrieve& the information about the customer bill. Billcalculation.sql The fields are custid,name,meterno,initialreading,presentreading, totalamount, disconnectingdate complaint.sql This table is use store ,retrieve and information about the customer complaints The field in the table are custid, meterno, subject, name, complaint, date Payment.sql This table is use to store, retrieve and information about the Customer payment The fields in the table are custid, name, meterno, reading, amount, disconnectingdate

32

Relationship Diagram

33

Component Diagram

login.vb customer.vb Billcalculation.vb Payment .details.vb View complaints.vb Register complaint.vb Solution to complaint.vb Employee.vb Customer record.vb Bill record.vb Payment record.vb

Electricity Management System

Manager.vb

34

Package Diagram

Electricity management system login.vb Billcalculation.vb Payment .details.vb Electricity Management System Register complaint.vb Manager.vb customer.vb Employee. vb View complaints.vb Solution to complaint.vb Customer record.vb Payment record.vb

Bill record.vb

35

Deployment Diagram

login.vb Billcalculation.vb Payment .details.vb Electricity Management System Register complaint.vb Manager.vb

customer.vb Employee.vb View complaints.vb Solution to complaint.vb Customer record.vb Payment record.vb

Bill record.vb

LOCAL AREA NETWORK

HUB

Terminal

Printer

36

System flow

Customer

Maintain customer details

Billcalculation

bill details

Customer bill report

Complaint

complaint details

Payment

Payment details

Payment report

Electricity management
Solution Solution details

Employee

Maintain employee details

Manager

Manager details

37

Structure chart

Electricity Management System

Maintain customer details

Creation of order

Bill generation

Get Customer details

Save customer details

Meter Reading details

Customer details

Checking of connection details

Giving connection

Order fulfillment

Bill details

Get connection details

Retrieve connection details

Report generation

38

Chapter 4

System Coding

39

Menu Tree

Customer information Master Employee Details Manager Details Register Complaints

Calculating Bill

MDI Form
Transaction

View Customer View Payment View Bill View Solution Bill_Calculation_Report Reports Payment_Report

About Us

Help

Exit

40

Table List
1.Table name:-Customer_Details Sr.N Field Name Datatype o.1 Cust_id Varchar 2 3 4 5 cname cadd meterno Consumer type Varchar Varchar Varchar Varchar

Constraints Primary key

Size 10 20 30 10 30

Description Stores the customer id Stores the customer name Stores the customer address Store the customer meterno Stores the customer place type

2.Table name:-Employee Sr. Field Name Datatype Constraints Size Description No. 1 E_id Varchar Primary key 10 Stores the employee code 2 E_name Varchar 20 Stores the employee name 3 4 E_add E_no Varchar Varchar 30 15 Stores the employee address Stores the employee ph.no

3.Table name:-Manager Sr. Field Name Datatype Constraints Size Description No. 1 Mag_id Varchar Primary key 15 Stores the manager id 2 3 4 M_name M_add M_no Varchar Varchar Varchar 20 30 15 Stores the manager name Stores the manager address Stores the manager ph.no

41

4. Table name:-Bill_calculation Sr. Field Name Datatype Constraints No. 1 cust_id Varchar Foreign key 2 c_name Varchar 3 prevreading Varchar 4 5 6 7 8 9 10 11 presentread dateofread totalamt lastdatepay discontdate totalunits meterno Consumer type Varchar Varchar Varchar Varchar Varchar Varchar Varchar Varchar

Size 10 20 25 25 25 25 25 25 25 25 30

Description Stores the customer id Stores the customer name Stores the customer previous reading Stores the customer present reading Stores the bills date of redaing Stores the bills total amount Stores the last date of paying bill Stores the disconnecting date of connection Stores the total units of meter Stores the meter no Stores the consumer type

5. Table name:-complaint Sr. Field Name Datatype Constraints No. 1 custid Varchar 2 C_name Varchar 3 4 5 6 subject meterno date complaint Varchar Varchar Varchar Varchar

Size 10 20 25 15 20 45

Description Stores the customer id Stores the customer name Stores the subject of complaint Stores the meter no Stores the complaint date Stores the customer complaint

42

6.Table name:-Payment Sr. Field Name Datatype No. 1 2 3 4 5 6 7 8 Custid cname totalunits billamount duedate amtdue meterno Varchar Varchar Varchar Varchar Varchar Varchar Varchar

Constraints foreignkey

Size 15 15 15 15 20 15 15 15

Description Stores the customerid Stores the customer name Stores the total units of meter Stores the billamount Stores the due date of bill Stores the amount due date Stores the meterno Stores the disconnecting date

disconndate Varchar

43

Program List

NO 1

FORM NAME Loding.frm

PURPOSE This form display the title of system name of organization & copyright of the system This form is used for security with the help of password This is the multiple document interface for the all of the form in the project This form is use for store the customer information This form is use for store the employee information This form is use for store the Manager information

Loginform.frm

MdIForm.frm

4 5

Cust_info.frm Emp.frm

6 7 8

Manager.frm

Billcalculation.frm This form use for store bill information Complaint.frm This form is use for store the customers complaint. This form use for store solution of complaint This form use for store bill payment information

9 10

Solution.frm Payment.frm

44

Report List

NO. 1

REPORT NAME Payment_Report.rpt

PURPOSE This report is use for to print and show the payment records

This report is use for to Bill_Calculation_Report.rpt print & show the customer bill

45

Program Description

Program Name: Splash.vb Program Function: This is form is used to Load the system.

46

Code:
Public Class Splash Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick If ProgressBar1.Value <> ProgressBar1.Maximum Then ProgressBar1.Value = (ProgressBar1.Value + 1) If ProgressBar1.Value = 50 Then Login.Show() Me.Hide() End If End If End Sub End Class

47

Program Name: Login .vb Program Function: This is form is used to Login in the system.

Pseudo code:
Sr.No 1 2 Button Name Login Cancel Procedure Click Click Description Login to the system Exit from the system

48

Code:Imports System.Data.Odbc Public Class Login Dim con As New OdbcConnection("driver={MySQL ODBC 3.51 Driver};server=localhost;database=electricity;uid=root;pwd=nbuser;") Dim cmd As New OdbcCommand Dim dr As OdbcDataReader Dim s, s1 As String Private Sub btnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClose.Click Me.Close() End Sub Private Sub btnLogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLogin.Click cmd = New OdbcCommand("Select Uname, Passwd from login where Uname='" & txtUname.Text.ToString() & "'", con) cmd.Connection.Open() dr = cmd.ExecuteReader() While (dr.Read()) s = dr(0).ToString() s1 = dr(1).ToString() End While If (s = txtUname.Text.ToString() And s1 = txtPasswd.Text.ToString()) Then If txtUname.Text = "employee" Then MsgBox("Login Successful") Me.Hide() MDI.Show() MDI.AdminToolStripMenuItem.Visible = False ElseIf txtUname.Text = "manager" Then MsgBox("Login Successful") Me.Hide() MDI.Show() End If Else MsgBox("Login Failed") txtUname.Text = "" txtPasswd.Text = "" txtUname.Focus() End If cmd.Connection.Close() End Sub End Class

49

Program Name: MDI.vb Program Function: This is form contains menus i.e. path for other forms.

50

Code:Public Class MDI Private Sub HelpToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles HelpToolStripMenuItem.Click Form4.ShowDialog() End Sub Private Sub ExitToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem.Click Me.Close() End Sub Private Sub BillCalculationToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BillCalculationToolStripMenuItem.Click Form5.Show() End Sub Private Sub ViewCustomerRecordsToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) View_Customer.Show() End Sub Private Sub ViewBillRecordsToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) View_Bill_Details.Show() End Sub Private Sub ViewPaymentRecordsToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) View_Payment_Records.Show() End Sub Private Sub BillCalculationToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Bill_Calculation_Report.Show() End Sub Private Sub ViewComplaintsToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ViewComplaintsToolStripMenuItem.Click Complaints.Show() End Sub Private Sub ViewSolutionToComplaintsToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) View_Solution.Show() End Sub

51

Private Sub AddNewCustomerToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AddNewCustomerToolStripMenuItem.Click Customer_Record.Show() End Sub Private Sub PaymentDetailsToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PaymentDetailsToolStripMenuItem.Click Form6.Show() End Sub Private Sub BillCalculationToolStripMenuItem2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BillCalculationToolStripMenuItem2.Click Bill_Calculation.Show() End Sub Private Sub ViewToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ViewToolStripMenuItem.Click View_Payment_Records.Show() End Sub Private Sub ViewSolutionToComplaintToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ViewSolutionToComplaintToolStripMenuItem.Click View_Solution.Show() End Sub Private Sub ViewToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ViewToolStripMenuItem1.Click View_Customer.Show() End Sub Private Sub ViewToolStripMenuItem2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ViewToolStripMenuItem2.Click View_Complaints.Show() End Sub Private Sub ViewBillDetailsToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ViewBillDetailsToolStripMenuItem.Click View_Bill_Details.Show() End Sub Private Sub BillCalculationToolStripMenuItem1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BillCalculationToolStripMenuItem1.Click Bill_Calculation_Report.Show() End Sub End Class

52

Program Name: Customer_Record.vb Program Function: This is form is used to add new customer and its details

Pseudo Code:
Sr. No. 1 2 3 4 5 6 7 8 9 ButtonName Save Add Update Clear First Previous Next Last Search Procedure Click Click Click Click Click Click Click Click Click Description Save the Record. Adds the new Record. Modify the current Record. Clear the current Record Display First Record. Display Previous Record. Display Next record. Display Last Record. To Search Record.

53

Test Result:-

54

Code:Imports System.Data.Odbc Public Class Customer_Record Dim con As New OdbcConnection("driver={MySQL ODBC 3.51 Driver};server=localhost;database=electricity;uid=root;pwd=nbuser;") Dim cmd As New OdbcCommand Dim dr As OdbcDataReader Dim s As String Dim a As Integer Dim inc As Integer Dim ds As New DataSet Dim da As OdbcDataAdapter Dim maxrows As Integer Dim sql As String Private Sub btnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClose.Click Me.Close() End Sub Private Sub btnUpdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUpdate.Click cmd = New OdbcCommand("Update customer set Name='" & txtName.Text.ToString() & "', Address='" & txtAddr.Text.ToString() & "', Meterno='" & txtNo.Text.ToString() & "', Consumertype='" & cboType.SelectedItem.ToString() & "' where Custid='" & txtCustid.Text.ToString() & "'", con) cmd.Connection.Open() cmd.ExecuteNonQuery() MsgBox("Data is updated successfully") cmd.Connection.Close() txtAddr.Text = "" txtCustid.Text = "" txtName.Text = "" txtNo.Text = "" cboType.Text = "" End Sub Private Sub btnClr_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClr.Click txtAddr.Text = "" txtCustid.Text = "" txtName.Text = "" txtNo.Text = "" cboType.Text = "" End Sub Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click 55

If txtCustid.Text = "" AndAlso txtName.Text = "" AndAlso txtAddr.Text = "" Then MsgBox("Enter all fields") Else cmd = New OdbcCommand("Insert into customer values('" & txtCustid.Text.ToString() & "', '" & txtName.Text.ToString() & "', '" & txtAddr.Text.ToString() & "', '" & txtNo.Text.ToString() & "', '" & txtRead.Text.ToString() & "', '" & cboType.SelectedItem.ToString() & "')", con) cmd.Connection.Open() cmd.ExecuteNonQuery() MsgBox("Data is inserted successfully") cmd.Connection.Close() txtAddr.Text = "" txtCustid.Text = "" txtName.Text = "" txtNo.Text = "" txtRead.Text = "" cboType.Text = "" End If End Sub Private Sub Form7_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load cmd = New OdbcCommand("Select count(Custid) from customer", con) cmd.Connection.Open() dr = cmd.ExecuteReader() If (s = 0) Then txtCustid.Text = 1 Else txtCustid.Text = s + 1 End If txtRead.Text = 0 cmd.Connection.Close() txtCustid.Enabled = False txtNo.Text = "E" & 120001 + Val(txtCustid.Text) txtNo.Enabled = False sql = "Select * from customer" da = New OdbcDataAdapter(sql, con) da.Fill(ds, "customer") maxrows = ds.Tables("customer").Rows.Count inc = -1 End Sub Private Sub btnFirst_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFirst.Click If inc <> 0 Then inc = 0 NavigateRecords() End If End Sub 56

Private Sub btnPrevious_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrevious.Click If inc > 0 Then inc = inc - 1 NavigateRecords() ElseIf inc = -1 Then MsgBox("No Records Yet") ElseIf inc = 0 Then MsgBox("First Record") End If End Sub Private Sub btnNext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNext.Click If inc <> maxrows - 1 Then inc = inc + 1 NavigateRecords() Else MsgBox("No More Rows") End If End Sub Private Sub btnLast_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLast.Click If inc <> maxrows - 1 Then inc = maxrows - 1 NavigateRecords() End If End Sub Private Sub NavigateRecords() txtCustid.Text = ds.Tables("customer").Rows(inc).Item(0) txtName.Text = ds.Tables("customer").Rows(inc).Item(1) txtAddr.Text = ds.Tables("customer").Rows(inc).Item(2) txtNo.Text = ds.Tables("customer").Rows(inc).Item(3) txtRead.Text = ds.Tables("customer").Rows(inc).Item(4) cboType.Text = ds.Tables("customer").Rows(inc).Item(5) End Sub Private Sub txtName_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtName.KeyPress If Char.IsLetter(e.KeyChar) = False And Asc(e.KeyChar) <> 8 And Char.IsWhiteSpace(e.KeyChar) = False Then e.Handled = True MsgBox("Enter only letters") End If End Sub Private Sub txtRead_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtRead.KeyPress 57

If Char.IsNumber(e.KeyChar) = False And Asc(e.KeyChar) <> 8 Then e.Handled = True MsgBox("Enter only Numbers") End If End Sub Private Sub txtNo_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtNo.KeyPress If Char.IsNumber(e.KeyChar) = False And Asc(e.KeyChar) <> 8 Then e.Handled = True MsgBox("Enter only Numbers") End If End Sub Private Sub btnFind_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFind.Click Dim str As String = InputBox("Enter the Custid:") cmd = New OdbcCommand("Select * from customer where Custid='" & str & "'", con) cmd.Connection.Open() dr = cmd.ExecuteReader() While (dr.Read()) txtCustid.Text = dr(0).ToString() txtName.Text = dr(1).ToString() txtAddr.Text = dr(2).ToString() txtNo.Text = dr(3).ToString() txtRead.Text = dr(4).ToString() cboType.Text = dr(5).ToString() End While cmd.Connection.Close() End Sub Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click txtCustid.Text = "" txtName.Text = "" txtAddr.Text = "" txtNo.Text = "" Dim cmd As New OdbcCommand con.Open() cmd.Connection = con cmd.CommandText = "select count(*) from customer" Dim i As Integer i = cmd.ExecuteScalar txtCustid.Text = i + 1 txtCustid.Enabled = False If con.State = ConnectionState.Open Then con.Close() End If End Sub End Class 58

Program Name: Employee Details.vb Program Function: This is form is used to add new employee and its details.

Pseudo Code:
Sr. No. 1 2 3 4 5 6 7 8 9 ButtonName Save Add Update Clear First Previous Next Last Search Procedure Click Click Click Click Click Click Click Click Click Description Save the Record. Adds the new Record Modify the current Record. Clear the current Record Display First Record. Display Previous Record. Display Next record. Display Last Record. To Search Record.

59

Test Result:-

60

Code:Imports System.Data.Odbc Public Class Form5 Dim con As New OdbcConnection("driver={MySQL ODBC 3.51 Driver};server=localhost;database=electricity;uid=root;pwd=nbuser;") Dim cmd As New OdbcCommand Dim dr As OdbcDataReader Dim s As String Dim a As Integer Dim inc As Integer Dim ds As New DataSet Dim da As OdbcDataAdapter Dim maxrows As Integer Dim sql As String Dim c As CurrencyManager Dim pos As Integer Dim odv As New DataView Public Sub filldatasetandview() ds.Tables.Clear() da.Fill(ds, "employee") odv.Table = ds.Tables("employee") c = CType(Me.BindingContext(odv), CurrencyManager) End Sub Private Sub btnclear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnclear.Click txtadd.Text = "" txtEmpid.Text = "" txtname.Text = "" txtno.Text = "" End Sub Private Sub btnclose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnclose.Click Me.Close() End Sub Private Sub btnsave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnsave.Click If txtEmpid.Text = "" AndAlso txtname.Text = "" AndAlso txtadd.Text = "" AndAlso txtno.Text = "" Then MsgBox("Enter all fields") Else cmd = New OdbcCommand("Insert into employee values('" & txtEmpid.Text.ToString() & "', '" & txtname.Text.ToString() & "', '" & txtadd.Text.ToString() & "', '" & txtno.Text.ToString() & "')", con) cmd.Connection.Open() cmd.ExecuteNonQuery() MsgBox("Data is inserted successfully") 61

cmd.Connection.Close() txtadd.Text = "" txtEmpid.Text = "" txtname.Text = "" txtno.Text = "" End If End Sub Private Sub txtno_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtno.KeyPress Try Dim c As Char c = e.KeyChar If Not (Char.IsDigit(c) Or Char.IsControl(c)) Then e.Handled = True MessageBox.Show("Enter only digit", "CNM", MessageBoxButtons.OK, MessageBoxIcon.Information) End If If txtno.TextLength > 9 Then e.Handled = True MessageBox.Show("Maximum 10 Digit are allowded", "CNM", MessageBoxButtons.OK, MessageBoxIcon.Information) txtno.Text = "" End If Catch ex As Exception MsgBox("") End Try End Sub Private Sub txtname_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtname.KeyPress If Char.IsLetter(e.KeyChar) = False And Asc(e.KeyChar) <> 8 And Char.IsWhiteSpace(e.KeyChar) = False Then e.Handled = True MsgBox("Enter only letters") End If End Sub Private Sub Form5_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load cmd = New OdbcCommand("Select count(Emp_id) from employee", con) cmd.Connection.Open() dr = cmd.ExecuteReader() cmd.Connection.Close() txtEmpid.Enabled = False sql = "Select * from employee" da = New OdbcDataAdapter(sql, con) 62

da.Fill(ds, "employee") maxrows = ds.Tables("employee").Rows.Count inc = -1 End Sub Private Sub btnadd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnadd.Click txtEmpid.Text = "" txtname.Text = "" txtadd.Text = "" txtno.Text = "" Dim cmd As New OdbcCommand con.Open() cmd.Connection = con cmd.CommandText = "select count(*) from employee" Dim i As Integer i = cmd.ExecuteScalar txtEmpid.Text = i + 1 txtEmpid.Enabled = False If con.State = ConnectionState.Open Then con.Close() End If End Sub Private Sub btnFind_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFind.Click Dim str As String = InputBox("Enter the Empid:") cmd = New OdbcCommand("Select * from employee where Empid='" & str & "'", con) cmd.Connection.Open() dr = cmd.ExecuteReader() While (dr.Read()) txtEmpid.Text = dr(0).ToString() txtname.Text = dr(1).ToString() txtadd.Text = dr(2).ToString() txtno.Text = dr(3).ToString() End While cmd.Connection.Close() End Sub Private Sub btnFirst_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFirst.Click If inc <> 0 Then inc = 0 NavigateRecords() End If End Sub Private Sub btnPrevious_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrevious.Click If inc > 0 Then 63

inc = inc - 1 NavigateRecords() ElseIf inc = -1 Then MsgBox("No Records Yet") ElseIf inc = 0 Then MsgBox("First Record") End If End Sub Private Sub btnNext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNext.Click If inc <> maxrows - 1 Then inc = inc + 1 NavigateRecords() Else MsgBox("No More Rows") End If End Sub Private Sub btnLast_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLast.Click If inc <> maxrows - 1 Then inc = maxrows - 1 NavigateRecords() End If End Sub Private Sub NavigateRecords() txtEmpid.Text = ds.Tables("employee").Rows(inc).Item(0) txtname.Text = ds.Tables("employee").Rows(inc).Item(1) txtadd.Text = ds.Tables("employee").Rows(inc).Item(2) txtno.Text = ds.Tables("employee").Rows(inc).Item(3) End Sub Private Sub btnupdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnupdate.Click cmd = New OdbcCommand("Update employee set Name='" & txtname.Text.ToString() & "', Address='" & txtadd.Text.ToString() & "', Contactno='" & txtno.Text.ToString() & "', ' where Empid='" & txtEmpid.Text.ToString() & "'", con) cmd.Connection.Open() cmd.ExecuteNonQuery() MsgBox("Data is updated successfully") cmd.Connection.Close() txtEmpid.Text = "" txtname.Text = "" txtadd.Text = "" txtno.Text = "" End Sub End Class 64

Program Name: Manager.vb Program Function: This is form is used to add new Manager and its details. Test Data:-

Pseudo Code:
Sr. No. 1 2 3 4 5 6 7 8 9 ButtonName Save Delete Update New Entry First Previous Next Last Search Procedure Click Click Click Click Click Click Click Click Click Description Adds the new Record. Deletes the current Record. Modify the current Record. Clear the current Record Display First Record. Display Previous Record. Display Next record. Display Last Record. To Search Record.

65

Test Result:-

66

Code:Imports System.Data.Odbc Public Class Form6 Dim con As New OdbcConnection("driver={MySQL ODBC 3.51 Driver};server=localhost;database=electricity;uid=root;pwd=nbuser;") Dim cmd As New OdbcCommand Dim dr As OdbcDataReader Dim s As String Dim a As Integer Dim inc As Integer Dim ds As New DataSet Dim da As OdbcDataAdapter Dim maxrows As Integer Dim sql As String Dim c As CurrencyManager Dim pos As Integer Dim odv As New DataView Public Sub filldatasetandview() ds.Tables.Clear() da.Fill(ds, "manager") odv.Table = ds.Tables("manager") c = CType(Me.BindingContext(odv), CurrencyManager) End Sub Private Sub Form6_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load cmd = New OdbcCommand("Select count(magid) from manager", con) cmd.Connection.Open() dr = cmd.ExecuteReader() cmd.Connection.Close() txtMagid.Enabled = False sql = "Select * from manager" da = New OdbcDataAdapter(sql, con) da.Fill(ds, "manager") maxrows = ds.Tables("manager").Rows.Count inc = -1 End Sub Private Sub btnclear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnclear.Click txtadd.Text = "" txtMagid.Text = "" txtname.Text = "" txtno.Text = "" End Sub Private Sub btnclose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnclose.Click Me.Close() 67

End Sub Private Sub btnsave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnsave.Click If txtMagid.Text = "" AndAlso txtname.Text = "" AndAlso txtadd.Text = "" AndAlso txtno.Text = "" Then MsgBox("Enter all fields") Else cmd = New OdbcCommand("Insert into manager values('" & txtMagid.Text.ToString() & "', '" & txtname.Text.ToString() & "', '" & txtadd.Text.ToString() & "', '" & txtno.Text.ToString() & "')", con) cmd.Connection.Open() cmd.ExecuteNonQuery() MsgBox("Data is inserted successfully") cmd.Connection.Close() txtadd.Text = "" txtMagid.Text = "" txtname.Text = "" txtno.Text = "" End If End Sub Private Sub txtno_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtno.KeyPress Try Dim c As Char c = e.KeyChar If Not (Char.IsDigit(c) Or Char.IsControl(c)) Then e.Handled = True MessageBox.Show("Enter only digit", "EMS", MessageBoxButtons.OK, MessageBoxIcon.Information) End If If txtno.TextLength > 9 Then e.Handled = True MessageBox.Show("Maximum 10 Digit are allowded", "EMS", MessageBoxButtons.OK, MessageBoxIcon.Information) txtno.Text = "" End If Catch ex As Exception MsgBox("") End Try End Sub Private Sub txtname_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtname.KeyPress If Char.IsLetter(e.KeyChar) = False And Asc(e.KeyChar) <> 8 And Char.IsWhiteSpace(e.KeyChar) = False Then e.Handled = True MsgBox("Enter only letters") 68

End If End Sub Private Sub btnadd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnadd.Click txtMagid.Text = "" txtname.Text = "" txtadd.Text = "" txtno.Text = "" Dim cmd As New OdbcCommand con.Open() cmd.Connection = con cmd.CommandText = "select count(*) from manager" Dim i As Integer i = cmd.ExecuteScalar txtMagid.Text = i + 1 txtMagid.Enabled = False If con.State = ConnectionState.Open Then con.Close() End If End Sub Private Sub btnFind_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFind.Click Dim str As String = InputBox("Enter the Magid:") cmd = New OdbcCommand("Select * from manager where Magid='" & str & "'", con) cmd.Connection.Open() dr = cmd.ExecuteReader() While (dr.Read()) txtMagid.Text = dr(0).ToString() txtname.Text = dr(1).ToString() txtadd.Text = dr(2).ToString() txtno.Text = dr(3).ToString() End While cmd.Connection.Close() End Sub Private Sub btnupdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnupdate.Click cmd = New OdbcCommand("Update Manager set Name='" & txtname.Text.ToString() & "', Address='" & txtadd.Text.ToString() & "', Contactno='" & txtno.Text.ToString() & "', ' where Magid='" & txtMagid.Text.ToString() & "'", con) cmd.Connection.Open() cmd.ExecuteNonQuery() MsgBox("Data is updated successfully") cmd.Connection.Close() txtMagid.Text = "" txtname.Text = "" txtadd.Text = "" 69

txtno.Text = "" End Sub Private Sub btnFirst_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFirst.Click If inc <> 0 Then inc = 0 NavigateRecords() End If End Sub Private Sub btnPrevious_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrevious.Click If inc > 0 Then inc = inc - 1 NavigateRecords() ElseIf inc = -1 Then MsgBox("No Records Yet") ElseIf inc = 0 Then MsgBox("First Record") End If End Sub Private Sub btnNext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNext.Click If inc <> maxrows - 1 Then inc = inc + 1 NavigateRecords() Else MsgBox("No More Rows") End If End Sub Private Sub btnLast_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLast.Click If inc <> maxrows - 1 Then inc = maxrows - 1 NavigateRecords() End If End Sub Private Sub NavigateRecords() txtMagid.Text = ds.Tables("Manager").Rows(inc).Item(0) txtname.Text = ds.Tables("Manager").Rows(inc).Item(1) txtadd.Text = ds.Tables("Manager").Rows(inc).Item(2) txtno.Text = ds.Tables("Manager").Rows(inc).Item(3) End Sub End Class

70

Program Name: Calculating Bill.vb Program Function: This is form is used to Calculate the Bill of Customer. Test Data:-

Pseudo Code: Sr. No. ButtonName


1 2 3 4 5 6 7 Save Clear Close First Previous Next Last

Procedure
Click Click Click Click Click Click Click

Description
Save the Record. Clear the current Record. Close the form. Display First Record. Display Previous Record. Display Next record. Display Last Record.

71

Test Result:-

72

Code:Imports System.Data.Odbc Public Class Bill_Calculation Dim con As New OdbcConnection("driver={MySQL ODBC 3.51 Driver};server=localhost;database=electricity;uid=root;pwd=nbuser;") Dim cmd As New OdbcCommand Dim dr As OdbcDataReader Dim s As String Dim a As Integer Dim inc As Integer Dim ds As New DataSet Dim da As OdbcDataAdapter Dim maxrows As Integer Dim sql As String Private Sub btnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClose.Click Me.Close() End Sub Private Sub Bill_Calculation_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Try If con.State = ConnectionState.Open Then con.Close() End If Dim cmd As New OdbcCommand cmd.Connection = con con.Open() cmd.CommandText = "select custid from customer" Dim reader As OdbcDataReader reader = cmd.ExecuteReader While reader.Read txtCustId.Items.Add(reader.Item("custid")) End While con.Close() Catch ex As Exception End Try txtDate.Text = Date.Now.ToShortDateString() txtLDate.Text = DateAdd("d", 10, Date.Now.ToShortDateString()) txtDDate.Text = DateAdd("m", 6, Date.Now.ToShortDateString()) sql = "Select * from billcalculation" da = New OdbcDataAdapter(sql, con) da.Fill(ds, "billcalculation") maxrows = ds.Tables("billcalculation").Rows.Count inc = -1 73

txtName.Enabled = False txtNo.Enabled = False txtType.Enabled = False txtPrev.Enabled = False End Sub Private Sub txtCustId_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) cmd = New OdbcCommand("Select * from customer where Custid='" & txtCustId.Text.ToString() & "'", con) cmd.Connection.Open() dr = cmd.ExecuteReader() While (dr.Read()) txtCustId.Text = dr(0).ToString() txtName.Text = dr(1).ToString() txtNo.Text = dr(3).ToString() txtType.Text = dr(5).ToString() End While cmd.Connection.Close() End Sub Private Sub btnClr_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClr.Click txtAmt.Text = "" txtCustId.Text = "" txtName.Text = "" txtPresent.Text = "" txtPrev.Text = "" txtTotUnits.Text = "" txtType.Text = "" End Sub Private Sub txtPresent_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtPresent.KeyPress Try Dim c As Char c = e.KeyChar If Not (Char.IsDigit(c) Or Char.IsControl(c)) Then e.Handled = True MessageBox.Show("Enter only digit", "EMS", MessageBoxButtons.OK, MessageBoxIcon.Information) End If If txtPresent.TextLength > 3 Then e.Handled = True MessageBox.Show("Maximum 4 Digit are allowded", "CNM", MessageBoxButtons.OK, MessageBoxIcon.Information) txtPresent.Text = "" End If 74

Catch ex As Exception MsgBox("") End Try End Sub Private Sub txtPresent_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtPresent.LostFocus txtTotUnits.Text = Val(txtPresent.Text) - Val(txtPrev.Text) End Sub Private Sub btnTotal_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTotal.Click If txtType.Text = "Residential" Then txtAmt.Text = Math.Round(Val(txtTotUnits.Text) * 2.75) ElseIf txtType.Text = "Commercial" Then txtAmt.Text = Math.Round(Val(txtTotUnits.Text) * 4.7) End If End Sub Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click If txtCustId.Text = "" AndAlso txtName.Text = "" AndAlso txtDate.Text = "" AndAlso txtAmt.Text = "" AndAlso txtNo.Text = "" AndAlso txtTotUnits.Text = "" AndAlso txtPrev.Text = "" AndAlso txtPresent.Text = "" Then MsgBox("Enter all fields") Else cmd = New OdbcCommand("Insert into billcalculation values('" & txtCustId.Text.ToString() & "', '" & txtName.Text.ToString() & "', '" & txtPrev.Text.ToString() & "', '" & txtPresent.Text.ToString() & "', '" & txtDate.Text.ToString() & "', '" & txtAmt.Text.ToString() & "', '" & txtLDate.Text.ToString() & "', '" & txtDDate.Text.ToString() & "', '" & txtTotUnits.Text.ToString() & "', '" & txtNo.Text.ToString() & "', '" & txtType.Text.ToString() & "')", con) cmd.Connection.Open() cmd.ExecuteNonQuery() MsgBox("Data is inserted successfully") cmd.Connection.Close() txtAmt.Text = "" txtCustId.Text = "" txtName.Text = "" txtPresent.Text = "" txtPrev.Text = "" txtTotUnits.Text = "" txtNo.Text = "" End If End Sub Private Sub btnFind_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Dim str As String = InputBox("Enter the Custid:")

75

cmd = New OdbcCommand("Select * from billcalculation where Custid='" & str & "'", con) cmd.Connection.Open() dr = cmd.ExecuteReader() While (dr.Read()) txtCustId.Text = dr(0).ToString() txtName.Text = dr(1).ToString() txtPrev.Text = dr(3).ToString() txtType.Text = dr(10).ToString() End While cmd.Connection.Close() End Sub Private Sub txtPrev_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtPrev.KeyPress If Char.IsNumber(e.KeyChar) = False And Asc(e.KeyChar) <> 8 Then e.Handled = True MsgBox("Enter only Numbers") End If End Sub Private Sub btnFirst_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFirst.Click If inc <> 0 Then inc = 0 NavigateRecords() End If End Sub Private Sub btnPrevious_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrevious.Click If inc > 0 Then inc = inc - 1 NavigateRecords() ElseIf inc = -1 Then MsgBox("No Records Yet") ElseIf inc = 0 Then MsgBox("First Record") End If End Sub Private Sub btnNext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNext.Click If inc <> maxrows - 1 Then inc = inc + 1 NavigateRecords() Else MsgBox("No More Rows") End If End Sub 76

Private Sub btnLast_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLast.Click If inc <> maxrows - 1 Then inc = maxrows - 1 NavigateRecords() End If End Sub Private Sub NavigateRecords() txtCustId.Text = ds.Tables("billcalculation").Rows(inc).Item(0) txtName.Text = ds.Tables("billcalculation").Rows(inc).Item(1) txtPrev.Text = ds.Tables("billcalculation").Rows(inc).Item(2) txtPresent.Text = ds.Tables("billcalculation").Rows(inc).Item(3) txtDate.Text = ds.Tables("billcalculation").Rows(inc).Item(4) txtAmt.Text = ds.Tables("billcalculation").Rows(inc).Item(5) txtLDate.Text = ds.Tables("billcalculation").Rows(inc).Item(6) txtDDate.Text = ds.Tables("billcalculation").Rows(inc).Item(7) txtTotUnits.Text = ds.Tables("billcalculation").Rows(inc).Item(8) txtNo.Text = ds.Tables("billcalculation").Rows(inc).Item(9) txtType.Text = ds.Tables("billcalculation").Rows(inc).Item(10) End Sub Private Sub txtCustId_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtCustId.SelectedIndexChanged

Try If con.State = ConnectionState.Open Then con.Close() End If cmd = New OdbcCommand("Select * from customer where Custid='" & Val(txtCustId.Text) & "'", con) cmd.Connection.Open() dr = cmd.ExecuteReader() While (dr.Read()) txtName.Text = dr(1).ToString() txtPrev.Text = dr(4).ToString() txtType.Text = dr(5).ToString() txtNo.Text = dr(3).ToString() End While cmd.Connection.Close() Catch ex As Exception MessageBox.Show(ex.Message) End Try Try If con.State = ConnectionState.Open Then con.Close() End If 77

cmd = New OdbcCommand("Select * from billcalculation where Custid='" & Val(txtCustId.Text) & "'", con) cmd.Connection.Open() dr = cmd.ExecuteReader() While (dr.Read()) txtPrev.Text = dr(3).ToString() End While cmd.Connection.Close() Catch ex As Exception MessageBox.Show(ex.Message) End Try End Sub End Class

78

Program Name:-PaymentDetails.vb Program Function: This is form is used to generate bill Payment of customer. Test Data:-

Pseudo Code:
Sr. No. 1 2 3 4 5 6 7 ButtonName Save Clear Find First Previous Next Last Procedure Click Click Click Click Click Click Click Description Adds the new Record. Clear the current Record. Find the Record. Display First Record. Display Previous Record. Display Next record. Display Last Record.

79

Test Result:-

80

Code:Imports System.Data.Odbc Public Class PaymentDetails Dim con As New OdbcConnection("driver={MySQL ODBC 3.51 Driver};server=localhost;database=electricity;uid=root;pwd=nbuser;") Dim cmd As New OdbcCommand Dim dr As OdbcDataReader Dim s As String Dim a As Integer Dim inc As Integer Dim ds As New DataSet Dim da As OdbcDataAdapter Dim maxrows As Integer Dim sql As String Private Sub btnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClose.Click Me.Close() End Sub Private Sub btnFind_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFind.Click Dim str As String = InputBox("Enter the Name:") cmd = New OdbcCommand("Select * from payment where Name='" & str & "'", con) cmd.Connection.Open() dr = cmd.ExecuteReader() While (dr.Read()) txtCustid.Text = dr(0).ToString() txtName.Text = dr(1).ToString() txtTotUnits.Text = dr(2).ToString() txtAmt.Text = dr(3).ToString() txtDate.Text = dr(4).ToString() txtAmtd.Text = dr(10).ToString() txtNo.Text = dr(6).ToString() txtDDate.Text = dr(7).ToString() End While cmd.Connection.Close() End Sub Private Sub btnClr_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClr.Click txtAmt.Text = "" txtCustid.Text = "" txtName.Text = "" txtTotUnits.Text = "" txtAmtd.Text = "" txtDate.Text = "" txtNo.Text = "" 81

txtDDate.Text = "" End Sub Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click If txtAmt.Text = "" AndAlso txtCustid.Text = "" AndAlso txtName.Text = "" Then MsgBox("Enter all fields") Else cmd = New OdbcCommand("Insert into payment values('" & txtCustid.Text.ToString() & "', '" & txtName.Text.ToString() & "', '" & txtTotUnits.Text.ToString() & "', '" & txtAmt.Text.ToString() & "', '" & txtDate.Text.ToString() & "', '" & txtAmtd.Text.ToString() & "', '" & txtNo.Text.ToString() & "', '" & txtDDate.Text.ToString() & "')", con) cmd.Connection.Open() cmd.ExecuteNonQuery() MsgBox("Data is inserted successfully") cmd.Connection.Close() txtAmt.Text = "" txtCustid.Text = "" txtName.Text = "" txtTotUnits.Text = "" txtAmtd.Text = "" txtNo.Text = "" txtDate.Text = "" End If End Sub Private Sub txtName_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtName.LostFocus cmd = New OdbcCommand("Select * from billcalculation where Name='" & txtName.Text.ToString() & "'", con) cmd.Connection.Open() dr = cmd.ExecuteReader() While (dr.Read()) txtCustid.Text = dr(0).ToString() txtName.Text = dr(1).ToString() txtAmt.Text = dr(5).ToString() txtDate.Text = dr(6).ToString() txtTotUnits.Text = dr(8).ToString() txtNo.Text = dr(9).ToString() txtDDate.Text = dr(7).ToString() End While txtAmtd.Text = Val(txtAmt.Text) + 40 cmd.Connection.Close() If CDate(txtDDate.Text) < Date.Now.ToShortDateString() Then MsgBox("Your connection is disconnected. Renew your connection") Else MsgBox("Your connection is connected") End If 82

End Sub Private Sub PaymentDetails_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Try If con.State = ConnectionState.Open Then con.Close() End If Dim cmd As New OdbcCommand cmd.Connection = con con.Open() cmd.CommandText = "select custid from customer" Dim reader As OdbcDataReader reader = cmd.ExecuteReader While reader.Read txtCustid.Items.Add(reader.Item("custid")) End While con.Close() Catch ex As Exception End Try txtDate.Text = Date.Now.ToShortDateString() txtDDate.Text = DateAdd("m", 6, Date.Now.ToShortDateString()) sql = "Select * from billcalculation" da = New OdbcDataAdapter(sql, con) da.Fill(ds, "billcalculation") maxrows = ds.Tables("billcalculation").Rows.Count inc = -1 txtName.Enabled = False txtNo.Enabled = False End Sub Private Sub btnFirst_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFirst.Click If inc <> 0 Then inc = 0 NavigateRecords() End If End Sub Private Sub btnPrevious_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrevious.Click If inc > 0 Then inc = inc - 1 NavigateRecords() ElseIf inc = -1 Then MsgBox("No Records Yet") ElseIf inc = 0 Then MsgBox("First Record") 83

End If End Sub Private Sub btnNext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNext.Click If inc <> maxrows - 1 Then inc = inc + 1 NavigateRecords() Else MsgBox("No More Rows") End If End Sub Private Sub btnLast_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLast.Click If inc <> maxrows - 1 Then inc = maxrows - 1 NavigateRecords() End If End Sub Private Sub NavigateRecords() txtCustid.Text = ds.Tables("payment").Rows(inc).Item(0) txtName.Text = ds.Tables("payment").Rows(inc).Item(1) txtTotUnits.Text = ds.Tables("payment").Rows(inc).Item(2) txtAmt.Text = ds.Tables("payment").Rows(inc).Item(3) txtDate.Text = ds.Tables("payment").Rows(inc).Item(4) txtAmtd.Text = ds.Tables("payment").Rows(inc).Item(10) txtNo.Text = ds.Tables("payment").Rows(inc).Item(6) txtDDate.Text = ds.Tables("payment").Rows(inc).Item(7) End Sub

Private Sub txtCustid_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtCustid.SelectedIndexChanged Try If con.State = ConnectionState.Open Then con.Close() End If cmd = New OdbcCommand("Select * from billcalculation where Custid='" & Val(txtCustid.Text) & "'", con) cmd.Connection.Open() dr = cmd.ExecuteReader() While (dr.Read()) txtName.Text = dr(1).ToString() txtTotUnits.Text = dr(8).ToString() txtAmt.Text = dr(5).ToString() txtDate.Text = dr(4).ToString() txtNo.Text = dr(9).ToString() txtDDate.Text = dr(7).ToString() 84

End While txtAmtd.Text = Val(txtAmt.Text) + 40 cmd.Connection.Close() Catch ex As Exception MessageBox.Show(ex.Message) End Try End Sub End Class

85

Program Name:-Complaints.vb Program Function: This is form is used to giving the complaints.
Test Data:-

Pseudo Code:
Sr. No. 1 2 ButtonName Save Close Procedure Click Click Description Adds the new complaint. Close the form.

86

Test Result:-

87

Code:Imports System.Data.Odbc Public Class Complaints Dim con As New OdbcConnection("driver={MySQL ODBC 3.51 Driver};server=localhost;database=electricity;uid=root;pwd=nbuser;") Dim cmd As New OdbcCommand Dim dr As OdbcDataReader Dim s As String Private Sub btnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClose.Click Me.Close() End Sub Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSubmit.Click cmd = New OdbcCommand("Insert into complaint values('" & txtcustid.Text.ToString() & "', '" & txtName.Text.ToString() & "', '" & txtSubject.Text.ToString() & "', '" & txtNo.Text.ToString() & "','" & txtDate.Text.ToString() & "','" & txtComplaint.Text.ToString() & "')", con) cmd.Connection.Open() cmd.ExecuteNonQuery() MsgBox("Data is inserted successfully") cmd.Connection.Close() txtcustid.Text = "" txtName.Text = "" txtSubject.Text = "" txtNo.Text = "" txtDate.Text = "" txtComplaint.Text = "" End Sub

Private Sub Complaints_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Try If con.State = ConnectionState.Open Then con.Close() End If Dim cmd As New OdbcCommand cmd.Connection = con con.Open() cmd.CommandText = "select custid from customer" Dim reader As OdbcDataReader reader = cmd.ExecuteReader 88

While reader.Read txtCustId.Items.Add(reader.Item("custid")) txtNo.Enabled = False End While con.Close() Catch ex As Exception End Try txtDate.Text = Date.Now.ToShortDateString() End Sub Private Sub txtcustid_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtcustid.SelectedIndexChanged Try If con.State = ConnectionState.Open Then con.Close() End If cmd = New OdbcCommand("Select * from customer where Custid='" & Val(txtcustid.Text) & "'", con) cmd.Connection.Open() dr = cmd.ExecuteReader() While (dr.Read()) txtName.Text = dr(1).ToString() txtNo.Text = dr(3).ToString() End While cmd.Connection.Close() Catch ex As Exception MessageBox.Show(ex.Message) End Try End Sub End Class

89

Program Name:-View_solution.vb Program Function: This is form is used to view solution of the customer complaint. Test Data:-

Pseudo Code:
Sr. No. 1 2 3 4 ButtonName Save Clear Update Close Procedure Click Click Click Click Description Adds the new Record. Clear the current Record. Modify the current Record. Close the form.

90

Test Result:-

91

Code:Imports System.Data.Odbc Public Class View_Solution Dim con As New OdbcConnection("driver={MySQL ODBC 3.51 Driver};server=localhost;database=electricity;uid=root;pwd=nbuser;") Dim cmd As New OdbcCommand Dim dr As OdbcDataReader Dim dt As New DataTable Dim s As String Private Sub btnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClose.Click Me.Close() End Sub

Private Sub btnClr_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClr.Click txtNo.Text = "" txtCustid.Text = "" txtDate.Text = "" txtstatus.Text = "" dt.Rows.Clear() End Sub

Private Sub btnsave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnsave.Click If txtCustid.Text = "" AndAlso txtstatus.Text = "" AndAlso txtDate.Text = "" Then MsgBox("Enter all fields") Else cmd = New OdbcCommand("Insert into solution values('" & txtCustid.Text.ToString() & "', '" & txtNo.Text.ToString() & "', '" & txtDate.Text.ToString() & "', '" & txtstatus.Text.ToString() & "')", con) cmd.Connection.Open() cmd.ExecuteNonQuery() MsgBox("Data is inserted successfully") cmd.Connection.Close() txtCustid.Text = "" txtNo.Text = "" txtDate.Text = "" txtstatus.Text = "" End If End Sub

92

Private Sub btnupdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnupdate.Click cmd = New OdbcCommand("Update solution set status='" & txtstatus.Text.ToString() & "', Meterno='" & txtNo.Text.ToString() & "' where Custid='" & txtCustid.Text.ToString() & "'", con) cmd.Connection.Open() cmd.ExecuteNonQuery() MsgBox("Data is updated successfully") cmd.Connection.Close() txtstatus.Text = "" End Sub Private Sub txtCustid_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtCustid.SelectedIndexChanged Try If con.State = ConnectionState.Open Then con.Close() End If cmd = New OdbcCommand("Select * from complaint where Custid='" & Val(txtCustid.Text) & "'", con) cmd.Connection.Open() dr = cmd.ExecuteReader() While (dr.Read()) txtCustid.Text = dr(0).ToString() txtNo.Text = dr(3).ToString() End While cmd.Connection.Close() Catch ex As Exception MessageBox.Show(ex.Message) End Try cmd = New OdbcCommand("Select * from solution where Custid='" & Val(txtCustid.Text) & "'", con) If con.State = ConnectionState.Open Then con.Close() End If cmd.Connection.Open() dr = cmd.ExecuteReader() While (dr.Read()) txtDate.Text = dr(2).ToString() txtstatus.Text = dr(3).ToString() End While cmd.Connection.Close() End Sub

Private Sub View_Solution_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 93

txtDate.Text = Date.Now.ToShortDateString() txtstatus.Text = "" Dim cmd As New OdbcCommand cmd.Connection = con con.Open() cmd.CommandText = "select custid from complaint" Dim reader As OdbcDataReader reader = cmd.ExecuteReader While reader.Read txtCustid.Items.Add(reader.Item("custid")) txtNo.Enabled = False End While End Sub End Class

94

Program Name:-View_Complaints.vb Program Function: This is form is used to view complaints of the customer. Test Data:-

95

Code:Imports System.Data.Odbc Public Class View_Complaints Dim con As New OdbcConnection("driver={MySQL ODBC 3.51 Driver};server=localhost;database=electricity;uid=root;pwd=nbuser;") Dim cmd As New OdbcCommand Dim dr As OdbcDataReader Dim dt As New DataTable Private Sub btnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClose.Click Me.Close() End Sub Private Sub btnView_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnView.Click DataGridView1.Visible = True cmd = New OdbcCommand("Select * from complaint", con) cmd.Connection.Open() dr = cmd.ExecuteReader() dt.Load(dr) DataGridView1.DataSource = dt cmd.Connection.Close() End Sub Private Sub btnDelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDelete.Click Dim str As String = InputBox("Enter meter number:") cmd = New OdbcCommand("Delete from complaint where Meterno='" & str & "'", con) cmd.Connection.Open() cmd.ExecuteNonQuery() MsgBox("Complaint deleted successfully") cmd.Connection.Close() End Sub End Class

96

Program Name:-View_Customer.vb Program Function: This is form is used to view records of the customer. Test Data:-

Pseudo Code:
Sr. No. 1 2 3 ButtonName View Clear Close Procedure Click Click Click Description View the Record. Clear the current Record. Close the form.

97

Test Result:-

98

Code:Imports System.Data.Odbc Public Class View_Customer Dim con As New OdbcConnection("driver={MySQL ODBC 3.51 Driver};server=localhost;database=electricity;uid=root;pwd=nbuser;") Dim cmd As New OdbcCommand Dim dr As OdbcDataReader Dim dt As New DataTable Private Sub btnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClose.Click Me.Close() End Sub Private Sub btnClr_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClr.Click txtName.Text = "" dt.Rows.Clear() DataGridView1.Visible = False End Sub Private Sub btnFind_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFind.Click DataGridView1.Visible = True cmd = New OdbcCommand("Select * from customer where Name='" & txtName.Text.ToString() & "'", con) cmd.Connection.Open() dr = cmd.ExecuteReader() dt.Load(dr) DataGridView1.DataSource = dt cmd.Connection.Close() End Sub Private Sub cboFind_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cboFind.SelectedIndexChanged If cboFind.Text = "Id" Then Label3.Visible = False txtName.Text = False btnFind.Visible = False btnView.Visible = True txtCustid.Visible = True Label2.Visible = True ElseIf cboFind.Text = "Name" Then Label3.Visible = True txtName.Visible = True btnFind.Visible = True Label2.Visible = False txtCustid.Visible = False btnView.Visible = False 99

End If End Sub Private Sub btnView_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnView.Click DataGridView1.Visible = True cmd = New OdbcCommand("Select * from customer where Custid='" & txtCustid.Text.ToString() & "'", con) cmd.Connection.Open() dr = cmd.ExecuteReader() dt.Load(dr) DataGridView1.DataSource = dt cmd.Connection.Close() End Sub Private Sub txtCustid_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtCustid.SelectedIndexChanged Try If con.State = ConnectionState.Open Then con.Close() End If cmd = New OdbcCommand("Select * from customer where Custid='" & Val(txtCustid.Text) & "'", con) cmd.Connection.Open() dr = cmd.ExecuteReader() While (dr.Read()) txtName.Text = dr(1).ToString() End While cmd.Connection.Close() Catch ex As Exception MessageBox.Show(ex.Message) End Try Try If con.State = ConnectionState.Open Then con.Close() End If cmd = New OdbcCommand("Select * from Customer where Custid='" & Val(txtCustid.Text) & "'", con) cmd.Connection.Open() dr = cmd.ExecuteReader() While (dr.Read()) End While cmd.Connection.Close() Catch ex As Exception MessageBox.Show(ex.Message) End Try End Sub End Class

100

Program Name:-View_Billdetails.vb Program Function: This is form is used to view records of the customer. Test Data:-

Pseudo Code:
Sr. No. 1 2 3 ButtonName Find Clear Close Procedure Click Click Click Description Find the Record. Clear the current Record. Close the form.

101

Test Result:-

102

Code:Imports System.Data.Odbc Public Class View_Bill_Details Dim con As New OdbcConnection("driver={MySQL ODBC 3.51 Driver};server=localhost;database=electricity;uid=root;pwd=nbuser;") Dim cmd As New OdbcCommand Dim dr As OdbcDataReader Dim dt As New DataTable Private Sub btnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClose.Click Me.Close() End Sub Private Sub btnFind_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFind.Click DataGridView1.Visible = True cmd = New OdbcCommand("Select * from billcalculation where Name='" & txtName.Text.ToString() & "'", con) cmd.Connection.Open() dr = cmd.ExecuteReader() dt.Load(dr) DataGridView1.DataSource = dt cmd.Connection.Close() End Sub Private Sub btnClr_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClr.Click txtName.Text = "" txtDate.Text = "" txtDDate.Text = "" dt.Rows.Clear() DataGridView1.Visible = False End Sub Private Sub btnView_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnView.Click DataGridView1.Visible = True cmd = New OdbcCommand("Select * from billcalculation where Dateofreading >= '" & txtDate.Text.ToString() & "' And Disconnectingdate<='" & txtDDate.Text.ToString() & "'", con) cmd.Connection.Open() dr = cmd.ExecuteReader() dt.Load(dr) DataGridView1.DataSource = dt cmd.Connection.Close() End Sub 103

Private Sub cboFind_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cboFind.SelectedIndexChanged If cboFind.Text = "Name" Then Label3.Visible = True txtName.Visible = True Label2.Visible = False txtDate.Visible = False txtDDate.Visible = False btnFind.Visible = True btnView.Visible = False ElseIf cboFind.Text = "Date" Then Label3.Visible = False txtName.Visible = False Label2.Visible = True txtDate.Visible = True txtDDate.Visible = True btnView.Visible = True btnFind.Visible = False End If End Sub End Class

104

Program Name:-View_PaymentRecord.vb Program Function: This is form is used to view records of customers bill payments. Test Data:-

Pseudo Code:
Sr. No. 1 2 3 ButtonName View Clear Close Procedure Click Click Click Description View the payment Record. Clear the current Record. Close the form.

105

Test Result:-

106

Code:Imports System.Data.Odbc Public Class View_Payment_Records Dim con As New OdbcConnection("driver={MySQL ODBC 3.51 Driver};server=localhost;database=electricity;uid=root;pwd=nbuser;") Dim cmd As New OdbcCommand Dim dr As OdbcDataReader Dim dt As New DataTable Private Sub btnFind_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFind.Click DataGridView1.Visible = True cmd = New OdbcCommand("Select * from payment where Name='" & txtName.Text.ToString() & "'", con) cmd.Connection.Open() dr = cmd.ExecuteReader() dt.Load(dr) DataGridView1.DataSource = dt cmd.Connection.Close() End Sub Private Sub btnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClose.Click Me.Close() End Sub Private Sub btnClr_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClr.Click txtName.Text = "" dt.Rows.Clear() DataGridView1.Visible = False End Sub Private Sub btnView_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnView.Click DataGridView1.Visible = True cmd = New OdbcCommand("Select * from payment where Custid='" & txtId.Text.ToString() & "'", con) cmd.Connection.Open() dr = cmd.ExecuteReader() dt.Load(dr) DataGridView1.DataSource = dt cmd.Connection.Close() End Sub Private Sub cboFind_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cboFind.SelectedIndexChanged If cboFind.Text = "Id" Then 107

Label2.Visible = True txtId.Visible = True btnView.Visible = True Label3.Visible = False txtName.Visible = False btnFind.Visible = True ElseIf cboFind.Text = "Name" Then Label2.Visible = False txtId.Visible = False btnView.Visible = False Label3.Visible = True txtName.Visible = True btnFind.Visible = True End If End Sub End Class

108

Program Name:-Help Program Function: This is form is used to display details about system. Test Result:

Pseudo Code:
Sr. No. 1 ButtonName OK Procedure Click Description Exit from the form.

109

Code:Public Class Form4 Private Sub btnok_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnok.Click Me.Close() End Sub End Class

110

Report Layouts Report Name:- Payment_Report.vb Report function:- This form displays payment report.
Test Result:-

111

Code:Public Class payment_Report Private Sub payment_Report_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Me.paymentTableAdapter.Fill(Me.DataSet3.payment) Me.ReportViewer1.RefreshReport() End Sub End Class

112

Report Name:- Bill_calculation_Report.vb Report function:- This form displays all customers bill. Test Result:-

113

Code:Public Class Bill_Calculation_Report Private Sub Bill_Calculation_Report_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Me.billcalculationTableAdapter.Fill(Me.DataSet2.billcalculation) Me.ReportViewer1.RefreshReport() End Sub End Class

114

Validations

Test Case:Invalid login

115

Test Cases: - Margin of Phone number

116

Chapter 5

System Implementation

117

System Implementation VARIABLE NAME


Con

DATA TYPE
Connection

DESCRIPTION
To make the connection between application & database. To execute sql query on table To read data retrieve by sqlcommand. To display report.

Cmd Reader

SqlCommand SqlDataReader

CryRpt

ReportWizard

SYSTEM CONTROLS AND STANDARDS

1. Access control:System gives access by valid password.

2. Input control:System validates every textbox. It allows textual values for fields like customer name. It also validates some numeric data only for fields like phone no.

3. System Generated control:In Order details it automatically calculates total price of the product. Similarly in Receipt details it automatically deducts the amount from the actual amount.

4. Range control:In Order Transaction the system checks whether quantity given by the user is not more than the available product.

118

Chapter 6

Future Enhancement

119

Future Enhancement

Being a computer system, the system has good scope to be improved further. Future Enhancements are as listed below Maintain daily employee attendance. Administrator can be given more rights so that he will be able to change order details.

120

Conclusion

System helps to store all the data about the customer order in computer and there is 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 or data.

121

Chapter 7

References & Bibliography

122

References & Bibliography


Sr.No.
1.

Type
Book name : Author :

Description
Visual Basic 2008 Anne Boehm Murach Mastering Visual Basic 2008 Evangelos Petroutsos Wiley-India Edition SQL, PL/SQL

Publication : Book name : 2. Author :

Publication : Book name :

3.

Author

Ivan Bayross

Publication :

B.P.B.

123

Vous aimerez peut-être aussi