Java Sales Transaction Form Guide
Java Sales Transaction Form Guide
TRANSACTION FORM
SALES FORM
Contents
Specific Objectives
JDK
XAMPP
NetBeans
iReport
For this practice, it is necessary to have the mysql library or rather the JDBC.
MySql driver, associate it with the iReport plugin.
Theoretical Foundation
A transaction form is a form that allows not only to carry out tasks
specific but often combines functions from another Form, this means that
to have direct access to the fields of the table of a specific record. In addition to
allow to perform the most delicate operations such as updates.
Page 1
Unit. Concurrent programming workshop JAVA
Guide No. 8 Transaction Form
First, we will create the Sales JFrame form. Then we will create the JFrame form.
See Report, which complements the form to display the sale in a format prior to the
impression.
Page 2
[Link] Programming Workshop JAVA
Guide No. 8 Transaction Form
● We are going to proceed to program. We start by using the sql package, which
will allow us to access the database, then we will use the swing package,
specifically to the JOptionPane classes to display dialog boxes and
for the DefaultTableModel, DefaultComboBoxModel for the models of the
JTable and JComboBox controls.
● Then we proceed to create the general use variables for the connection and for the
management
of the table This lo we do inside of the class
frmSalesDetailMaster.
Page 3
[Link] programming workshop JAVA
Guide No. 8 Transaction Form
● In the constructor method, we program the following (just write what is indicated)
the red key)
Page 4
[Link] Programming Workshop JAVA
Guide No. 8 Transaction Form
Con este código configuramos los títulos y asociamos los modelos de las tablas sus
respective JTables. Then we will create the connection to the database.
Page 5
Unit: Concurrent Programming Workshop JAVA
Guide No. 8 Transaction Form
● Then we will program the part where the user selects an item.
resulting from clicking on the table. We do this in the event
MouseClicked delete controlTableClient.
● Finally, we will program the action of adding the customer to the sales record.
Page 6
Unit: Concurrent Programming Workshop JAVA
Guide No. 8 Transaction Form
● Second: just like the find client method, we will program the method to
search products, we do this directly in the eventKeyReleased
controltxtBuscarProducto.
● Then we will program the part where the user selects an element.
Page 7
[Link] de programación concurrente JAVA
Guide No. 8 Transaction form
● Finally, we will program the action of adding the products to the sales detail.
Page 8
Unit: Concurrent Programming Workshop JAVA
Guide No. 8 Transaction Form
we need to know how much we are adding to the total when each one is added
the products, that is why we implemented a method to calculate the totals.
● First: every sale generates a new record and simultaneously controls the number
sequential of the payment vouchers, if it is a receipt, it will have a number
sequential and if it is an invoice it will have a different numbering. Such numbering will
they are found in the same table, so a prior filter must be made on the
insertion of a new sale. We do this through the button btnGuardar,
eventActionPerformed, in which we will code the following:
Page 9
[Link] Programming Workshop JAVA
Guide No. 8 Transaction Form
Page 10
[Link] Programming Workshop JAVA
Guide No. 8 Transaction Form
Page 11
[Link] Programming Workshop JAVA
Guide No. 8 Transaction Form
● We will create a method to remove the rows of the models from the tables.
● We will create another method to update the stock in the product table, this will happen
Every time a sales detail is saved, that is, a product.
Step 5: Test.
Page 12