Graphical Interface
In the Graphical Interface you can make a Client table, with columns like "Customer Name", "Order Quantity", etc. That is, each Row with a different Customer.
By clicking on a Line from this Client table you open another Screen with another Table; this second Screen will have the information of the Client and, inclusive, will have a Order Table of this Customer, with Columns such as "Order Quantity", "Order Date", etc. All Orders made by this Customer will be in this Table.
When Clicking on a Line from Order Table you can open in another Screen (or open in a "Box Accordion" [floating or not] below the Row) a Table with the Items that are in this Order, where the Columns would be "Product Name", "Quantity", "Unit Value", "Total Value", etc.
See an Example I created here from the Client Data Screen:
Note that you will need many more things, such as payment methods, installments, etc. This is just a layou idea.
Class Design (application logic):
You can create a "Client" Class that will have a "Request" Object List, each "Request" Object will have "Itemped" Object List, and each "Itemped" Object will have:
- A (Exactly ONE) Object "Item" (the Product) that already has its "Code" and its Name;
- The Quantity (
int
with units purchased in this Order);
- The "Unit Value", the "Total Value" (which is "quantity * valueUnited"), and the "Paid Value".
Remember to use "Money and Currency API" or at least BigDecimal
to handle money, do not use double
for this (see here why use Bigdecimal instead of Double to handle money).
I believe that declaring Customer with the attribute of List<Orders> and each Order has an attribute idClient to identify the customer is sufficient.
– Daniela Morais
I will try to do as you said Daniela, maybe the problem is that I took this test in main() it ended up working out but when I went to divide the customers in a form I ended up not getting
– Victor