import tkinter as tk
from tkinter import ttk, messagebox
class TransactionCalculator:
def __init__(self, root):
self.root = root
self.root.title("Kiosk Transaction Calculator")
self.data = []
# Table headers
self.tree = ttk.Treeview(root, columns=("Type", "Amount", "Holding"), show="headings")
self.tree.heading("Type", text="Type of Transaction")
self.tree.heading("Amount", text="Amount")
self.tree.heading("Holding", text="KO Holding")
self.tree.pack(pady=10)
# Input fields
form_frame = tk.Frame(root)
form_frame.pack(pady=10)
tk.Label(form_frame, text="Transaction Type").grid(row=0, column=0, padx=5)
self.type_entry = ttk.Combobox(form_frame, values=["AEPS Withdrawal", "Money Transfer", "Deposit"])
self.type_entry.grid(row=0, column=1, padx=5)
tk.Label(form_frame, text="Amount").grid(row=0, column=2, padx=5)
self.amount_entry = tk.Entry(form_frame)
self.amount_entry.grid(row=0, column=3, padx=5)
tk.Label(form_frame, text="KO Holding").grid(row=0, column=4, padx=5)
self.holding_entry = tk.Entry(form_frame)
self.holding_entry.grid(row=0, column=5, padx=5)
tk.Button(root, text="Add Transaction", command=self.add_transaction).pack(pady=5)
tk.Button(root, text="Calculate Summary", command=self.calculate_summary).pack(pady=5)
self.summary_text = tk.Text(root, height=10, width=80)
self.summary_text.pack(pady=10)
def add_transaction(self):
t_type = self.type_entry.get()
try:
amount = float(self.amount_entry.get())
holding = float(self.holding_entry.get())
except ValueError:
messagebox.showerror("Invalid input", "Please enter valid numbers for Amount and KO Holding.")
return
self.data.append({"type": t_type, "amount": amount, "holding": holding})
self.tree.insert("", "end", values=(t_type, amount, holding))
self.type_entry.set("")
self.amount_entry.delete(0, tk.END)
self.holding_entry.delete(0, tk.END)
def calculate_summary(self):
summary = {}
total_amount = 0
total_holding = 0
for row in self.data:
t_type = row['type']
if t_type not in summary:
summary[t_type] = {"amount": 0, "holding": 0, "count": 0}
summary[t_type]["amount"] += row["amount"]
summary[t_type]["holding"] += row["holding"]
summary[t_type]["count"] += 1
total_amount += row["amount"]
total_holding += row["holding"]
# Show summary
self.summary_text.delete("1.0", tk.END)
for t_type, data in summary.items():
self.summary_text.insert(tk.END,
f"{t_type} - Total: ₹{data['amount']} | KO Holding: ₹{data['holding']} | Transactions: {data['count']}\n")
self.summary_text.insert(tk.END, "\n")
self.summary_text.insert(tk.END, f"TOTAL Amount: ₹{total_amount}\n")
self.summary_text.insert(tk.END, f"TOTAL KO Holding: ₹{total_holding}\n")
if __name__ == "__main__":
root = tk.Tk()
app = TransactionCalculator(root)
root.mainloop()
Popular posts from this blog
เคเคฎ्เคฐ เคैเคฒเคुเคฒेเคเคฐ เคเคฎ्เคฐ เคैเคฒเคुเคฒेเคเคฐ เคเคจ्เคฎ เคคिเคฅि: เคिเคธ เคฆिเคจ เคคเค เคเคฎ्เคฐ เคाเคนिเค: เคเคฎ्เคฐ เคจिเคाเคฒें ๐ เคॉเคชी เคเคฐें ๐ PDF ๐ เคฅीเคฎ * เคเคฎ्เคฐ เคตเคฐ्เคทों, เคฎเคนीเคจों, เคฆिเคจों, เคंเคों, เคฎिเคจเคों เคเคฐ เคธेเคंเคกों เคฎें เคฆिเคाเค เคाเคเคी।
Comments
Post a Comment