Spaces:
Sleeping
Sleeping
gouravgujariya
commited on
Commit
•
42726a0
1
Parent(s):
0676e4c
Update app.py
Browse files
app.py
CHANGED
@@ -7,17 +7,20 @@ class SalaryTracker:
|
|
7 |
self.salary = initial_salary
|
8 |
self.expenses = []
|
9 |
self.data = pd.DataFrame({'Transaction': [], 'Salary': []})
|
|
|
10 |
|
11 |
def add_expense(self, amount):
|
12 |
self.expenses.append(amount)
|
13 |
self.salary -= amount
|
|
|
14 |
|
15 |
def deduct_expense(self, amount):
|
16 |
self.expenses.append(-amount)
|
17 |
self.salary += amount
|
|
|
18 |
|
19 |
def update_data(self, transaction):
|
20 |
-
new_data = pd.DataFrame({'Transaction': [transaction], 'Salary': [self.salary]})
|
21 |
self.data = pd.concat([self.data, new_data], ignore_index=True)
|
22 |
|
23 |
def generate_report(self):
|
|
|
7 |
self.salary = initial_salary
|
8 |
self.expenses = []
|
9 |
self.data = pd.DataFrame({'Transaction': [], 'Salary': []})
|
10 |
+
self.transaction_count = 0
|
11 |
|
12 |
def add_expense(self, amount):
|
13 |
self.expenses.append(amount)
|
14 |
self.salary -= amount
|
15 |
+
self.transaction_count += 1
|
16 |
|
17 |
def deduct_expense(self, amount):
|
18 |
self.expenses.append(-amount)
|
19 |
self.salary += amount
|
20 |
+
self.transaction_count += 1
|
21 |
|
22 |
def update_data(self, transaction):
|
23 |
+
new_data = pd.DataFrame({'Transaction': [f"Transaction {self.transaction_count} - {transaction}"], 'Salary': [self.salary]})
|
24 |
self.data = pd.concat([self.data, new_data], ignore_index=True)
|
25 |
|
26 |
def generate_report(self):
|