Você está na página 1de 88

See discussions, stats, and author profiles for this publication at: https://www.researchgate.

net/publication/281204856

Automation of Utility Bill Collection System

Thesis · October 2004

CITATION READS
1 4,479

1 author:

Md Hasanul Ferdaus
University of Melbourne
16 PUBLICATIONS   193 CITATIONS   

SEE PROFILE

Some of the authors of this publication are also working on these related projects:

QoS-aware Multi-objective Dynamic Virtual Machine Consolidation in Infrastructure Clouds View project

All content following this page was uploaded by Md Hasanul Ferdaus on 11 July 2017.

The user has requested enhancement of the downloaded file.


Automation of Utility Bill Collection
System

B.Sc. THESIS

By

MD. HASANUL FERDAUS


STUDENT NO: 9805010

Department of Computer Science and Engineering


Bangladesh University of Engineering and Technology
Dhaka-1000,Bangladesh.
October,2004
Automation of Utility Bill Collection
System
Submitted by
Md. Hasanul Ferdaus
STUDENT NO: 9805010

Supervised by
Dr. Md. Mostofa Akbar
Assistant Professor

Department of Computer Science and Engineering


Bangladesh University of Engineering and Technology

Submitted To
Department of Computer Science and Engineering
Bangladesh University of Engineering and Technology
Dhaka-1000, Bangladesh.
In partial fulfillment of the requirements
for the degree of
Bachelor of Science in Computer Science and Engineering
October, 2004
i

Certification

This is to certify that the work presented in this thesis is the outcome and investigation carried
out by the candidates under the supervision of Dr. Md. Mostofa Akbar, Assistant Professor,
Department of Computer Science and Engineering, Bangladesh University of Engineering
and Technology (BUET), Dhaka. It is also declared that, this thesis embodies own research
work and is composed by authors. Where appropriate, acknowledgement to the work of other has
been made.

_______________________ ___________________
Signature of the Supervisor Md. Hasanul Ferdaus
ii

Acknowledgement

First of all, we would like to express our profound gratitude to our supervisor,
Dr. Mohammad Mostofa Akbar, Assistant Professor, Department of Computer
Science and Engineering, Bangladesh University of Engineering and Technology, for
his constant monitoring and guidance, helpful advice, constructive suggestions,
invaluable assistance, and endless patience throughout the progress of the work. Without
his support, we would not have probably undertaken the amount of work we did.

We also thank our teacher S. M. Forhad, Lecturer, Department of Computer Science


and Engineering, Bangladesh University of Engineering and Technology for his
helpful advice and for sharing his valuable time with us.

We would like to thank our parents for providing a cooperative and stimulating
environment during the progress of this work.

We also acknowledge with thanks the cooperation of all our teachers and classmates of
Computer Science & Engineering Department and my other friends, whose cooperation
enabled me to bring out this work into attainment.
iii

Abstract

Utility services mean the different types of services we use in our day-to-day life from different
service providers for various utilities such as electricity, water, gas etc. The service providers bill
the customers for consumption of these utilities. The consumers pay these bills to some
particular banks and the banks notify the service providers about the payment. Automation of
utility bill collection system means the computerization of these bill collections and notification
process so that the full process can be carried out automatically. This thesis gives a detailed
study of currently existing system of bill collection and notification process and suggested a fully
automated process for the same. Here we have suggested introduction of bar code in the
traditional bill paper from which billing information can be read by bar code scanners. A
comparison of different bar code printing techniques is also studied. Two different techniques for
the communication of the billing information from the bank to service provider are also
suggested. We also suggested necessary changes in the bank-end software and the service
provider-end software. We also designed and implemented two programs, one for the bank and
one for the service provider. Due to complexity, time limitation and other shortcomings, a
completely reliable system could not be implemented at this stage, but the approach was
constructive for future research. A guideline for future development of full automation of utility
bill collection process has also been presented.
iv

Table of Contents

Certificate………………………………………………………………………………………....i
Acknowledgement………………………………………………………………………………...ii
Abstract…………………………………………………………………………………………...iii
Table of Contents….……………………………………………………………………………..iv
List of Figures……………………………………………………………………………………vii
List of Tables……………………………………………………………………………………viii
Glossary of Terms………………………………………………………………………………...ix

Chapter 1 – Introduction……………………….………………….........………………………1

1.1 Motivation………………………………….………………………………………………1
1.2 Problem Definition…………………………………………………………………………3
1.3 Scope and Focus………………………………………………………………………...…3
1.4 Outline of Other Chapters……………………………………………………………….…4

Chapter 2 – Current Practices of Utility Services and Utility Bill Collection System.............5

2.1 Utility and Utility Companies……………………………………………………………..5


2.2 Units of Service……………………………………………………………………………5
2.3 Metering System…………………………………………………………………………..6
2.4 Bill Preparation…………………………………………………………………………....6
2.5 Bill Payment System……………………………………………………………………....7
2.6 Bill Defaulters and Actions Taken on Them…………………………………………...…7
v

Chapter 3 – Bill Generation and Collection System in DESA………………………………...9

3.1 About DESA………………………………………………………………………………9


3.2 Bill generation and Collection System in DESA………………………………………...10
3.3 Existing Procedure of Payment and Notification………………………………………...12
3.4 Bottlenecks of Existing Procedure of Payment and Notification…………………..........14
3.5 Problem of Delayed Bill…………………………………………………………………15
3.6 Bill Correction in the Existing system…………………………………………………..16
3.7 Problem in Decision Making…………………………………………………………….17

Chapter 4 – Proposed System of Payment and Notification………………………………....18

4.1 Suggested Billing Format………………………………………………………………..19


4.2 Suggested Bill Generation System……………………………………………………….20
4.3 Suggested Changes in Data Communication System …………………………………...21
4.3.1 Dial-up Connection through Telephone Network………………………………….21
4.3.2 SMS Communication through GSM Network……………………………………..22
4.3.3 Comparison between Dial-up and XML-SMS-GSM Technique…………………..24
4.3.4 On Line Versus Off Line Posting………………………………………………….25
4.4 Changing The Billing Software………………………………………………………….25
4.5 New Modules in the Billing Software………………………………………………..….25
4.5.1 Corrected Bill Generation and Notification of Correction Module……………..…26
4.5.2 Checking Payment Posting……………………………………………………...…28
4.5.3 Protocol Handlers for Message Passing ………………………………………...…30
4.6 New Software in the Bank…………………………………………………………….…30
4.7 Oracle Licensing Fee…………………………………………………………………….31
4.8 Issues in Bill Collection……………………………………………………….…………31
4.9 Proposed Communication between the Bank and Computer Center……………….……32
vi

Chapter 5 – Prototype Implementation of Automatic Utility Bill Collection System……...33

5.1 Suggested Bar Code Incorporation in Bill Paper………………………………………...33


5.2 Bill Collection Software in the Bank………………………………………………….…35
5.2.1 Bill Reader Module……………………………………………………………...…35
5.2.2 Bill Sender Module……………………………………………………………...…36
5.3 Bill Payment Information Receiving Software in the Service Provider…………………38
5.4 Dial-up Connection through Telephone Network………………………………………..38
5.4.1 Dial-in Server Setup in the Service Provider Computer………………………..….39
5.4.2 Dial-up Client Setup in the Bank Computer…………………………………….... 41

Chapter 6–Estimated Cost for Automated Bill Collection System………………………… 44

6.1 Computer Hardware Cost for Data Entry in each Branch……………………………….45


6.2 Computer Hardware Cost in each S & D Office…………………………………………45
6.3 Communication Hardware Cost …………………………………………………………46
6.4 Hardware Cost in the Computer Center…………………………………………….……46
6.5 Running Communication Cost per Month……………………………………………….47
6.6 Software Development Cost for Data Entry System……………………………….……47
6.7 Software Installing, Licensing and Maintenance Cost…………………………………. 48
6.8 Network Software……………………………………………………………………..…48
6.9 Software Development Cost in the DESA Billing Software………………………...…..49
6.10 Other Software Cost in the DESA Billing Software…………………………………... 49
6.11 Stationary Cost……………………………………………………………………….....50
6.12 Total Cost……………………………………………………………………………….50

Chapter 7 – Vision for Future – Billing Data Collection Automation………………………52

7.1 Use of Digital Meters to Automate Meter Reading……………………………….......…52


7.2 Use of GSM Network for Reading the Power Usage……………………………………53
7.3 Automation by Ethernet oven Power (PLC)……………………………………….…….53
vii

7.4 Automation by IPV6……………………………………………………………………..54


7.4.1 The Proposed Model……………………………………………………………….54
7.4.2 The Architecture………………………………………………………………...…55
7.4.3 The Protocol……………………………………………………………………….55
7.4.4 Consumption Metering…………………………………………………………….56
7.4.5 Pilferage Control of Electronic Consumption………………………………….….56
7.4.6 Problems and Suggestion………………………………………………….………57
7.5 Courier Service for Sending the Bills…………………………………………………...58
7.6 Introducing World Wide Web for Automation………………………………………….58
7.7 Automation of Bill Payment and Money Collection………………………………...….59
7.7.1 Prepaid Payment…………………………………………………………………..59
7.7.2 Bill Payment through ATM Card………………………………………………….60
7.7.3 Bill Payment through Internet Account……………………………………….…..60
7.7.4 Bill Payment through Credit Card…………………………………………………61
7.8 Concluding Remarks…………………………………………………………………....61

Appendix … ……………………………………………………………………………………..53

Reference………………………………………………………………………………………...75
viii

List of Figures

Figure 1.1 Outline of the Thesis Paper……………………………………………………………4


Figure 3.1 Use Case Diagram of DESA Billing System………………………………………...11
Figure 3.2 Flow chart of existing process of payment and notification………………………….13
Figure 4.4 Data Communication between Bank and DESA (Dial-up Connection)……………..22
Figure 4.5 Data Communication between Bank and DESA (XML-SMS-GSM way)…………. 23
Figure 4.6 Data Flow of the bill correction and notification procedure…………………………27
Figure 5.1 Screenshot of Bank end Bill Reader Module……………………………………...…36
Figure 5.2 Screenshot of Bank end Bill Sender Module………………………………………...37
ix

List of Tables

Table 3.1 Use Case Diagram of DESA Billing System……………………………………….…12


Table 4.1 Comparative advantage and disadvantage of Line Matrix Printer and Laser Printer…20
Table 4.2 Comparison chart for Dial-up data and GSM-SMS Data Communication…………...24
Table 4.3 Comparison between Radio Link and Broad Band…………………………………...29
Table 5.1 UPC character set……………………………………………………………………...34
Table 5.2 An example Bar Code in 1’s and 0’s………………………………………….………34
Table 6.1 Cost chart of Computer Hardware for Data Entry in Each Branch……………...……45
Table 6.2 Cost chart of Computer Hardware in each S &D Office………………………….…..45
Table 6.3 Cost chart of Communication Hardware…………………………………………..….46
Table 6.4 Cost chart of Hardware in the Computer Center………………………………..…….46
Table 6.5 Cost chart of Running Communication per Month……………………………...……47
Table 6.6. Cost chart of Software Development for Data Entry System………………..……….47
Table 6.7 Cost chart of Software Installation, Licensing and Maintenance……………………..48
Table 6.8 Cost chart of Networking Software …………………………………………...……..48
Table 6.9 Cost chart of Software Development in the DESA Billing Software…………………49
Table 6.10 Cost chart of other Software in the DESA Billing Software………………...………49
Table 6.11 Cost chart of Stationary…………………………………………………………...…50
Table 6.12 Table cost chart………………………………………………………………………50
x

Glossary of Terms

ATM Automatic Teller Machine


S&D Sales and Distribution
GSM Global System for Mobile Communication
SMS Short Message Service
XML Extendable Markup Language
ISP Internet Service Provider
CC Computer Center
VPN Virtual Private Network
DBMS DataBase Management System
SQL Structured Query Language
ACK Acknowledgement
NACK Negative Acknowledgement
UPC Universal Product Coding
GUI Graphical User Interface
QoS Quality of Service
DHCP Universal Product Coding
ISDN Integrated Services Digital Network
IPV6 Internet Protocol Version 6
EPROM Electrically Erasable Read Only Memory
T&T Telephone and Telegraph
BTTB Bangladesh Telephone and Telegraph Board
1

Chapter 1

Introduction

The use of utility is present in everywhere in the world, for example electricity,
water, gas, sewerage supply. There utility services are provided by Utility
Services Provider Organizations. And as a return of the usage of the utility
services, the consumers have to pay the bills to the Utility Service Providers. The
current system involves Banks to take the payment from the consumers and send
the payment and billing information to the Service Providers. The manual process
of Bill Collection and Notification process is troublesome, time consuming and
costly. Automating the Utility Bill Collection System introduces full or semi
computerized automation of the utility bill collection from the Consumers by the
Banks and notification process of the Banks to notify the Service Provider about
the billing information.

1.1 Motivation

The current process of utility bill collection and notification process in our
country is manual. The bill paper is in black and white that the paper has a
particular format and the billing information is entered by hand for each bill. This
process of bill paper preparation involves a great deal of work. Again when the
consumers goes to the bank to pay the bill, all the information of payment is
entered in lager by hand by the bank officer. This increases the delays of the
consumer in the queue in the bank when they goes to pay the bill. It is also a
troublesome and error prone job for the bank officers to enter all the information
2

for each bill by hand . To transfer the bill payment information from the Banks to
the Service Provider, the bank officer fills up a form supplied by the Service
Provider with the payment information. This is also an error prone boring job for
anybody. The currently existing system is not an efficient one because we have to
enter the same data twice. The way data in entered takes time as well. The
problem of delayed bill and problem of decision making is also present in the
current system.

By automating the Bill Collection and Notification the work of the Bank Officer
can be reduced by a great amount by introducing the Bar Code to carry the
billing information and reading the Bar Code by Bar Code scanner. This also
reduces the possible error introduced by the Bank Officer. As the bill collection
process will be fast, so the consumers will not need to wait for long in the queue.
By automating the Data Communication Process from the Bank to the Service
Provider, the job of the Banks are reduced much. By introducing electric mean to
transfer bill payment information, the difficulty and error possibility of
transferring the information from the Bank to the Service Provider is reduced
great deal. It will also reduce the work of entering the bill payment information in
the Service Provider Database. It will also reduce the possibility of error
occurring. Automation of the Bill Collection and Notification Process will also
reduce the problems of delayed bill and will also promote the decision making
process. It will reduce the over all cost of Bill Collection and Notification
Process. In an word, automating the Bill Collection and Notification Process will
speed up the revenue collection and improves customer services.
3

1.2 Problem Definition


The problems of utility bill processing and collection are enormous and are
increasing day by day. This thesis has been prepared for automation of bill
collection in the context of massive penetration of Information Technology, in
particular, Internet Technology. To transmit the information of payment posting,
electric measure is introduced. Here mainly three points of automation is
discussed. One problem is the collection of bills from the consumers and update
of the Bank Database. Currently this process is completely manual. This area will
be discussed with semi-automation of this process. The second problem is the
payment information transmission from the Bank to the Service Provider. This
area will be discussed with full-automation by electric means. The last point of
problem is the updating of the Service Provider Database. The new proposed
software fully automates this job.

1.3 Scope and Focus

The area of automation of the Utility Billing System is broad enough to analyze in
a single thesis. Only a limited area of the System is discussed here. The areas of
scope and focus are discussed below.
1. This document is an informative one. It does not dig into technical
details of any possible implementation. Yet it gives a prototype
implementation of the possible solution. The prototype discusses the
possible automatic utility bill collection system between Banks and
Utility Service Provider and Utility Service Provider‟s bill generation
and collection system.
2. It suggests outline and compares them with each other in technical,
financial and usage perspectives.
3. This will give philosophical guidelines and qualitative information on
relevant matters. Once options have been selected detailed analysis of
relevant matters should be performed before embarking upon a project.
4

1.4 Outline of Other Chapters

This thesis paper is organized in seven chapter as shown in the figure.

Chapter 1: Introduction
Motivation, problem definition scope and focus of the thesis

Chapter 2: Current aspects of utility systems


 Current utility services and utility companies
 Utility metering system
 Current Billing system

Chapter 3: Billing system in DESA


 Bill Generation and Collection system in DESA
 Existing procedure of payment and notification
 Bottlenecks of current system

Chapter 4: Proposed system of payment and notification


 Suggested bill format
 Suggested bill generation system
 Suggested data communication system
 Suggested changes in billing software

Chapter 5: prototype implementation of Bill Collection System


 Prototype Bill format
 Prototype Bill Collection software
 Prototype software for the Service Provider
 Prototype data communication system

Chapter 6: Estimated software and hardware cost of the


suggested system

Chapter 7: Future Improvements and conclusion

Figure 1.1 Outline of the Thesis Paper


5

Chapter 2

Current Practices of Utility Services and Utility


Bill Collection System

2.1 Utility and Utility Companies

Utility is some kind of product or service that are provided to the customers by the
utility provider. Customers for their day-to-day life use this utility. For example,
utility may electricity, water, gas or telephone services. These companies provide
these products or services and in return the customers pay bills for these utility
according to their usage. The currently well-known utility companies in our country
are

1. Dhaka Electric Supply Authority (DESA).


2. Titas Gas Transmission & Distribution Company Limited.
3. Dhaka Water Supply & Sewerage Authority.
4. Bangladesh Telegraph & Telephone Board.

2.2 Units of Service

The amount of services provided to the customers is measured in some unit for
the particular service. For each utility there is a unit. For electric bill the unit is
6

Kilowatt-Hour (KWH), for telephone bill it is measured in no of calls, for water


supply the unit is liter. For gas supply there is no such unit , a monthly payment
basis is the current system.

2.3 Metering System

For each utility there is specific meter that is used to keep records of the amount
of utility consumed. The meter may belong to the service provider or may belong
to the consumer but the controlling of the meter belongs to the service provider.
For example , in electric and water billing the meter belongs to the customer and
meter reader comes to take record of the current meter reading each month. In the
case of telephone system, the meter belongs to the service provider (e.g. BTTB)
and they compute the amount from it. Again in the case of gas supply system,
there is no meter and the customer has to pay in a monthly charge basis.

2.4 Bill Preparation

For the usage of the utility by the customers they have to pay bills. The bills are
prepared by the service provider and sent to the respective customers. In systems
that uses the postpaid billing system has a particular line rent, that is a fixed
charged for each month basis. There is a fixed amount of charge for each unit of
utility consumed. The total bill is just the multiplication of the charge per unit
with the number of units consumed by the customer plus the line rent charge. The
final bill amount also includes the service charge and Value Added Tax (VAT).

In case of Electric Bill there are some components of the bill. They are Electricity
Charge, Demand Charge, Minimum Charge and Service Charge. Summing all
these components the Principle Amount is computed. Then VAT is computed on
7

the Principle Amount. Then the VAT is added to the Principle Amount and the
total sum is called Bill Month Total.

In the case of Gas Supply there is no such amount basis charge but rather there is
a fixed amount of charge for each month and surcharge is added to it and finally
total amount is computed.

2.5 Bill Payment System

After getting the bill from the service provider, the customer has to pay for the
bill. Generally the bill is paid through bank. The banks keep account for the bill
receiving purpose and the account is solely used for this purpose. There are some
limited number of bank in any city that can receive bills from customers and these
banks cover a limited area of the city or district. The customers of the area must
pay their bill charges through the particular banks. The banks are contracted with
the service provider to receive the bill charges and keep the records. The banks
send the charge received and the records to the service providers by a month
basis. The bill charges may be paid through cash, pay order, demand draft, ATM
card or ready cash card.

2.6 Bill Defaulters and Actions Taken on Them

The service provider fixes a due date for the bill payment by the customers. If
customers fail to pay bill within the due date they become defaulter and necessary
actions are taken on them.

For example, in case of Electricity supply if bill is not paid in due date, the supply
line of the customer is cut off. The line is reestablished only by giving the due bill
charge and reinstallation fee.
8

In case of water and sewerage supply, customers are billed after every two
months for the current charge along with the due charge. If bill is not paid within
due date, a surcharge is included at a specific rate on the total due charge.

In case of telephone system, if bill is not paid with in due date, the telephone line
is cut off. If the customer pays the bill within seven days of the cut off, the
reinstallation fee is exempted. But if he fails to pay within seven days he must pay
reinstallation fee with the due charge.

In case of Gas supply, the must be paid by the third week of the current month. If
bill is not paid by this time, a surcharge is included in rate. If bill is not paid
within tenth week of the bill posting, the gas line is cut off and the contract is
dismissed.
9

Chapter 3

Bill Generation and Collection System in DESA

3.1 About DESA

Currently there are different utility service providers in our country. Each one has
their own system of bill collection, bill processing and bill posting system. In our
country, DESA (Dhaka Electricity Supply Authority) is an important organization
which supply electricity in the capital Dhaka.

In years prior to 1982 electricity bill used to be prepared at the customer's


residence. This resulted in erroneous billing and bills did not reach the customers
in time. As a result hundred of millions of Taka was left uncollected. In order to
prepare bills in time and correctly Bangladesh Power development Board (BPDB)
decided to establish a computer center. Initially bills were prepared at the
Computer Center of Bangladesh University of Engineering and Technology
(BUET). Along with the development of Information Technology BPDB and
DESA undertook a project named Financial Management Upgrade (FMU) with
the help of Asian Development Bank. It was decided to keep ledger, add
outstanding bills to the current bill, and prepare different MIS reports using
computers. As a result BEXIMCO Computers Limited PA Consultant developed
the billing software with the help of BPDB and DESA officials. In the first phase
of the FMU, computerized ledger and billing incorporating outstanding bills were
10

developed for 20,000 customers. After successful implementation of the first


phase Asian Development Bank gave loans to DESA for implementation of its
second phase. For computerization of DESA BEXIMCO Computers Limited and
Price Water Cooper Development Associates won the Work Order. Under this
Work Order billing software as well as software for 14 non-billing modules was
developed. RS/6000 server was supplied as part of the contract. Now billing and
MIS for 460,383 customers are being prepared by the Computer Section of
DESA. Now MIS and Computer department have 4 servers: NT server
(Netinfinity), SMP Server RS/6000 570 Model, SMP Server RS/6000 Model 50
and BULL Escala PL800R Server. Oracle 7.3.4 is being used as RDBMS under
AIX 4.3(back end), Windows 95(front end) and Windows NT (for file server).

The following sections gives a detailed description of the currently running


system in DESA.

3.2 Bill generation and Collection System in DESA

From the supply of utility (that is electricity) to the bill generation and collection,
DESA has a number of departments. In the currently running system DESA
involves some Banks to collect the bill from the Subscribers. The Subscribers gets
connection from the DESA Engineering Department for the use of electricity.
DESA Meter Reading Department maintains the meter reading and meter
maintaining job. They provide the meter reading information to the DESA Billing
Department. The whole tasks of generating bill and distributing the billing
information to the Subscribers is performed by the DESA Billing Department.
After getting the bill paper, the Subscribers pays the bills to the Bill Collecting
Banks and DESA Accounting Department maintains the bill collection and
notification procedure from the Bill Collecting Banks. The Use Case Diagram of
the whole running system in DESA is shown below.
11

Figure 3.1: Use Case Diagram of DESA Billing System

A description of the steps involved in the Billing system of DESA is shown below
in a tabular form. The table also shows the current status of processing and out
scope of the analysis of each steps of the Billing system.
12

Step Description Status Comments


1 Connection to Subscriber NA Out of Scope
2 Electricity usage by subscriber. Data from NA Out of Scope
connection is used in Billing purpose in
step 4
2a Electric meter gets updated on usage Automatic Point of Pilferage
3 Meter Reader collects meter reading Manual Point of Pilferage
3a Collected reading is used in Bill generation Manual Point of Pilferage
step 4
4 DESA generates bill of usage Automatic Through Software
5 DESA sends the bill subscriber receives the Manual Point of Bottleneck
bills
5a Payment is done or verified against the bill Manual Out of Scope
6 Subscriber pays the billed amount Manual Point of Bottleneck
7 Bank collects the payment Manual Point of Bottleneck
8 DESA receives payment notification by Manual Point of Bottleneck
bank

Table 3.1 : Billing Steps Discussion

3.3 Existing Procedure of Payment and Notification

In the currently existing system the consumers come to the bank with the bill.
They pay the total amount in the bill collection counter and get the consumer‟s
part of the bill with a valid seal and signature. The bank officer writes the bill
number and the paid amount in the register. At the end of the day the bank officer
fills up a form supplied by the DESA Sales Authority where he or she has to write
the bill number and amount in the specified format.
13

The payment statements are collected by the DESA Sales Authority and sent to
the DESA Computer Center. In the Computer Center the operators enter the bill
number one by one. Each data is entered by two operators for validation of the
data.

The flow chart of all these actions is shown below.

Consumers pay the bill in the bank

Bank officer takes the money and


writes the bill number and paid
amount in register

Bank officer fills up form supplied by


DESA Sales Authority at the end of
day

DESA Sales Authority collects and


sends the payment statements to the
DESA Computer Center.

Operators in the DESA Computer


Center enters the bill number one by
one

Figure 3.2 Flow chart of existing process of payment and notification


14

3.4 Bottlenecks of Existing Procedure of Payment and


Notification

As all works through the bill collection and notification process are manual and
there is no opportunity of its automation in the currently running process, it is
much error prone, needs much time and needs much work. The main points of
problems are given below.

1. In the bill collection process the bank officer has to write the bill number
and paid amount in the register. The bank officer has to put the record for
each bill brought by each consumer. This is completely a manual process.
So, it is possible for the bank officer to make mistakes in writing. Also it
needs much hard working.

2. At the end of the days when the bank officer fills up the form supplied by
the DESA Sales Authority, he is in a chance to make error. This is also a
boring job for anybody.

3. These payment statements are collected by DESA Computer Center. This


is also a manual process of information collection.

4. In the DESA Computer Center the operators enter the bill number one by
one. This is also a manual process. So error is possible here due to
illegible handwriting. Further, this same information is written by bank
officer in the bank. So in the currently existing process same data is
entered twice – once in bank by the bank officer and again in the DESA
Computer Center by the operators. So, this process is not an efficient one.
15

3.5 Problem of Delayed Bill

The due date of the bill payment of previous month (for example January) is
generated at the end of current month (for example February 25th to 27th). The
issue date written on the bill is February 5. The Computer Center fails to deliver
the bill in due time because of the following reasons:

1. The notification of the previous month does not reach the Computer
Center before the first week of February.

2. It takes rigorous labor of another week by the operators of the Computer


Center for posting all the payments.

3. Computer Center can print the bill when the entire posting is ready.
Generally the bill is sent to the S & D at the middle of the month.

4. The meter readers deliver the bill to the consumers just 5 days before the
due date.

Following are the consequences of delayed bill:

1. Meter readers visit the subscribers only once although it is their duty to
collect the meter readings (end of the month) and deliver bills (when it is
ready) in two different days.

2. Subscribers have to face a long queue in the bank. They have to waste
their valuable time in unbearably long queues.
16

3. The bank officers have to take high load at he end of the month.
Sometimes it hampers the customer service of a n bank although the
banks do not earn any money from this service.

4. Sometimes the subscribers pay the bill after the due date but they find the
amount as a due amount in the received in the next month. Actually
Computer Center cannot update all the subscribers‟ payment status and
that is why the subscribers find the paid bills as dues in the next bill. This
is one kind of injustice to the subscribers.

3.6 Bill Correction in the Existing system

The subscribers are not allowed to pay less than the amount mentioned in the bill.
If there is any error in the bill needs to be corrected. Following are the reasons for
bill correction:
1. If a subscriber‟s payment is not posted before the bill printing the
subscriber comes to the S & D with the bank‟s receipt of the payment
and requests for changing the bill.

2. A dishonest meter reader my put a fictitious meter reading, which


might cause a huge bill. The subscriber can apply for reconsidering the
bill.

3. A subscriber may apply for paying part of the bill.

The authorized officer in the S & D office overwrites the bill and writes the new
amount to be paid. The bank does not accept an over written bill without
authorized signature one. This is just estimation. Any due or overdue is adjusted
17

in the next bill. Only the correction in the meter reading is notified to the
computer center through proper format. Final correction if the database done after
checking it by authorized offices in the Computer Center (Programmers and
System Analysts).

3.7 Problem in Decision Making

As there is a delay between the payment notification and actual payment by the
subscribers in the bank we can say that the database stored in the Computer
Center is not consistent. This might make several problems in decision-making:

1. The Computer Center cannot provide the current revenue collection at


a particular day. So the management has to wait until the of batch
processing to get this information. It definitely hampers the necessary
purchase of DESA.

2. The law enforcement department may harass a subscriber by


disconnecting the electricity line although the subscriber might have
paid the entire outstanding bill a few days back.
18

Chapter 4

Proposed System of Payment and Notification

The proposed system is the automation of the utility bill generation, collection
from the Consumers by the Bank and notification of the collection to the Utility
Service Provider by the Bank. In the automation of the bill collection system both
current bill format and bill payment system is changed. And in the automation of
notification process the data transaction information is transmitted directly to
service provider from collecting banks in an electronic format. This requires
change in four areas of current system

1. Changes in generated bill format

2. Changes in bill generation system

3. .Changes in data communication system between banks and service


provider.

4. Changes in bank end bill collection software and in service provider


end billing information reconciliation software.
19

4.1 Suggested Billing Format

The current bill format contains information in letter and digit format. The
proposed system also introduces Bar Code that will contain the billing
information. Bar Codes in the bills in both the parts of the bills must be put. This
Bar Code must contain the bill number and the amount to be paid by the
consumers. Change of bill format is required to use optical devices like scanner
for reading bills. The advantages of introducing Bar Codes are as follows:

1. The bank officer can easily scan a bill if there is a computer equipped with
a scanner in the bank.

2. The bank officer does not need to write bill numbers and amount paid.
That will be automatically stored in the computer database.

3. At the end of day it will be very easy to generate the statements of


collection.

4. Generally one consumer comes with multiple bills. It takes time to sum
them up. Scanner can do that automatically.

5. Definitely more consumers can be served by this system.

6. Waiting time in the queue must be less than before.

7. The data entry in he Computer Center is not required.


20

4.2 Suggested Bill Generation System

The quality of the barcode in the bill should be of good quality so that it can be read
by the scanner without any error. The suggested two options are the existing line
matrix printer or multiple laser printers. The comparative advantages and
disadvantages are as follows:

# Issue Line Matrix Laser Printer


1 Bar Code Supports Bar Code fonts Fonts not required as it prints Bar
Support Code as graphics
2 Heavy duty and It is a heavy duty printer. One Not heavy duty. Requires
speed printer is sufficient for all bill multiple laser printers to print all
printing. the bills.
3 Fault tolerance System will be down if the There must be multiple printers,
single machine goes down. so one faulty machine is not a
problem.
4 Printing quality Quality may degrade when Does not require careful
the toner is low. Careful inspection for low toner signal.
inspection is required. Quality must be better than
matrix printer.
5 Cost Printer cost is high, but the Cost of printing for each bill is
printing cost is very low. twice than that of line matrix, but
machine cost is not that high.
6 Availability Not available in the local Available in the local market.
market.

Table 4.1: Comparative advantage and disadvantage of Line Matrix Printer and
Laser Printer
21

4.3 Suggested Changes in Data Communication System

Here data communication means the billing information that needs to transmit to
the Service Provider (e.g. DESA) Computer Center database from the individual
bank databases. Billing information includes bill number, date, billing amount
paid by the consumers at the banks. Currently there is no electric means to
transfer this billing information. So, it is much convenient to transfer this
information electrically. It is a cheap means to transfer a lot of information. Two
possible ways are suggested for the data communication from the bank database
to the DESA Computer Center database.

a) Communication through telephone lines by dial-up connection.


b) Communication through GSM network by SMS data interchange.

4.3.1 Dial-up Connection through Telephone Network

In this communication system the DESA Computer Center maintains a server


computer which is configured to accept in coming dial-in connection using
modem through telephone network. and the bank maintains a client computer
which dials up in this DESA computer using modem through telephone line. And
there is also a server program which always listens at a certain particular port no
for clients trying to make connection with this computer. The bank end software
receives the bills by reading the Bar Codes of the bill paper and updates the bank
database. At the end of the day, the bank end computer dials up in DESA
Computer Center computer. When the connection is established, the bank end
program reads the billing information in that day and makes a connection with the
DESA Computer Center computer program and then sends the billing information
as XML file. The DESA end computer receives the file and saves it in the disk
22

and then it makes connection with the DESA DBMS and updates the database
according to the information in the XML file.

Figure 4.4: Data Communication between Bank and DESA (Dial-up Connection)

4.3.2 SMS Communication through GSM Network

In this communication system the both the Service Provider and the Banks use
GSM modem with SIM and the GSM network to transmit the billing information
in the form of SMS. Also XML processing is involved. The bank end software
retrieves the day-to-day billing information from the Bank end database and do
some XML processing like XML fragmenting and sequencing. Then the
information is converted in the form of SMS and the SMS is sent through the
GSM Modem to the GSM Network which has SMS gateway. The Service
Provider (e.g. DESA) end software receives the billing information from the GSM
23

Network in the form of SMS. Then it performs the XML reassembly and converts
the XML into SQL statement and updates the Database accordingly. The lowest
layer both the Bank end software and Service Provider end software implements
the protocol handler which maintains the protocol of transmitting the SMS
through the GSM Network.

Figure 4.5: Data Communication between Bank and DESA (XML-SMS-GSM way)
24

4.3.3 Comparison between Dial-up and XML-SMS-GSM


Technique

A comparative analysis is given in the following table between the above two
modes of data communication.

# Issue Dial-up XML-SMS-GSM


1 Bank End Cost Telephone and a modem GSM connection
(SIM) and a modem.
2 DESA End A dial-in setup. Increases as Fixed, just the same as
Cost number of banks increase. bank end. If necessary
new modems can be
included easily.
3 Running Cost Telephone call charge SMS is going to be free
4 Reliability Call/connection drop is a reality. No data loss. Gateway
stores data. Delivery is
ensured.
5 Speed Slightly faster if there is no Uniform but slow.
interference
6 Complexity Simple to implement in More complex to
software implement in software
7 Software Connection oriented, cannot be Connectionless, can be
Impact controlled by software. easily controlled by
software.
8 Scalability Not much Highly scalable
9 Coverage Major cities, but cost increases Almost allover
as distance increases. Bangladesh

Table 4.2 Comparison Chart for Dial-up data and GSM-SMS data communication
25

4.3.4 On Line Versus Off Line Posting

Using the proposed communication link the bank can send the posting information
right away as soon as a customer pays the bill. But according to the bank they
cannot send the posting unless the cash box is closed and the account is balanced.
That is why we do not need to think about on line posting. Dialing up once at the
end of day or sending SMS messages at the end of day is more than enough to
automate bill collection system.

4.4 Changing the Billing Software

We need to upgrade the bill generation software to introduce the barcode in the
bills. There are some off the shelf library packages to generate Bar Codes provided
by the software companies. These routines are not that costly and can be purchased
from the Internet. So introducing the barcode will not be a very difficult job.

4.5 New Modules in the Billing Software

Following new modules should be introduced in the DESA billing system to make
the system fully automated.
26

4.5.1 Corrected Bill Generation and Notification of Correction


Module

This module will be specially used by the S & D offices to print a new bill and
sending the corrections to the Computer Center. Figure 4.6 shows the data flow of
this process. The different steps of this processing are as follows:

Step 1: The subscriber will come to the corresponding S & D office with valid
proof of his claim such as previous paid bills and current meter reading. In some
cases applications with proper explanation of partial payment are accepted for
consideration.

Step 2: S & D office is online with the Computer Center Database. A screen will
be developed to enter all the suggested corrections of that particular bill and the
records of the subscriber. These suggested corrections will be stored in a
temporary data file.

Step 3 and 4: The software will print a provisional bill based on the suggested
corrections. No previous records are checked in this billing. The final calculation
will be done in the next bill processing and any discrepancy will be adjusted in
the bill of the next month. The bar coded provisional bill will be given to the
subscriber after signing it by an authorized personnel (AD accounts, SD Engineer
or Executive Engineer) with a valid seal.

Step 5: S & D office will send the bundle of corrections in the existing paper
format to the Computer Center.
27

Step 6: Authorized personnel in Computer Center will check the correction


request sent by the S & D office. The bill correction module will assist to find out
whether the proposed correction is consistent. The correction will be done in the
main table of the database if it seems to be valid. Inconsistent corrections will not
be updated and notified to the S & D office. The S & D personnel must log in to
the billing system to know whether there is any rejected correction request. This
process will be paperless and automatic.

Applies for Bill Correction


Step 1
S&D
Authority
Se
nd
st
Subscriber he
co
Place s Req ue st for Corre cted Bill

Ste rrec
p 5 tio n
s he
Pro vision al Bill with Barcod es

et
Step 2

e
th
Step 4

ts
ec
R ej
d
an s Computer
ns tion
io c Center
ct rre Authority
o rre Co
c n 6 t
lid te p
va n sis Ste
e
th sco
its in
m
om
C

Billing Data
Computer Center
Step 3
Database
S & D printer

Figure 4.6: Data Flow of the Bill correction and notification procedure
28

4.5.2 Checking Payment Posting

There is no guarantee that the bank did not manipulate the received payment
information. The bank can change the bill number or the amount of the bill or
both the data. A checking by authorized personnel from S & D office is required.

At the end of the day S & D collects the paid bills in bundles from the branches of
the bill collecting banks. A set of software should be developed to check whether
all these paid bills have been posted by the bank. It is doable as the S & D offices
are connected to the Computer Center. The software can perform the checking if
it has the following functionalities:

 Each bill will be read by the scanner. The software will check the database
whether the bill has been posted by bank.

 The total collection of a branch of a bank will be checked with the bundles
of the paid bills received in a day.

 The software will be capable to find out the postings without receipts or
the receipts without postings.

For checking the payment posting there must be online connections between each
S & D office and the Computer Center. Following table shows comparative
analysis between Radio link and Broadband connection as a communication
system. Considering the relative advantages and disadvantages we suggest a VPN
over the broadband Internet connection to set up a network between the Computer
Center and S & D offices of DESA.
29

# Issue Radio Link Broad band


1 Bandwidth 1 Mbps through air 1 Mbps through cable
2 Establishment Very high No establishment cost
Cost
3 Running Cost Maintenance charge required Monthly fee required for
maintenance and rent of the
bandwidth.
4 Security Not secured. Anybody can A VPN can be installed to set
copy the transmitted data up a secured private network
from the air. for DESA.
5 Other facility Can be used for Internet if CC The connection will be rented
serves as an ISP. from an ISP, so it will be
used as an Internet connection
by default.

Table 4.3: Comparison between Radio Link and Broad Band

On line connection between the S & Ds and the Computer Center is necessary not
only for the checking of payment posting but also for decision making. The
authority of S & D must have the opportunity to view the status of a consumer‟s
account. The required software with this facility is already developed in the
running billing module in the Computer Center. An online connection is the only
thing required to provide this facility to the S & D offices.
30

4.5.3 Protocol Handlers for Message Passing

SMS messages are simple messages like email. It is not like a connection between the
sender and receiver. Using this technology of message passing we cannot update the
database directly. Following layers of protocols must be developed for the sender
workstations in the banks and the server in the Computer Center if we want to do
online payment posting using SMS messages over GSM network:

 SMS messages do not follow connection-oriented protocol. An SMS message


may be sent to the receiver right away or it might be sent later on. To get the
on line facility we must implement Acknowledgement based message-passing
system in a layer.

 Duplication of SMS messages and sequence control will be done in one


message.

 The message must contain security information. A layer is required for


authentication in the server side.

 The SQL for updating the Computer Center Database will be sent in SMS
message format. A layer will do the transformation between SMS message
format and SQL/XML message format.

4.6 New Software in the Bank

A database system of medium-scale must be developed for the bank to receive bills
and posting the paid bills. The software must have the following functionalities:

 The data input screen must have the facility to read the bar codes in the bills.
Some times the bar codes might not be read by the scanner due to wear and
tear of the bills. That is why the screen must be able to take inputs from
keyboard as well.

 The data of the received bills will be stored in a database in the data entry
workstation.
31

 Each bank must have a user id to log into the Computer Center database with
the insert permission on a table to send all the paid bill information.

 The software must have the facility to receive multiple bills at a time, as it is a
common practice that one person comes with the bills of his tenants and
neighbors.

 The software will generate a day end detailed and summary report of collected
bills.

 The software does not need to store all the data. Storing the payment
information for couple of months is sufficient, as the banks do not take the
responsibility of the bills after the receipts are sent to the S & D office.

4.7 Oracle Licensing Fee


The existing billing database in the back end is Oracle. Approximately 250 oracle
licenses are required if the developed software is a direct client of oracle. We
suggest web-based applications to reduce the cost of oracle license. There must be a
web server in the DESA Computer Center. All the communications to the Oracle
database must go through the web server, so one connection license for the web
server is sufficient for the applications. The database server can be configured as a
web server.

4.8 Issues in Bill Collection

Following issues regarding bill collection should be resolved before starting the
project of automating bill collection:

1. As the banks do not get any money for collecting bills they are not
interested to develop the software for free.
32

2. It will be really difficult to provide maintenance support of the bill


collecting software.

3. The banks might be really interested to adopt this change if DESA


authority provides a certain amount of service charge for bill collection. In
that case the IT departments of the banks might buy the software from the
vendors and will take part for maintaining the software.

4. The bill collecting software can be easily developed for all the utility
organizations if every utility organization provides the barcode in the bill.

5. The banks will not be that much interested if only one organization
provides bar code because they need to set up separate queue for DESA.
This will not be very much appreciated by the subscribers because a
subscriber usually wants to pay all the bills in one counter.

4.9 Proposed Communication Link between the Bank and

Computer Center

The key point to use SMS services over wireless network is the cheap
countrywide on line service provided by wireless operators (e.g., Grameen Phone)
between the server and data entry system using SMS. In this particular case we do
not need on line communication, as data will be sent once at the end of day. That
is why BTTB lines, the cheaper solution is recommended. Another good point
behind choosing the BTTB lines is that it will not require one year to develop
protocol handler for the DESA Computer Center. In each commercial Operating
System there is a built-in communication modules for dial up networking. On the
other hand, wireless communication is a state of the art technology with better
maintenance service than BTTB. So DESA can think about wireless solution in
future for better service.
33

Chapter 5

Prototype Implementation of Automatic Utility


Bill Collection System

5 Prototype Implementation to Automate the System

To automate the system there are several fields where prototypes are suggested.
These prototypes covers the basic requirements of the automation rather
implementing in details. They are discussed in the next sections.

5.1 Suggested Bar Code Incorporation in Bill Paper

The suggested system introduces Bar Code in the bill paper. This new
incorporation will automate the bill collection process. Bar Code scanners are
needed to read the Bar Code. The suggested Bar Code contains the Owner ID, Bill
No, Date and Bill Amount of the respective bills. All the four fields contain eight
digits. The total length of the Bar Code is of 32 digits. The suggested Bar Coding
uses the UPC style standard. There is a center line in the middle of the Bar Code
Right hand digits are encoded using „Right Hand‟ with even number of 1‟s (i.e.
34

even parity) and left hand digits are encoded using „Left Hand‟ with odd number
of 1‟s (i.e. odd parity) as shown in Table 5.1.

Digit Left Hand Right Hand


0 0001101 1110010
1 0011001 1100110
2 0010011 1101100
3 0111101 1000010
4 0100011 1011100
5 0110001 1001110
6 0101111 1010000
7 0111011 1000100
8 0110111 1001000
9 0001011 1110100

Table 5.1: UPC character set

Here a 1 represents a dark band and a 0 represents an absence of dark band. For A
bill information in Bar Code form (in 1 and 0 notation) of Owner ID of 310032,
Bill No of 423312, date 13-Apr-2004 ( i.e. 13-04-2004) and amount 34000 is
shown below.

Field Decimal Bar Code in 1 and 0 notation


Name Number
Owner 310032 0001101 0001101 0111101 0011001 0001101 0001101 0111101 0010011
ID
Bill No 423312 0001101 0001101 0100011 0010011 0111101 0111101 0011001 0010011

Date 13-04-2004 1100110 1000010 1110010 1011100 1101100 1110010 1110010 1011100

Amount 34000 1110010 1110010 1110010 1000010 1011100 1110010 1110010 1110010

Table 5.2: An example Bar Code in 1’s and 0’s


35

Here the Owner ID, and Bill No are taken from the Left Hand and Date and
Amount are taken from the Right hand. To make each field eight digit, sufficient
number of digit 0 is preceded to each field which needed.

5.2 Bill Collection Software in the Bank

The bill collection software in the bank collects the billing information and sends
the payment information at the end of the day through telephone line using dial-
up technology. The prototype is implemented in Java programming language. The
program has two module , one is the bill reader and other is the bill sender. Both
of the modules is discussed below. The Bank Database here used is Microsoft
Access.

5.2.1 Bill Reader Module

The bill reader module reads the bill information of the customer bill paper Bar
Code with the help of Bar Code scanner and updates the Bank Database
accordingly. The module also has the provision for entering the billing
information by hand in the text field of the GUI of the program. The Bank
computer must have the Java Virtual Machine running in order to run the
program. The module uses the Java Serial Port Communication API (javax.comm
package) to read the Bar Code of the bill paper. The module also has the facility
of finding a record of bill previously inserted in the bank Database. It can then be
updated and inserted again. This introduces the facility of correcting a previously
incorrect record insertion.

When the program is run, the Bank Officer has to reads the Bar Code from the bill
paper with the Bar Code Scanner. The Bar Code scanner must be connected with
the Serial Port (COM). Then our program reads the data from the COM port and
36

parses the Bar Code digits into 4 fields Owner ID, Bill No, Date and Amount. The
code of the Bar Code reading portion of the program is given in Appendix. These
values of the fields are then put the text fields of the GUI of the program. Then
when the Bank Officer clicks the Add button, the record is inserted into the Bank
Database.

Figure 5.1: Screenshot of Bank end Bill Reader Module

If any bill paper contains Bar Code that can not be read by scanner, then the
information can be inserted by Bank Officer with the help of keyboard.

5.2.2 Bill Sender Module

In this way when all the bills of the day is inserted in the Bank Database, the
billing information needs to transfer to the Service Provider Database. The Bill
Sender Module of the Bill Collection program makes an XML file with the
37

records of the day and sends it to the Service Provider computer. In the Service
Provider computer, another programs runs to receive the billing information.
When the Bank Officer clicks the Today‟s Transaction button another window
appears showing all the bill records of the day.

Figure 5.2: Screenshot of Bank end Bill Sender Module

To actually send the data to the Service Provider Database, the Bank end
computer needs to dial-up in that of Service Provider. The dial-up process is
discussed in the next section. When the Bank computer is logged on with valid
user account and password, Bank Officers can clicks the Send button and then all
the billing records are put in a XML file and sent to particular port number of the
Service Provider computer. The program running in the Service Provider
38

computer listens at that port number and when the data is read, it updates the
Service Provider Database.

5.3 Bill Payment Information Receiving Software in the


Service Provider

The Bill Payment Information Receiving software is written in Java programming


language. In order to run it, the Service Provider computer must have Java Virtual
Machine running in it. When the program is run, it starts to listen at a particular
port number that is known by the Bank end Bill Collection software. To actually
receive the data from Bank end computers, the Service Provider computer must
have the dial-in Server running (Remote Access Server ). The procedure of setting
up the dial-in Server is discussed in the next section. When the Bank end Bill
Collection software sends the billing information in the from of XML file, the
Service Provider end software reads the file and parses the records and updates
the Service Provider Database. The DBMS used in the prototype is Microsoft
Access. But the suggested DBMS is Oracle. The codes related to the data
reception and update of the database is given in Appendix A.

5.4 Dial-up Connection through Telephone Network

To transfer the billing information from the Bank Database to the Service
Provider Database the dial-up technology is suggested. In this technique the
Service Provider maintains a computer with a dial-in server configured and the
bank end computer is configured to dial-up in that computer. Both the Service
Provider computer and the Bank computer use modem and telephone line to
establish this communication line. The Service Provider computer maintains a
user account for each bank so that the banks can use these user names and their
39

passwords to dial-up in Service Provider computer and can transmit data. The
detailed procedure for establishing dial-in server in Service Provider computer
and dial-up client in Bank computer is discussed in the following sections.

5.4.1 Dial-in Server Setup in the Service Provider Computer

The Service Provider computer keeps a user account for each Bank who wants to
transmit data. To allow incoming calls, the dial-in server must be set up. To
configure this in a Microsoft Windows PC such as Microsoft Windows XP the
following steps should be performed.

1. The Network Connections window is to be opened. It can be opened by


double-clicking the Network Connections icon in the Control Panel
window. When the Network Connections window appears, Create New
Connection is to be selected.

2. Then the New Connection Wizard appears. Selection of Next button


brings new window where four choices appear where different kinds of
connection can be set up. The last choice, Set up an advanced connection
needs to be selected.

3. Selecting the Next button, appears a new window where two choices
appears, one for accepting incoming connections and other for connecting
to other computers. In this step, the Accept Incoming Connection radio-
button needs to be selected.

4. Selecting the Next button brings another window where the device
needs to be selected which will be used to accept incoming connection.
The incoming connection can be granted from the Parallel Data Line or
Serial Data Line. If a modem is to be used for incoming connection which
is connected to a Serial Data Line.
40

5. From the different type of devices, the device needs to be chosen which
will be used for receiving incoming calls. As for example, the modem
which is connected with the telephone line which has the telephone
number that the banks uses to dial-up in this Service Provider computer.
Selecting Next button appears another window where the virtual private
connections can be allowed.

6. Allowing VPN connections, Windows will modify the Internet


Connection Firewall so that the computer can send and receive VPN
packets. Virtual private connections to a computer through the Internet are
possible only if the computer has a known name or IP address on the
Internet. Allowing VPN, another computer can connect this computer
through a VPN connection. Selecting Next button appears a window
where the user needs to be selected who will dial-up from Bank computer.
Here, there needs to be at least one user for each bank who wants to make
incoming connection. The add button can be used to add user and the
check box needs to be selected for the users to allow them dial-up.

7. Then next window shows the networking software that will be enabled
for incoming connections. Selecting the Internet Protocol (TCP/IP)
enables the Transmission Control Protocol/Internet Protocol. It is the
default wide area network protocol that provides communication across
diverse interconnected networks. The File and Printer Sharing for
Microsoft Networks allows other computers to access resources on this
computer using a Microsoft Network. Selecting QoS Packet Scheduler
provides network traffic control including rate-of-flow and prioritization
services. Client for Microsoft Network allows the computer to access
resources on a Microsoft Network.
41

8. Selecting the Properties button of the Internet Protocol (TCP/IP) chick


box appears a new window where the IP address of the client computers
can be set up. Selecting DHCP allows the DHCP server to run at the time
of boot up and when a client wants to connect to this computer, the DHCP
server assigns the client a IP address dynamically using DHCP.
Alternatively the range of IP address for the clients can be set.

9. Selecting Next finishes the configuration of incoming connection and


shows a confirmation window.

When all the above steps are performed successfully, the connection icon is
shown in the Network Connections folder. Next time it can be used to modify the
properties of the incoming connection. Double clicking the Incoming Connection
icon opens a new window where there are tabs for changing the configuration of
incoming devices and VPN, Users and Network components.

5.4.2 Dial-up Client Setup in the Bank Computer

To transfer data from Bank Database to the Service Provider Database the
software in the bank needs to connect to the server software in the Service
Provider computer. As both the server program and the client program uses socket
to connect to each other they need a TCP/IP network layer. As the Bank computer
uses modem and telephone line to make connection with the Service Provider
computer, its dial-up service needs to be configured. To configure dial-up
connection in a Microsoft Windows PC such as Microsoft Windows XP the
following steps must be performed.

1. The Network Connections window needs to be opened from the Control


Panel. Then selecting the Create a new connection brings a new window
42

where there are four choices and from these choices the second choice
Connect to the network at my workspace needs to be selected.

2. Selecting Next button brings a new window where the first choice ,Dial-
up connection needs to be selected. It allows making connection using
modem and telephone line or ISDN phone line.

3. Selecting Next appears a new window where the name for the
connection is set up. Any name can be used but it is recommended that the
name should relate to the server name or the company to which the
connection is requested.

4. Then selecting Next brings a new window where the telephone phone
number is set up. It is the telephone number of the telephone line that is
connected with the modem that is used to accept incoming calls in the
Service Provider computer.

5. Selecting Next button finishes the dial-up client set up and shows a
confirmation window. It can be then used to connect to the Service
Provider computer.

6. To actually connect to the Service Provider computer, the dial-up icon


in the Network Connections window needs to be selected.

7. Then a window appears where the user name and password of the Bank
that the Service Provider has assigned to the Bank is to be entered. And
then clicking the Dial button attempts to connect to the Service Provider
computer. If there is no any other problem then the connection will be
established.
43

When the connection is actually established, the Bank software can send the
day-to-day billing information to the Service Provider computer using sockets
and input-output streaming.
44

Chapter 6

Estimated Cost for Automated Bill Collection


System

The cost for the automation of the DESA bill collection and notification system is
estimated by considering the current cost of the hardware and software in the market. The
cost is analyzed by considering each sector of automation. The following sections show
the detailed chart of the estimated cost of each sector in the current currency of
Bangladesh (i.e. Taka).
45

6.1 Computer Hardware Cost for Data Entry in Each Branch

Cost Head Taka

A PC workstation with necessary system S/W 45,000.00

Handy 1D bar code scanner 5,000.00

One Laser Printer 17,000.00

One slip printer 3,000.00

UPS (to provide one hour back time for the computer and 20,000.00
the slip printer)

Telephone Line 10,000.00

Total Cost 1,00,000.00

Table 6.1: Cost chart of Computer Hardware for Data Entry in Each Branch

6.2 Computer Hardware Cost in each S & D Office

Cost Head Taka

A PC workstation 45,000.00

Handy 1D bar code scanner 5,000.00

One Laser Printer 17,000.00

UPS (to provide one hour back time for the computer and 20,000.00
the slip printer)

Total Cost 87,000.00

Table 6.2: Cost chart of Computer Hardware in each S & D Office


46

6.3 Communication Hardware Cost

Cost Head Taka

Dial Up Modem (If BTTB lines are used) per branch 4,000.00

GSM Modem with SIM card (wireless solution) per 10,000.00


branch

Table 6.3: Cost chart of Communication Hardware

6.4 Hardware Cost in the Computer Center

Cost Head Taka

Access Server (If BTTB lines are used) 3,00,000.00

Protocol Handler Server (wireless solution) 2,00,000.00

Laser Printers (12 pcs) 12,00,000.00

Line Matrix printer (2 pcs) 12,00,000.00

20 Telephone Lines 2,00,000.00

Table 6.4: Cost chart of Hardware in the Computer Center


47

6.5 Running Communication Cost per Month

Cost Head Taka

For BTTB Lines (off line) per branch 300.00

For wireless solution per branch 300.00

VPN cost per S & D office per month 2,000.00

Table 6.5: Cost chart of Running Communication per Month

6.6 Software Development Cost for Data Entry System

Cost Head Taka

System Analysis and Design 4,00,000.00


Time required: one month
Required effort: 6 man month

Coding 2,00,000.00
Time Required: one month
Required effort: 4 man month
Software Testing 2,00,000.00
Time Required: one month
Required effort: 4 man month
Total Cost 8,00,000.00

Table 6.6: Cost chart of Software Development for Data Entry System
48

6.7 Software Installation, Licensing and Maintenance Cost

Cost Head Taka

Installation and Training per branch 5,000.00

Licensing per bank branch 20,000.00

Maintenance per month 1,000.00

Table 6.7: Cost chart of Software Installation, Licensing and Maintenance

6.8 Networking Software


For Dial up Connection, cost is included in the Data Entry Software. For wireless
solution we find the following costs due to develop protocol handler:

Cost Head Taka

Analysis and Design of the Protocol 10,00,000.00


Time required: two months, required effort: 12 man month

Coding 5,00,000.00
Time required: two months, required effort: 8 man month

Software Testing 5,00,000.00


Time required: Two months, 4 man month

Total Software Development cost 20,00,000.00

Maintenance Cost (per month) 1,00,000.00

Table 6.8: Cost chart of Networking Software


49

6.9 Software Development Cost in the DESA Billing Software

Cost Head Taka

Bar code generation 1,00,000.00


(Requires one month, total effort 2 man month)
Provisional bill printing module 2,00,000.00
(Requires one month, total effort 4 man month)
Correction Notification module 2,00,000.00
(Requires one month, total effort 4 man month)
Total Cost 5,00,000.00

Table 6.9: Cost chart of Software Development in the DESA Billing Software

6.10 Other Software Cost in the DESA Billing Software

Cost Head Taka

Installation and Training 2 officers per S & D office 5,000.00

Licensing fee per S & D office 20,000.00

Per month maintenance cost per sales office or computer 1,000.00


center

Table 6.10: Cost chart of Other Software in the DESA Billing Software
50

6.11 Stationery Cost

Cost Head Taka

Stationery cost (Paper, ribbon, toner) per bank branch per 1,000.00
month

Stationery cost (Paper, ribbon, toner) per S & D per 1,000.00


month

Table 6.11: Cost chart of Stationery

6.12 Total Cost

Let there be 200 branches and 35 S & D offices collecting DESA bills. Now the
required fixed and recurring costs are as follows:

Costs BTTB Lines Wireless Solution


Computer Hardware Cost for the data entry
2,00,00,000.00 2,00,00,000.00
in 200 branches (fixed Cost)
Computer Hardware and networking Cost
30,45,000.00 30,45,000.00
for 35 S & D offices (fixed Cost)
Communication Hardware Cost in 200
8,00,000.00 20,00,000.00
branches (fixed cost)
Hardware Cost (printers and access server)
17,00,000.00 14,00,000.00
in the Computer Center: (fixed Cost)
Software Development Cost for Data Entry
8,00,000.00 8,00,000.00
System: (fixed Cost)
Software licensing cost in 200 branches
40,00,000.00 40,00,000.00
(fixed cost)
Software Installation and Training Cost in 10,00,000.00 10,00,000.00
51

Costs BTTB Lines Wireless Solution


200 branches (fixed cost)
Software Maintenance in 200 branches
2,00,000.00 2,00,000.00
(Per month)
Protocol Handler (fixed cost) NA 20,00,000.00
Protocol Handler maintenance (per month) NA 1,00,000.00
Software Development Cost in the DESA
5,00,000.00 5,00,000.00
billing Software: (fixed cost)
Software licensing cost for 35 S & D
7,00,000.00 7,00,000.00
offices (fixed cost)
Software Installation and training in 35 S
1,75,000.00 1,75,000.00
& D offices (fixed cost)
Software Maintenance Cost in 35 S & D
offices of DESA billing Software: (per 35,000.00 35,000.00
month)
Running Communication Cost in 200
60,000.00 60,000.00
branches (per month)
Stationery cost in 200 branches (per
2,00,000.00 2,00,000.00
month)
Stationery cost in 200 branches (per
35,000.00 35,000.00
month)
Networking cost for the S & D offices (per
70,000.00 70,000.00
month)
Consultancy Cost (preparation of TOR, bid
evaluation and certification for Hardware 10,00,000.00 10,00,000.00
and Software)
Total Fixed Cost 3,37,20,000.00 3,66,20,000.00
Cost Recurring Cost per Month 6,00,000.00 7,00,000.00

Table 6.12: Total cost chart


52

Chapter 7

Visions for Future – Billing Data Collection


Automation

Bill collection is not the only area where Information Technology should be applied.
There are several other areas where automation can be done by applying the already
existing techniques. These are as follows:

 Use of automated meter collection system


 Automatic meter reading collection using the network between subscriber‟s
meter and Computer Center
 Introduction of self-reading system
 Automation of bill sending directly to the subscribers
 Automation of bill payment through World Wide Web.

7.1 Use of Digital Meters to Automate Meter Reading

Digital electric meters have already been installed in several areas under DESA. This
meter is made of electronic circuits and provides lots of data like power consumptions
in different days, power factor, peak load and lowest load etc. Only the power
consumption in kilowatt is used for billing. In the existing system the meter readers
go to the subscribers‟ home and read the meter and write that in meter reading sheet.
There are some special cards that can be easily interfaced with the digital meters and
the reading can be taken by pressing a button only. The reading will be stored in the
53

machine and data can be uploaded to the Computer Center server from a workstation
in the S & D.

7.2 Use of GSM Network for Reading the Power Usage

The main purpose of using this type of network for meter reading is as follows:

 Make pilferage zero by eliminating human interference/involvement


 Making the collection process faster. If meter reading can be collected in
one day, bill can be generated the next day and payment can be ensured
much earlier than what is in current situation

7.3 Automation by Ethernet over Power (PLC)

All the consumers are connected to the national grid through the power cable.
This is the largest network of our country. This network can be easily used as data
carrier. A high frequency band can be chosen to send data through the power line.
Thus the efficient use of power lines can result in a good infrastructure for the
Internet in Bangladesh. The meter readings will be sent from the consumers‟
meters to the computer center. The hardware and software required for this
system are as follows:

 An electronic circuit that reads the meter and creates the frames containing
the reading once in a random interval.
 Repeaters, Ethernet switches are essential in different places of the
network (feeder lines, transformer, sub stations). The job of these
networking equipment are to shape up the weaker signals and routing the
frames to the computer center.

 A server in the computer center must be able to read meter reading frames
and update the database accordingly. Not all the sent frames will arrive the
54

Computer Center of DESA. Only one reading in a month is sufficient for


processing the bill of a consumer.

7.4 Automation by IPV6

It is anticipated that, with the advent of IPV6, each and every machine of the
world would get an IP address and hence if connected to the network, each can be
accessed from any where of the world. In this section we propose a model for the
automation of bill data collection using the above-mentioned feature of IPV6.

7.4.1 The Proposed Model

First we present our proposed model, its architecture and the corresponding
protocol. The model we are proposing is quite simple and has some assumptions
that are stated as follows.

1. Each and every house in a city (or a particular area which is under the
scheme) has to have an Internet connection.
2. Each and every (major) electric appliance must have an IP (IPV6) address.
3. The appliances also must have built-in (economically cheap) chips that
would be able to run a routine according to the protocol/program residing
on the chip. This particular chip must have a transmitter and receiver for
communication. The protocol is basically and essentially an authentication
protocol.
4. There must be a central authority that will perform the registration,
authentication and other activities.
55

7.4.2 The Architecture

Now we are ready to present our architecture as follows. As per our assumptions,
each and every house must have an Internet connection. We call this particular
connection an “IAP” which means the Internet Access Point. On the other hand
each electric appliance is termed as “ECP” which means Electricity Consumption
Point. Note that in our architecture for simplicity we are assuming that each house
has a single IAP. It is, however, obvious that there would be more than one ECP.
Each IAP would have a receiver/transmitter in order to establish a radio link
connection between itself and each of the ECP‟s. Recall that each ECP, according
to our assumption, must have a receiver/transmitter pair. The central authority for
all our purpose has to be a server that we call CAS (Central Authority Server).

7.4.3 The Protocol

The protocol proposed by us for this architecture is also quite simple and utilizes
the built-in chip assumed to be present in each of the ECP‟s. As is indicated in the
assumptions, this built-in chip would be able to run a routine (implementing the
protocol) residing in it (preferably in the form of a EPROM for the provision of
future changes). Each ECP could be used by multiple users (not simultaneously
though) and hence there has to be a way of logging on into the ECP. This can be
done by sending a particular (pre-defined) command message, through mobile
communication, with the user name and password as parameters. As soon as a
“log on” command is received by an ECP, it sends and “authentication request”
command to the CAS. It should be clear that these messages are sent and received
via mobile communications (recall the presence of receiver/transmitter pair in
each of the ECP‟s and IAP). Also note carefully that the communication to CAS
is through IAP and in fact all communications of ECP are to and from IAP. Only
IAP is responsible to communicate to CAS. Now in response to the
“authentication request” the CAS would either validate or invalidate the request
56

depending on respectively whether there is an entry or not of the corresponding


username with matching password in the CAS server. Obviously each potential
user for a particular ECP must be pre-registered to CAS. The ECP allows
consumption of electricity i.e. the appliance starts, if and only if CAS validates
the consumption. Otherwise the “log on” request fails and the user will not be
able to use the appliances. Now the only thing that is left to make clear is how the
different appliances are distinguished. In fact this should be clear to the reader
already that the IPV6 comes into play in this aspect. As is mentioned in the
assumptions, each appliance should have an IP address and hence each command
to a particular appliance should bear the IP address of the appliance inside the
message so that the corresponding message reach the intended appliance.

7.4.4 Consumption Metering

Metering is a real problem especially in countries like Bangladesh. Our proposed


model provides a simple way of metering the consumptions. Since each appliance
must authenticate through CAS whenever it is started, CAS may easily keep track
of the start and end of the appliance (when the appliance is about to stop another
message may be sent to the CAS). Each appliance may possess the capability to
calculate its own power consumption and hence it may also periodically send the
consumption information. Sending this information periodically is needed for the
cases when sudden power failures occur.

7.4.5 Pilferage Control of Electronic Consumptions

Associated with consumption metering, as discussed in the preceding paragraph,


is a serious issue of pilferage especially in the current context of Bangladesh. It is
a matter of deep regret that in many cases the electric meter, whether it is analog
57

or digital, can be and is bypassed and thus the actual electric consumption is not
recorded. In our study we have found report that in case of digital meters a small
chip with receiver and transmitter can be placed inside the meter and the meter
can be controlled remotely. As a result the meter can be shown to be working
whenever inspectors are there for checking with the help of a remote controller
and as soon as the checking is over it is switched off. It should also be added here
that the meter inspectors also sometimes can be bribed and thus the pilferage
continues. In our model, we can provide a very good pilferage control scheme. If
the meter is bypassed or switched off it is clear that the CAS would not be able to
retrieve any consumption record through the meter. However recall that each
electric appliance individually communicate with CAS and hence the electric
authority (DESA in our case), if it has an agreement with CAS off course, can
check the data from CAS to check whether there is any kind of pilferage going on
due to the bypassing of the meter. If there is no consumption from the meter, there
should not be any consumption by a refrigerator inside that apartment.

7.4.6 Problems and Suggestions

The idea of pilferage control of electric metering suggests a problem in our


model. The electric appliances like light bulbs or electric fans cannot be assumed
to be equipped with the kind of chips we are suggesting to be installed in each
electric appliance in our proposed model. The economic concerns would not
allow us to do that. So in case of pilferage control this would be a serious issue.
Note carefully that this problem doesn‟t have any effect in other features that our
model offers. A suggestion in this regard is to consider integrated switch boxes as
electric appliances. However, the mischievous idea of bypassing a switch box
would still be an issue to resolve.
58

7.5 Courier Service for Sending the Bills

Courier service is a popular private media to send letters to the receiver in due
time. In the existing system each bill is sent to the consumers by the meter reader
and the meter readers sometimes do not send it to the consumers‟ place within the
due date of bill payment. This is not a good example of customer service for a
utility company. DESA should immediately start sending bills through the courier
service. T & T is sending their bills through courier service. The cost of courier
must be less than the regular rate, as bills of a particular area will be sent at a
time. DESA can use special type of envelopes with one small opening for
displaying the address. Sending the bill without any envelope is also feasible as it
is being done in the existing system. Some of the addresses are still invalid in the
DESA Computer Center database. It can be corrected easily as the bills cannot be
delivered will be returned after sending the bill of the first month. This process of
sending the bills can be started in phases. It can be started with one S & D and
then moving on with more S & Ds after all the addresses of the first one is
corrected properly.

7.6 Introducing World Wide Web for Automation

Websites are being used for bill payment by the subscribers and bill sending to the
subscribers in the developed countries. The main benefit of this technology is that
the subscribers do not need to move from their homes to the banks or S & D
offices and they can save their valuable time. This would be an excellent solution
for the working couples in Dhaka city. For any web based automation the
following environment must be set up:

 There must be a web server. This should be powerful enough to support


the load of the web users in the system.
59

 The software to be developed must communicate with the database server.


Web server and database server can be the same machine.

 There must be high-speed connection to the Internet. It will be possible


when there will be a high-speed Internet infrastructure in the country. This
is expected to be done in Dhaka city soon.

Following services can be automated by using World Wide Web:

1. Self Reading Through Website

2. Bill Printing Through Website


3. Website for Pilferage Control
4. Website for Customer Service
5. Power calculation in the website
6. Notification through E-mails

7.7 Automation of Bill Payment and Money Collection

Now a subscriber has to go to the bank and wait in a queue to pay the bill. It is not
a very pleasant job for a subscriber. Introduction of automation techniques can
make this process of payment easier. We will discuss several techniques in the
following subsections:

7.7.1 Prepaid Payment

A subscriber might be interested to pay in advance so that he does not need to


waste his or her time in the bank queue. So there should be a provision to pay
more than the bill amount in the bill. This prepaid payment might be very
lucrative to the management level for raising funds for developing power plants to
60

support the extra load for the future. DESA can offer different lucrative packages
(such as lower rate) for advance payment to the subscribers. In this scheme the
subscriber does not need to pay until the corresponding balance becomes
negative.

7.7.2 Bill Payment through ATM Card

ATM provides 24 hours banking service to the customers. The customers can go
to the bank any time and do limited banking such as drawing money up to certain
limit, transferring money to another accounts and automatic bill payment. If a
bank supports ATM cards to their customers then DESA can easily interface their
database with the bank database to provide on line bill payment through smart
ATM cards.

7.7.3 Bill Payment through the Internet Account

Using ATM cards the subscribers can go to the ATM machine any time and pay
the bill. Use of website can make this process easier and faster. A subscriber can
login to his or her bank account from his home through the Internet. There must
be some provision to pay any kind of bill from the subscriber‟s account. The
subscriber will provide the bill number and the amount to be paid and finally the
amount will be deducted from the account. The bank will send the bill numbers
and amount to be paid at the end of day to the corresponding utility organization.
This technique utilizes the full power of Information and Communication
Technology. The website developed for this application must have the sufficient
security features and these features are now available in the software development
platforms.
61

7.7.4 Bill Payment through Credit Card

This method also uses the Internet technology. The Computer Center of the DESA
will develop a website of the subscribers to see the bills of a particular month. When
a particular bill is shown in the screen there will be some more facilities to pay the
bill right away. The subscriber will give the credit card number and necessary
security information on the credit card to pay the amount. The DESA office will
store the credit card numbers and print the payment information along with credit
card numbers to the accounts department of the DESA. When all these bills will be
collected from the Credit Card Companies the payment will be posted in the
Computer Center database. All these processing does not require any manual entry in
the computer center. Thus the total process will be faster with much more satisfied
subscribers. This method is not feasible until necessary laws regarding Credit Cards
are not made by the Government of Bangladesh.

7.8 Concluding Remarks

This report presents possible ways to automate the bill collection system to enhance
the consumer satisfaction. It may be noted here that automation of bill collection is a
prime need for every utility company to speed up the revenue collection procedure.
The estimated cost for automation is negligible compared to the anticipated increase
in revenue collection resulting from automation in addition to customer satisfaction.
The setup for automation can be easily shared by any other utility companies. Thus
the cost for these services can be distributed among all the utility companies such as
Gas, Water, T & T, mobile and Internet service providers. The top management of
all these utility companies should take initiatives immediately to adopt this
technology both for improved revenue collection and customer satisfaction

.
62

Application of Information Technology in data entry helps us provide service in the


shortest possible time where lots of data are processed daily. Manual data entry by the
tellers in the banks is not really acceptable in a any busy city as it wastes lot of time of
the consumers. That is why the Utility Service Providers should start automation not only
in bill collection but also in meter reading. Automated meter reading should be given
priority as it will reduce the pilferage done by the meter readers and detect the dishonest
consumers. The developed countries in the world are also using the concept of automated
meter reading. So the Service Providers should start thinking to utilize the technology
right away. The phases mentioned in the last section provides the guideline to implement
the automated system in the quickest possible time.

Since IT is penetrating into every walks of life, to be competitive with other service
organizations, all the Service Providers should take the initiative immediately and embark
upon this project to harvest the benefits of IT through improved customer service and
faster revenue collection.
63

Appendix

1. Java Code for reading and parsing data from Bar Code
scanner using the javax.comm package

import javax.swing.*;
import java.io.*;
import java.awt.event.*;
import java.awt.*;
import java.sql.*;
import javax.comm.*;
import java.util.*;

public class ReadBarCode implements SerialPortEventListener {

private ScrollingPanel fields;


private JTextArea output;
private Connection connection;
static Enumeration portList;
InputStream inputStream;
Thread readThread;
SerialPort serialPort;
static CommPortIdentifier portId;

public ReadBarCode(Connection c ,ScrollingPanel f, JTextArea o){


connection=c;
64

fields=f;
output=o;
try{
portId=CommPortIdentifier.getPortIdentifier( "COM1") ;
}catch(NoSuchPortException nspe){
JOptionPane.showMessageDialog(null,"Port COM1 is not active",
"ERROR" , JOptionPane.ERROR_MESSAGE);
}

try{
serialPort = (SerialPort) portId.open("Bill Collector", 2000);
}catch (PortInUseException e){
JOptionPane.showMessageDialog(null,portId.getName()+" is in use " ,
"ERROR" , JOptionPane.ERROR_MESSAGE);
}
try{
serialPort.setSerialPortParams(9600,
SerialPort.DATABITS_8,
SerialPort.STOPBITS_1,
SerialPort.PARITY_NONE);
} catch (UnsupportedCommOperationException e){
JOptionPane.showMessageDialog(null,"Error in setting
SerialPortParams","ERROR",JOptionPane.ERROR_MESSAGE);
}

try{
serialPort.notifyOnOutputEmpty(true);
}catch (Exception e){
JOptionPane.showMessageDialog(null,"Error setting event
notification","ERROR",JOptionPane.ERROR_MESSAGE);
}
65

try{
inputStream = serialPort.getInputStream();
} catch (IOException e){
JOptionPane.showMessageDialog(null,"Error in getting input
stream","ERROR",JOptionPane.ERROR_MESSAGE);
}
try{
serialPort.addEventListener(this);
} catch (TooManyListenersException e){
JOptionPane.showMessageDialog(null,"Listener is already
set","ERROR",JOptionPane.ERROR_MESSAGE);
}

serialPort.notifyOnDataAvailable(true);
}

public void serialEvent(SerialPortEvent event){


switch (event.getEventType())
{
case SerialPortEvent.BI:
case SerialPortEvent.OE:
case SerialPortEvent.FE:
case SerialPortEvent.PE:
case SerialPortEvent.CD:
case SerialPortEvent.CTS:
case SerialPortEvent.DSR:
case SerialPortEvent.RI:
case SerialPortEvent.OUTPUT_BUFFER_EMPTY:
break;
66

case SerialPortEvent.DATA_AVAILABLE:

byte[] readBuffer = new byte[256];


try{
while (inputStream.available() > 0) {
int numBytes = inputStream.read(readBuffer);
}

}catch (IOException e){


JOptionPane.showMessageDialog(null,"Error
reading BAR
code","ERROR",JOptionPane.ERROR_MESSAGE
);
}

String s;
s="";
for (int i=0;i<8;i++){
if(readBuffer[i]=='0')
continue;
s+=(char)readBuffer[i];
}
fields.ownerID.setText(s);
s="";
for (int i=8;i<16;i++){
if(readBuffer[i]=='0')
continue;
s+=(char)readBuffer[i];
67

}
fields.billNo.setText(s);
s="";
for (int i=16;i<24;i++){
s+=(char)readBuffer[i];
}
String s1="";
String s2;
s1.concat( s.substring(0,1) );
s1.concat( "-" );
s2="";
s2.concat(s.substring(2,3));

if(s2.equals("01"))
s1.concat("Jan-");
else if(s2.equals("02"))
s1.concat("Feb-");
else if(s2.equals("03"))
s1.concat("Mar-");
else if(s2.equals("04"))
s1.concat("Apr-");

else if(s2.equals("05"))
s1.concat("May-");
else if(s2.equals("06"))
s1.concat("Jun-");
else if(s2.equals("07"))
s1.concat("Jul-");
else if(s2.equals("08"))
s1.concat("Aug-");
68

else if(s2.equals("09"))
s1.concat("Sep-");
else if(s2.equals("10"))
s1.concat("Oct-");
else if(s2.equals("11"))
s1.concat("Nov-");
else if(s2.equals("12"))
s1.concat("Dec-");

s2.concat(s.substring(4,7));
fields.date.setText(s2);
s="";
for (int i=24;i<32;i++){
if(readBuffer[i]=='0')
continue;
s+=(char)readBuffer[i];
}
fields.amount.setText(s);

break;
}
}
}
69

2. Java Code for Sending billing information

import javax.swing.*;
import java.io.*;
import java.awt.event.*;
import java.awt.*;
import java.sql.*;
import java.beans.XMLEncoder;
import java.net.*;

public class Sender implements ActionListener{

private Connection connection;


private JTable table;
private String serverIPAddress="192.168.20.132";
private int serverPort=3000;
private Socket clientSocket;
private JTextArea output;
private OutputStreamWriter outputStreamWriter;
private PrintWriter fout;
private String xmlFileName;
private BufferedReader bufferedReader;
private PrintWriter printWriter ;

public Sender(Connection c, JTable t,JTextArea o){


connection = c;
table = t;
output=o;
}
70

public void actionPerformed(ActionEvent ae){

xmlFileName = "bills.xml";
try{
fout= new PrintWriter ( new FileWriter (xmlFileName) );
fout.println("<?xml version=\"1.0\"?>");
fout.println("<bills>");

for(int row=0 ; row < table.getRowCount() ; row++){


fout.println("\t<bill>");
for (int col=0 ; col < table.getColumnCount() ; col++){
fout.print("\t\t<"+table.getColumnName(col)+">");
fout.print(table.getValueAt(row,col));
fout.println("</"+table.getColumnName(col)+">");
}
fout.println("\t</bill>");
}
fout.println("</bills>");
output.append("\n\nXML file is written successfully ") ;
fout.close();
}catch(Exception d){
JOptionPane.showMessageDialog(null,"exception in XML \n"+d);
}

try{
clientSocket = new Socket (
InetAddress.getByName(serverIPAddress) , 7000 );
output.append("\n\nConnected to :
"+clientSocket.getInetAddress().getHostName());
71

OutputStream osBuffered=new BufferedOutputStream (


clientSocket.getOutputStream() ) ;
printWriter = new PrintWriter (osBuffered);

try{
FileReader fileReader = new FileReader (xmlFileName) ;
bufferedReader = new BufferedReader (fileReader);
int data;
int available;
String s;
try{
while( ( s=bufferedReader.readLine() ) != null ){
output.append("\nwrote to port : "+ s);
printWriter.println( s);
printWriter.flush();
}
printWriter.println( "");
printWriter.close();
JOptionPane.showMessageDialog(null,"XML FILE
SUCCESSFULLY SENT TO SERVER","FILE
SENT",JOptionPane.INFORMATION_MESSAGE);

}catch(IOException ioe){
JOptionPane.showMessageDialog(null,"Exception
in reading XML File or writing to socket "+ioe);
}
}catch(FileNotFoundException fnfe){
JOptionPane.showMessageDialog(null,"XML File
to send Not found"+fnfe);
}catch ( SecurityException se ) {
72

JOptionPane.showMessageDialog(null,"access to the XML


File to send is denied "+se);
}

}catch(UnknownHostException uhe){
JOptionPane.showMessageDialog(null,"THE SPECIFIED
SERVER NOT FOUND "+uhe);
}catch(IOException ioe){
JOptionPane.showMessageDialog(null,"IO EXCEPTION
OCCURED WHEN CREATING SOCKET "+ioe);
}catch(SecurityException se){
JOptionPane.showMessageDialog(null,"SECURITY
EXCEPTION OCCURED WHEN CREATING SOCKET "+se);
}

3. Java Code for Receiving Billing Information:

import java.io.*;
import javax.swing.*;
import java.net.*;
public class Server{

private ServerSocket serverSocket ;


private Socket socket ;
73

private JTextArea output;


private BufferedReader bufferedReader ;
private PrintWriter printWriter;
private UpdateRecord updateRecord;

public Server (JTextArea o,UpdateRecord ur){


output=o;
updateRecord=ur;
try{
serverSocket = new ServerSocket (7000);

output.append("\nServer is wating for connection");

socket = serverSocket.accept();
output.append("\nConnection received from
"+socket.getInetAddress().getHostName());

bufferedReader=new BufferedReader(new
InputStreamReader(socket.getInputStream()));

printWriter= new PrintWriter ( new FileWriter ("bills.xml") );

String s;
int i;
try{
while ( (s=bufferedReader.readLine()) != null){
printWriter.println(s);
}
}catch(IOException ioe){
74

JOptionPane.showMessageDialog(null,"Can't read from


socket or can't write network data to file"
,"ERROR",JOptionPane.ERROR_MESSAGE);
}
bufferedReader.close();
printWriter.close();
output.append("data came from bank has been written to XML
file");
JOptionPane.showMessageDialog(null,"data came from bank has
been written to XML
file","SUCCESS",JOptionPane.INFORMATION_MESSAGE);

}catch(SecurityException se ){
JOptionPane.showMessageDialog(null," Server Socket Security
Exception\n"+se ,"ERROR",JOptionPane.ERROR_MESSAGE);
}catch(UnsupportedEncodingException usee){
JOptionPane.showMessageDialog(null,"
UnsupportedEncodingException occured in creating
InputStreamReader for socket reading\n"+usee
,"ERROR",JOptionPane.ERROR_MESSAGE);

}catch( IOException ioe ){


JOptionPane.showMessageDialog(null," Server Socket cant be
created or Exception in getInputSteam() of Socket or XML file
can't be created\n"+ioe
,"ERROR",JOptionPane.ERROR_MESSAGE);
}
updateRecord.insertRecordOfXMLFile(output);
}
}
75

Reference

[1] M Kaykobad, Rezwan Al Bakhtiar, Khondoker Asif Hasan ,Md. Mostofa


Akbar, Md. Sohel Rahman. Suggestion on Billing and Bill
collection.Creation Date-Sep 16,2003.

[2] Andrew S. Tanenbaum. Computer Networks, Fourth Edition.

[3] H. M. Deitel, P. J. Deitel. JAVATM How to Program, Third Edition.

[4] Patrick Naughton, Herbert Schildt. JavaTM 2: The Complete Reference,


Third Edition

[5] Barry M. Cook, Neil H. White. Computer Peripherals, Third Edition,


Page no.-217.

[6] Bar Code Scanner Java API website


www.sun.java.com/products

[7] Microsoft Window XP Online Help.

[8] Microsoft Certified System Engineer (MCSE) Guide.

View publication stats

Você também pode gostar