Save Transaction How

Hello! I have this system like an inventory list. If I pick product, select quantity and input the cash amount, I finish inputting my details. but I want to either save or delete the transaction (using TinyDB). Then this saved transactions will appear on the list view on the other screen called Inventory. How can I do it?

Blocks:

system:

This is my inventory and I plan to put a list view below

UPDATE:

I tried this on Home Screen

image

And this on Inventory Screen:

This si the result. please help me

Hope this will help you:

A transaction must be unique, even when other transactions are identical. So when you save a transaction, you must apply something like a record number, which could be a date and time instance - this would be your TinyDB tag too. You should also store a transaction date for later search purposes.

The issue you have in saving your transactions is their complexity, being a mixture of lists of lists and individual text items and, I think, the length of the lists of lists per transaction is a variable. If that can be simplified, you might be able to save some of your hair from going grey.

I would store the list on a per item basis. This would also help to report progress to the User inputting the transaction, for example the User inputs or selects an item and quantity, adds that to the current transaction and the App reports the item price, total price for the quantity of the item and total price thus far of all items added to the transaction. Store the transaction when it is completed.

Add Items To Items_List

Item1
Price
Quantity
Total Price

Item2
Price
Quantity
Total Price ....etc

Since we don't know how many Items_Lists there are, make a List of Transaction date and time, total price, cash and change first, then add that to the Transaction_List, followed by the Items_Lists (loop through), and save to TinyDB.

Tag: T2024_24_05_02_03_46
valueToStore: Transaction_List

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.