Answered step by step
Verified Expert Solution
Question
1 Approved Answer
gmy recent changes log is not displaying correctly and i checked if my data in the database is correct and it comes out right after
gmy recent changes log is not displaying correctly and i checked if my data in the database is correct and it comes out right after doing the changes but it doesnt display correct in the recent chagnes log in the window:
def removequantity:
selection itemcombobox.get
itemname selection.split if in selection else selection
# Check if itemname is in the format stored in the inventory dictionary
if anyitemname in key for key in inventory:
# Find the full key for itemname
fullkey nextkey for key in inventory if itemname in key
quantitystr quantitychangeentry.get
if not isvalidquantityquantitystr:
tkinter.messagebox.showwarningInvalid Input", "Please enter a valid positive number for quantity."
return
quantitychange floatquantitystr
if quantitychange : # Define your threshold for a 'large amount'
if not confirmlargechangequantitychange:
return
# Update the changes dictionary with the quantity change
if fullkey in changes:
changesfullkey quantitychange
else:
changesfullkeyquantitychange
# Update the quantity displayed in the GUI
currentquantity inventoryfullkeyQuantity
newquantity currentquantity quantitychange
inventoryfullkeyQuantity newquantity
quantitylabel.configtextfQuantity: newquantity
updateoriginalandnewquantityfullkey, currentquantity, newquantity
currentquantity inventoryfullkeyQuantity
newquantity currentquantity quantitychange
updatechangelistboxfullkey, currentquantity, quantitychange
# Log the change to the database
logchangetodbitemname, currentquantity, newquantity, currentuserid
else:
tkinter.messagebox.showwarningInvalid Item", "The specified item was not found in the inventory."
# Function to update the listbox with changes
def updatechangelistboxitemkey, originalquantity, quantitychange:
# Calculate the new quantity
newquantity originalquantity quantitychange if quantitychange else originalquantity quantitychange
# Determine the operation symbol and format the change appropriately
operation if quantitychange else
adjustedquantitychange absquantitychange
# Format the change text correctly for display in the listbox
changetext fitemkey: originalquantityoperationadjustedquantitychangenewquantity
# Insert the formatted change text into the listbox
changeslistbox.inserttkEND, changetext
# Split itemkey to get just the item name for logging to the database
itemname itemkey.split
logchangetodbitemname, originalquantity, newquantity, currentuseridOriginal Quantity:
Change Quantity:
New Quantity:
Recent Changes
USB Cable:
USB Cable:
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started