0% found this document useful (0 votes)
13 views13 pages

Data For All - Word

The document outlines the design and implementation of an Electricity Bill Management System, aimed at improving the efficiency of managing customer information, tracking electricity consumption, and generating bills. It details the database schema, including entities such as Customers, Billing Rates, Electricity Usage, and Bills, along with their relationships and SQL queries for data management. Additionally, the system incorporates features like payment processing, customer notifications, and reporting on electricity usage patterns.

Uploaded by

mulukengashaw21
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
13 views13 pages

Data For All - Word

The document outlines the design and implementation of an Electricity Bill Management System, aimed at improving the efficiency of managing customer information, tracking electricity consumption, and generating bills. It details the database schema, including entities such as Customers, Billing Rates, Electricity Usage, and Bills, along with their relationships and SQL queries for data management. Additionally, the system incorporates features like payment processing, customer notifications, and reporting on electricity usage patterns.

Uploaded by

mulukengashaw21
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 13
MEKDELA AMBA university COLLAGE OF COMPUTING AND INFORMATIC DEPRTMENT OF COMPUTER SCIENCE ‘STUDENT PROJECT FOR DATABASE ASSIGNMENT Fest Name ast_Name: 1D Daniel Zigabe 1600575 Manaye Baile 3600805. ‘vik Demeve 1601342 Tun Wonde Teo1206 aby Eshetle 1600056 DTTP Be Bi Bi Bie Bie Bi Bi Bi BP : f f t f f Type text} introduction ‘The Electricity Bill Management System is a software solution designed to streamline the process of managing customer information, tracking electricity consumption, generating bills, and ‘monitoring payment histories. This system aims to reduce manual errors and improve efficiency managing billing processes for electricity providers. By leveraging relational databases, this project provides a robust framework to organize customer data, billing rates, electricity usage records, and payment histories. The system also inciudes advanced functionalities such as generating reports on ‘electricity usage patterns and integrating with online Entity A Entity B Relationship Name Type Customers Electricity Usage Records Usage One-to-Many Electricity Usage Billing Rates Billed By Tier Many-to-One Customers Bills Generates Bills One-to-Many Bills Electricity Usage Calculated From One-to-One Billing Rates Bills Applies Rates indirect (via Usage) payment gateways for secure and efficient payment processing. Furthermore, it enables customer notifications for bill reminders and updates, enhancing communication and service quality. This document outlines the database schema, SOL queries, and the implementation of additional features to meet the project's requirements. To implement an Electricity Bill Management System, we begin by defining the entities, their relationships, and corresponding SQL queries to achieve the specified tasks. Entities and Relationships Peery > Attributes: account_number (PE), name, address "6° Relationship: Each customer can have multiple electricity usage records and bills. Pa tet > Attributes: rate_id (PK), rate tier, usage_range, cost_per_unit © Relationship: Billing rates determine the cast per unit of electricity for different usage tiers Per % Attributes: usage_id (PK), account_number (FK), month, meter_reading © Relationship: Links a customer's usage data with the billing rates to calculate bills. oes > Attributes: bill_id (PK), account_number (Fk), month, total_amount_due, payment_status © Relationship: Bills are generated for each usage period and are associated with customers. Entities and Their Relationships > Relationship: One-to-Many B “6 Name of Relationship: Records Usage © Description: Each customer (account_number) can have multiple electricity usage records, but each electricity usage record belongs to only one customer. ¥ Electricity Usage and Billing Rates Relationship: Many-to-One ‘ *e* Name of Relationship: Billed By Tier = © Description: Each electricity usage record corresponds to billing rate based an the usage range, and multiple usage records can belong to the same rate tier. ¥ Customers and Bills % Relationship: One-to-Many ‘Name of Relationship: Generates Bills © Description: Each customer (account_number) can have multiple bi ‘associated with only one customer. ¥ Bills and Electricity Usage Relationship: One-to-One (Per Month) Name of Relationship: Calculated From Description: Each billis calculated from electricity usage for a specific month fora particular customer. Relationship: Indirect (via Electricity Usage) S$ Name of Relationship: Applies Rates Description: Billing rates are applied to calculate the total amount for a bill, based on the associated electricity usage. Customers table: CREATE TABLE Customers ( AccountHunber INT PRIMARY - Unique identifier for ea Mame VARCHAR (100) , Nene of the customer Address VARCHAR (235) w= Address of the customers Select from Custemers MNSEAT WTO Custeaers (AccoustNumber, Name, Address) VALUES «1.003, Doe’, "123 Elm Street, Springfield’), «1002, Smith', '456 Oak Avenue, Shelbyville’), (2003, ‘Robert Brown", '789 Pine Lane, Centerville"); Constructed Table Output: AccountNumber Name Address 1001 John Doe 123 El Street, Springfield 1002 Jane Smith 456 Oak Avenue, Shelbyville 1003 Robert Brown 789 Pine Lane, Centerville Billing rates table: CREATE TABLE BillingRates { RateTier INT PRIMARY KEY, que identifier for the rate tier UsageRange VARCHAR (50) , Range of electricity usage for this CoatPerUnit DECIMAL(S, 2) Gost per unit of electricity in i Select from Billing rate TUSERT INTO BillingRates (RateTier, UsageRange, CostFertnit) VALUES (1, "2-200", 0.50), (Zz, "101-300", 0.75), 43, "301-500", 1.00), 44, "01S", 2.50)7 Constructed Table Output: RateTier UsageRange CostPerUnit 1 0-100 0.50 2 101-300 0.75 3 301-500 1.00 4 501+ 1.50 Dh cb CREATE TABLE ElectricityUsage ( AccountNunber THT, -- References the account number in the Customers table Month VARCHAR (20) , Month of the electricity usage MeterReading INT, Electricity consumption in units for the month FOREIGN KEY (AccountNusber) REFERENCES Customers (AccountNunber) -— Boreign key linking te Customers table ir isan tage MUSEAT TWTO ElectricityUsage (AccountNunber, Month, MeterReading) VALUES (1003, ‘December 2024", 250), John Doe's electricity usage (1002, ‘December 2024", 490), Jane Snith's electricity usage (2003, ‘December 2024", 150); —- Robezt Brown's electricity usage Constructed Table Output AccountNumber Month —_ MeterReading 1001 December 2024 250 1002 December 2024 400 AccountNumber Month —-MeterReading 1003 December 2024 150 CREATE TABLE Bills ( Bi11ID INT PRIMARY KEY AUTO_INCREMENT, AccountNunber THT, Moath VARCAAR(10}, ‘TotalAmountDue DECIMAL(10, 2), PaymentStatus VARCHAR (20), FOREIGN KEY (AccountNusber) REFERENCES Customers (AccountNumber} i Select "from Bills MNSEAT WTO Bills (AecountMunber, Month, TotalRmountDue, PaymantStatus) VALUES (101, ‘December', 75.25, 'Paid'), (102, ‘December, 105.50, *Pending'), (103, ‘Dacember', 45.00, "Pais", 01, 80.00, Paid"), «102, 120.75, "Pending'), (203, 50.00, ‘Paid'); ‘Structure and Sample Data in the i122 Table BIND AccountNumber Month TotalAmountDue PaymentStatus tol December 75.25 Paid 102 December 105.50 Pending 103 December 45.00 Paid 101 ‘November 80.00 Paid 102 November 120.75 Pending 103 November 50.00 Paid 2.To calculate the electricity bills based on usage ‘Example Calealation Query INSERT INTO Bul (ball 1, aecount_aumnher, manth, total amaunt_due, ppayment_statns) SELECT [NEXTVAL(bill sequence’, - Assuming 2 sequence for bill IDs saccount_oumber, ‘mont, SuMiCASE WHEN n.neter_reading BETWEEN CASTISPLIT_PART(bramage_range ASDECIMAL) AND CAST(SPLIT_PART(besage_range.”'.2) ASDECIMAL) ‘THEN umeter_reading *brcost peru ELsEO END) AS total_ amount ue, — FROM HictrictyUsage LOIN BilingRates br ON umcter reading BETWEEN CCASTISPLIT_PART\brasage range, 1) AS DECIMAL) AND CASTISPLIT PART(brassage_range '*,2}AS DECIMAL) GROUP BY waccount_sumber, month: 3. Track Payment History and Outstanding Balances ‘To retrieve a customer's payment history: SELECT -seeuunt_sumber, ‘month, bietal_amoant. duc, bpayment. status FROM Caslamers © {JOIN Bish ON caccoust number =Ihaccomal aursber \WIEERE eacceant_mumber = LZLS; — Replace with specific accomst_soraber “Te kde coreanrs with tasting balancer: SELECT acconat_ sober, SUM@iotal amount doe) AS custanding balance FROM Gastomers © TOIN Bike b ON eaceoamt_ number = haceont_namber WHERE payment states = "apa GROUP BY caccomnt_simber, cane; Pere Ce a Reo et em ere ett “Te generate report by ester segments seLect acconat_ sober, AVG(ameter reading) AS arz_usage. MAX(umeter reading) AS max usage, MiNumeter reading) AS min. usage FROM Castomers © JOIN Hiecteictyeage WON cacreant number = nacconst member GROUP BY caccount_number,c.mame; SPE rare ome) tee io 1 Payment Gateway Integration Ada table to track payment tramactions withthe gateway: (CREATE TABLE Payments( paymest_id INT PRIMARY KEY AUTO. INCREMENT, aia TNT, payment_date DATETIME, payment_method VARCHAR(SO), «eg. ‘Credit Card "PayPal trunsaction id VARCHARGSS), » Payment gateway transaction reference payment status VARCHAR(EO), ~ c.g "Surees' Failed! samount_paidl DECEMAL(N0, 2), FOREIGN KEY (bill fa) REFERENCES Btls) h 2. Natifeation Tracking Add tale to track the satus of notifications cea to-customees: CREATE TABLE Notifications ( notification id INT PRIMARY KEV AUTO INCREMENT, boll INT, sccount_mumber INT, otiffeation date DATETIME, otifieation_ method VARCHLARIS0),~- eg, "Email. SMS’ otifieation statis VARCHARSO), een "Fale FOREIGN KEY (bill fa) REFERENCES Billi i}, FOREIGN KEY (accouat_number) REFERENCES Customersaccount_number) » Ronnies ouncreit Record a Payment Transaction, “Tic query seconds a payment after swccessflfategraton with a payment gateway. INSERT INTO Payments (ill id, puyment date, payment_method, transaction id, payment stains, amaunt_paid) INSERT INTO Payments bill i payment date, payment_method, transaction i payment status, amount paid) ‘VALUES (102, NOW), PayPal, TKNS6TSIDEF, ‘Fale’ 200.00) 4. Send Hil Notenione |Add recor! nthe Notifications tale after xeing matic INSERT INTO Notifications (bid, account_sumber, notification date, notification. metod, notification st VALUES (101, 12445, NOWO, "Ema, Seats 5. Query Notification History Retrieve wotification history fara canter: SELECT sotification date, ‘notification method, ‘notification satis, bntotal moot de, bomyment_satns FROM Notifications 0 {JOIN Balls b ON will d= bbl id WHERE maccount_sumber = 12545; Jpraenty Untied mite ‘dentify bile that haven't ha notification seat yet: LEFT JOIN Notifications 2 ON bil = [WHERE n notification id 18 NULL Integration with Payment Gateway

You might also like