index.html Expense Manager

Expense Manager

Dashboard

Total Income: $0

Total Expenses: $0

Balance: $0

Add Expense

Add Income

style.css Expense Manager

Expense Manager

Dashboard

Total Income: $0

Total Expenses: $0

Balance: $0

Add Expense

Add Income

script.js // Firebase configuration const firebaseConfig = { apiKey: "AIzaSyC2jDhMWz5TMjBsG4jbUa8KEuXoK1ZIA_s", authDomain: "expense-manager-c5d91.firebaseapp.com", databaseURL: "https://expense-manager-c5d91-default-rtdb.firebaseio.com/", projectId: "expense-manager-c5d91", storageBucket: "expense-manager-c5d91.firebasestorage.app", messagingSenderId: "958885766490", appId: "1:958885766490:web:eb00b0b47493573a137f63", }; // Initialize Firebase firebase.initializeApp(firebaseConfig); const database = firebase.database(); // Add expense document.getElementById("expense-form").addEventListener("submit", (e) => { e.preventDefault(); const date = document.getElementById("expense-date").value; const amount = document.getElementById("expense-amount").value; const reason = document.getElementById("expense-reason").value; const notes = document.getElementById("expense-notes").value; database.ref("expenses").push({ date, amount, reason, notes, }); alert("Expense added successfully!"); }); // Add income document.getElementById("income-form").addEventListener("submit", (e) => { e.preventDefault(); const date = document.getElementById("income-date").value; const amount = document.getElementById("income-amount").value; const source = document.getElementById("income-source").value; const notes = document.getElementById("income-notes").value; database.ref("income").push({ date, amount, source, notes, }); alert("Income added successfully!"); });