INVENTORY CONTROL: PART 3

by David de Almeida Bezerra Júnior


See the part 2.

In this section, we will build the Commodity Entry window (Incoming).


Creating the window

Create a window named JDialogIncoming, and add three Labels, three TextFields, a Button and a Table. Also change the Window property of the window to Dialog.



Change the Text Labels to "Product ID", "Amount" and "Supplier ID". Change the Name of the TextFields to jTextFieldProductId, jTextFieldAmount and jTextFieldSupplierId, and The Table for jTableIncoming.

In Titles and Columns properties of jTableIncoming, enter:
incoming_date
incoming_time
product_id
amount
supplier_id


Events

Add two Procedures and change the name to: fillTable and addRow.

In OnExecute Event of the Procedure fillTable, add a fillTable function with the following parameters:
jTableIncoming
incoming
incoming_date, incoming_time, product_id, amount, supplier_id
order by incoming_date


In OnExecute Event of the Procedure addRow, add a insertRecord function with the following parameters:
incoming
incoming_date, incoming_time, product_id, amount, supplier_id
current_date(), current_time(), '"+jTextFieldProductId.getText()+"', '"+jTextFieldAmount.getText()+"', '"+jTextFieldSupplierId.getText()+"'

Also add the alterRecord function with the following parameters:
product
amount=amount+'"+jTextFieldAmount.getText()+"'
where id='"+jTextFieldProductId.getText()+"'

This feature will add the amount that entered the stock of the product.


OnShow event in the window, add a executarProcedure function with parameter:
fillTable


The onclick event of the Button, executarProcedure add two functions, one with the addRow and the other with fillTable.


Go back to the jFrameMain and in the onclick event of the Incoming menu, add the openWindow function with the parameter:
JDialogIncoming

Save and Run your application by clicking on the respective buttons on the toolbar or pressing Ctrl + S and F9 .



In the next section, we will build the sales window (Sale).

Go to part 4.



CopyRight © 2023 Analisa Software.All Rights Reserved.