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

Eastern College Of Engineering

[Affiliated to Purbanchal University]

Biratnagar-2, Morang Nepal

A
Project On
“Electricity Billing System”

Submitted By Submitted To:


Bachelor of Computer Engineering Department of Computer
3 semester , 2019
rd
Eastern College of Engineering
Group-A
Niraj Rajbanshi (330111)

Amit Rouniyar (330102)

Satrudhan Chauhan (330118)

Manisha Paswan (330110)


EASTERN COLLEGE OF ENGINEERING
[Affiliated To Purbanchal University]
Biratnagar-2, Morang

BONAFIDE CERTIFICATE

Certified that this project report titled “Electricity Billing System” is the bonafide
work of Amit Rouniyar , Niraj Rajbanshi, Satrudhan Chauhan, Manisha
Paswan who carried out the project work under my supervision.

…………………………………..
………………………………
Er. Janardan pd. Mehta
Er. Hemant Goit
HOD(Computer)
Supervisor
Date:- ………………………….
Date:- ………………………….

Sign:- …………………………………..
Name:- ……………………………..
External Examiner
Date:- …………………………………
Acknowledgement

Before we get into the thick of the things we would like to add a few heartfelt words
for the people who were part of this project in numerous ways. People who gave
unending support right from the stage the project idea were conceived.

We would like to express my sincere gratitude to our supervisor Er. Hemant Goit
for providing their guidance , suggestion and comments throughout the course of the
project. I would specially thank Er. Hemant Goit for constantly motivating me to
work harder.

At last but not the least, we would like to express our cordial gratitude to all our
friends , well-wisher for their supports , suggestion and co-operation as well as all
those persons who had helped directly or indirectly to complete this project.

Thanks
Abstract

The system “Electricity Billing System” is based on computerization system which


ease the billing system of the Electricity billing authority. To developing this project
Front-end tool as Turbo C++ compiler and Back-end tool as the coding in “C
programming language”. This software provide every customer as their id number
which help to manage their information. It will store all the information of the
customer such as customer id number , customer name, customer address, previous
month reading unit and amount to be paid or excess amount in previous month. It will
calculate the amount as per the rule of NEA (Nepal Electricity Authority). It will
calculate amount just providing current month unit. It will also accept less or excess
amount than payable amount . And this excess or less amount will be store and added
in next month bill. It has feather such as add record, list record, payment, search,
Modify, and display rates.
TABLE OF CONTENT

Page No.

1) Introduction …………………………………………..…………… 1

1.1 Project description ………………………………..…………… 1

1.2 Features …………………………………………..……………. 2

1.3 Objective ………………………………………..……………… 2

1.4 Technology used …………………………………..…………… 3

2) Algorithm …………………………………………..…................... 4

3) Flowchart………………………………………………..…………. 5

4) Amount calculation ……………………………………..…………. 6

5) Limitation ………………………………………………..……….... 7

6) Source Code ……………………………………………...………… 8

7) Output ………………………………………..…………………… 18

8) Conclusion ……………………………………..………………….. 19

9) Reference…. ……………………………………….……………… 20
Introduction

1.1 Project Description

Our project “Electricity Billing System” aims to display consumed units and
payable amounts. The aim of our project is to develop a system that computerized the
paper work performed in the electricity authority office.

It will calculate the monthly electricity bills and support payment. It stores consumed
unit(reading) of energy and also stores unpaid or excess amount. It also stores
customers personal information such as customer id number, name and their address.

It supports features such as list all records, search customer details, modifying
customer details, and display rate of units

1
1.2 Objective

 Add and maintain records of energy used by customers.


 Provides a convenient solution of billing pattern.
 Add and maintain customers details.
 Provide description of rates of units.

1.3Features

 Adding new records


 Modifying
 Searching
 Manage the customer details
 Integration of customer records
 User authentication
 Display rate of units

2
1.4 Technology Used

The tools that are used to develop the “Electricity Billing System” are include as:

a. C programming language
b. Turbo C++ (compiling)

C programming language

C is a procedural programming language. It was initially developed by Dennis


Ritchie between 1969 and 1973. It was mainly developed as a system programming
language to write operating system. The main features of C language include low-
level access to memory, simple set of keywords, and clean style, these features make
C language suitable for system programming like operating system or compiler
development. Many later languages have borrowed syntax/features directly or
indirectly from C language. Like syntax of Java, PHP, JavaScript and many other
languages is mainly based on C language. C++ is nearly a superset of C language
(There are few programs that may compile in C, but not in C++).

3
Algorithm
Step 1: Start
Step 2:Login account only for authentication
Step 3:Select option from given menu(Switch case statement)
Code=selected option
Step 4:if code=A, add record and goto step 3.
Step 5:Else if code=M, Modify record and go to step 3.
Step 6:Else if code=L, list record and go to step 3.
Step 7:Else if code=P, payment and go to step 3.
Step 8:Else if code=S, searching and go to step 3
Step 9:Else if code=D, display rates, and go to step 3.
Step 10:Else if code=E, go to step12
Step 11:Else , show ”Input incorrect”
Step 12:Stop

4
Flowchart

Start

User login

no
Evaluate code

no yes
Add Record
Code=A

no yes
List record
Code=L

no

yes
Payment
Code=P
no

no

yes Search Record


Code=S

no

yes
Modify
Code=M
no

yes Display rates


Code=D

Yes no no
Code=E Display ”Input incorrect”
Stop

Fig:FlowChart

5
Amount Calculation

Example: 63 units

0-20 units : 20 * 3.00

= Rs 60

21-30 units : 10 * 7.00

= Rs 70

31-50 units: 20 * 8.50

= 170

51-63 units: 13 * 10.00

=130

Total Amount : 60 + 70 + 170 + 130

= Rs 430

6
Limitation

 It does not store date of payment so can not add fine or interest features

It does not store every financial transaction

7
Source Code
#include <stdio.h>
#include <conio.h>
#include <graphics.h>
#include<stdlib.h>
#include<dos.h>

struct subscriber {
int idno;
char name[16];
char address[16];
int pre_unit;
float pre_amount;
}s;

void welcome();
void auth();
int sysm();
void addrecords();
void listrecords();
void modifyrecords();
void display();
void searchrecords();
void payment();

void main(){
clrscr();
welcome();
auth();
}

void welcome(){
int i = 20, j=20;
int gd=DETECT, gm;
initgraph(&gd, &gm, "c:\\turboc3\\bgi");

setcolor(RED);
setbkcolor(CYAN);
rectangle(17,17,630,464);
rectangle(30,30,615,450);
while (i< 620) {
outtextxy(i, 20, "*");
i=i+5;
outtextxy(i, 455, "*");
i=i+5;

}
while (j< 455) {
outtextxy(20, j, "*");
j=j+5;
outtextxy(620, j, "*");
j=j+5;
}

setcolor(BLUE);

8
settextstyle(3, 0, 2);
outtextxy(300, 80, "A");
outtextxy(250, 105, "Project On");
settextstyle(1, 0, 3);
setcolor(RED);
outtextxy(160, 130, "\"Electricity Billing Stystem\"") ;

setcolor(MAGENTA);
settextstyle(3, 0, 2);
outtextxy(175, 220,"Developed by");
outtextxy(175, 245, "1.Niraj Rajbanshi (330111)");
outtextxy(175, 270, "2.Amit Rouniyaar (330102)");
outtextxy(175, 295, "3.Satrudhan Chauhan (330118)");
outtextxy(175, 320, "4.Manisha Paswan (330110)");

setcolor(RED);
settextstyle(3, 0, 1);
outtextxy(200, 400, "Press \"ENTER\" to continue!!!");

while(1) {
char ch;
ch = getch();
if(ch == '\n'|| ch=='\r'){
break;
}
}
closegraph();
}

void auth(){
int i,cnt=3;
char ch,username[8],password[8];
clrscr();

while(cnt != 0) {
if (cnt != 3) {
clrscr();
printf("\n\nIncorrect username/password combination.");
printf("\nTry more %d times.", cnt);
}

printf("\n\n\n\nEnter User name: ");


gets(username);

printf("\nEnter your password: ");


for(i=0;i<3;i++) {
ch = getch();
password[i] = ch;
ch = '*';
printf("%c", ch);
}
password[i] = '\0';
delay(100);

if((strcmp(username,"abc")==0) && (strcmp(password,"123")==0)) {

9
clrscr();
printf("\n\n\n\n\n\t\t\tLog in Successful !!!");
delay(900);
sysm();
break;
}
else {
cnt--;
}

}
}

int sysm() {
char choice;
clrscr();

while (1) {
clrscr();
printf("\n\n\n\t\t\t\t ENTER");
printf("\n\n\t\t\t A : for adding new records.");
printf("\n\n\t\t\t L : for list of records.");
printf("\n\n\t\t\t P : for payment.");
printf("\n\n\t\t\t S : for searching records.");
printf("\n\n\t\t\t M : for modifying records.");
printf("\n\n\t\t\t D : for display rates.");
printf("\n\n\t\t\t E : for exit.\n");

choice=getche();
choice=toupper(choice);

switch(choice) {
case 'P':
payment();
break;

case 'A':
addrecords();
break;

case 'L':
listrecords();
break;

case 'M':
modifyrecords();
break;

case 'S':
searchrecords();
break;

case 'D':
display();
break;

10
case 'E':
clrscr();
printf("\n\n\n\n");
printf("\t\t\t\tTHANK YOU");
printf("\n\t\t\tFOR USING OUR SERVICE");
delay(800);
exit(0);
break;

default:
clrscr();
printf("Incorrect Input");
printf("\nAny key to continue");
getche();
}

void addrecords() {
int a=100, id_no;
FILE *f, *fb, *fa;
char test;

fb = fopen("c:\\file\\id.txt", "r+");

if(fb == NULL) {
fa = fopen("c:\\file\\id.txt", "w+");
fprintf(fa,"%d",a);
fclose(fa);

fb = fopen("c:\\file\\id.txt", "r+");
}

f=fopen("c:\\file\\file.bin","ab+");

if(f==0) {
f=fopen("c:\\file\\file.bin","wb+");
clrscr();

printf("\n\nplease wait while we configure your computer");


printf("/npress any key to continue");
getch();
}

while(1) {
clrscr();
fscanf(fb,"%d",&id_no);
printf("\n\n\t\t\tAdding Customer");
printf("\n Your Id no.: %d", id_no);
printf("\n Enter name:");
fflush(stdin);
scanf("%[^\n]",&s.name);

11
printf("\n Enter address:");
fflush(stdin);
scanf("%[^\n]",&s.address);
s.idno = id_no;
s.pre_unit = 0;
s.pre_amount = 0.0;
fwrite(&s,sizeof(s),1,f);
fflush(stdin);
clrscr();

printf("\n\n1 record successfully added");


printf("\n Press esc key to exit, any other key to add other record:");

fclose(fb);
fb=fopen("c:\\file\\id.txt", "w");
id_no = id_no + 1;
fprintf(fb, "%d", id_no);
fclose(fb);

test=getche();

if(test==27)
break;
}

fclose(f);

void listrecords() {
FILE *f;
int i, n=0;
clrscr();
if((f=fopen("c:\\file\\file.bin","rb"))==NULL) {
printf("\n\n\t\tNo Record Found!!!");
n++;
}

if(n==0) {
printf("\n\n");
printf("Id no.\tUser Name\t\tAddress\t\tPre. Reading\tPre Amount(Rs.)\n");
for(i=0;i<79;i++)
printf("-");

while(fread(&s,sizeof(s),1,f)==1) {
printf("\n%d\t%-15s\t\t%-15s\t%-6d\t\t%.2f",s.idno,s.name,s.address,s.pre_unit,s.pre_amount);
}

printf("\n");

for(i=0;i<79;i++)
printf("-");
}

12
fclose(f);
getche();
}

void display() {
clrscr();
printf("\n\n\n");
printf("\n\n\t\tUnit And Their Rates(5 Ampere)");
printf("\n\n\n");
printf("\t\tUnits\t\t\tRates");
printf("\n");
printf("\t\t0-20\t\t\tRs. 3.00 /-");
printf("\n");
printf("\t\t21-30\t\t\tRs. 7.00 /-");
printf("\n");
printf("\t\t31-50\t\t\tRs. 8.50 /-");
printf("\n");
printf("\t\t51-150\t\t\tRs. 10.00 /-");
printf("\n");
printf("\t\t151-250\t\t\tRs. 11.00 /-");
printf("\n");
printf("\t\t151-400\t\t\tRs. 12.00 /-");
printf("\n");
printf("\t\tAbove 400\t\tRs. 13.00 /-\n");
getche();
}

void searchrecords() {
FILE *f;
int idno;
int flag=1;
f=fopen("c:\\file\\file.bin","rb+");

if(f==0)
exit(0);

fflush(stdin);
clrscr();

printf("\n\nEnter Id no. to search in our database");


scanf("%d", &idno);

while(fread(&s,sizeof(s),1,f)==1) {
if(s.idno==idno) {
clrscr();
printf("\n\n\tRecord Found ");
printf("\n\nId no.: %d\nName: %s\nAddress: %s\nprevious unit: %d\nPrevious Amount:
Rs.%0.2f\n",s.idno,s.name,s.address,s.pre_unit,s.pre_amount);
flag=0;
break;
}

else if(flag==1) {
clrscr();
printf("\n\nRequested Id no. Not found in our database");

13
}

}
getche();
fclose(f);
}

void modifyrecords() {
FILE *f;
int idno,i;
long int size=sizeof(s);
char name[16],address[16];

if((f=fopen("c:\\file\\file.bin","rb+"))==NULL)
exit(0);

clrscr();

printf("\n\nEnter Id no. of the subscriber to modify:");


fflush(stdin);
scanf("%d", &idno);

while(fread(&s,sizeof(s),1,f)==1) {
if(s.idno==idno) {
clrscr();
printf("\n\nPrevious Detail:-\n");
printf("\n\nId no.: %d\nName: %s\nAddress: %s\nprevious unit: %d\nPrevious Amount:
Rs.%0.2f\n\n",s.idno,s.name,s.address,s.pre_unit,s.pre_amount);
printf("Note: If Name and Address are correct, Just press \"Enter\"\n");
for(i=0;i<79;i++)
printf("-");

printf("\n Enter Name:");


fflush(stdin);
scanf("%[^\n]",&name);

if(strcmp(name,"")==0) {}
else {strcpy(s.name,name);}

printf("\n Enter Address: ");


fflush(stdin);
scanf("%[^\n]",&address);

if(strcmp(address,"")==0) {}
else {strcpy(s.address,address);}

printf("\n Enter previous unit: ");


scanf("%d",&s.pre_unit);
fflush(stdin);
printf("\n Enter previous amount: ");
scanf("%f",&s.pre_amount);
fseek(f,-size,SEEK_CUR);
fwrite(&s,sizeof(s),1,f);
break;
}

14
}

fclose(f);

void payment() {
FILE *f;
int idno;
long int size = sizeof(s);
float amt, money, pay_amt;
int i, cnt_unit, unit,t_unit;
char n;

if((f=fopen("c:\\file\\file.bin","rb+"))==NULL)
exit(0);

clrscr();

printf("\n\nEnter Id no. of the subscriber for payment");


fflush(stdin);
scanf("%d", &idno);

while(fread(&s,sizeof(s),1,f)==1) {
if(s.idno==idno) {
clrscr();
printf("\n");
for(i=0;i<79;i++)
printf("-");
printf("\n\tId no..: %d",s.idno);
printf("\n\tName: %s",s.name);
printf("\n\tAddress: %s",s.address);

printf("\n\n\tPrevious reading: %d",s.pre_unit);


printf("\n\tEnter your current reading: ");
fflush(stdin);
scanf("%d", &cnt_unit);

if(cnt_unit > s.pre_unit) {


unit = cnt_unit - s.pre_unit;
t_unit = unit;
if(unit < 21) {
amt = unit * 3.0;

else if(unit < 31) {


unit = unit - 20;
amt = 60 + unit * 7.0;

else if(unit < 51) {


unit = unit - 30;

15
amt = 130 + unit * 8.5;

else if(unit < 151) {


unit = unit - 50;
amt = 300 + unit * 10.0;

else if(unit < 251) {


unit = unit - 150;
amt = 1300 + unit * 11.0;

}
else if(unit < 401) {
unit = unit - 250;
amt = 2400 + unit * 12.0;

}
else{
unit = unit - 400;
amt = 4200 + unit * 13.0;
}

money = amt + s.pre_amount;

printf("\tCurrent Month Consumed unit: %d", t_unit);

printf("\n\n\tPrevious month amount: %f",s.pre_amount);


printf("\n\tCurrent Month Amount: %f",amt);
printf("\n\tNet payable amount: %f", money);

printf("\n\n\tEnter amount of payment :");


fflush(stdin);
scanf(" %f",&pay_amt);

s.pre_amount = money - pay_amt;


printf("\tAmount Remain : %f\n", s.pre_amount);

for(i=0;i<79;i++)
printf("-");
printf("\n");

s.pre_unit = cnt_unit;
printf("\nConform payment(y/n): ? ");
n = getche();
n = toupper(n);
}
else {
printf("\n\nYour current Reading is less then previous month reading. Recheck it.");
n = 'a';
}

if(n=='Y') {

16
fseek(f,-size,SEEK_CUR);
fwrite(&s,sizeof(s),1,f);

clrscr();
printf("\n\nTHANK YOU %s FOR YOUR TIMELY PAYMENTS",s.name);

}
else if( n == 'N') {
clrscr();
printf("\n\n\tTransaction not saved!!!");
}
else {
clrscr();
printf("\n\n\tInvalid Input!!!\n\tTransaction not saved");
}

break;
}

getch();
fclose(f);

17
Output

Fig: Main Menu page

Fig: List of Customer with details

18
Conclusion

In conclusion , this project is aim to develop a project entitled “Electricity billing


system” that maintain data such as adding record, searching customer detail,
calculation and payment, modification etc.

At last we would like to thankful the Er. Hemant Goit and we are also thanks to all
person involved in directly or indirectly helping to develop the project.

19
Reference
1. Kernighan & Ritchie, " The C Programming Language ANSI C Version" Prentice
Hall Software Series.

2. N. Kantaris., "Learning to Program in C", Babani.

3.https://www.programiz.com/c-programming

20

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