0% found this document useful (0 votes)
5 views5 pages

Package Gudang

The document is a Java class named 'detailpenjualan' that manages the sales details in a warehouse application. It connects to a database to retrieve and display transaction details, including customer and product information, in a table format. The class also includes functionality for auto-generating transaction IDs and updating the current date in a text field.

Uploaded by

jasonjesen8
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views5 pages

Package Gudang

The document is a Java class named 'detailpenjualan' that manages the sales details in a warehouse application. It connects to a database to retrieve and display transaction details, including customer and product information, in a table format. The class also includes functionality for auto-generating transaction IDs and updating the current date in a text field.

Uploaded by

jasonjesen8
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

package gudang;

import static gudang.penjualan.frmInstance;

import static java.lang.Thread.sleep;

import java.sql.Connection;

import java.sql.PreparedStatement;

import java.sql.ResultSet;

import java.sql.SQLException;

import java.text.SimpleDateFormat;

import java.util.Calendar;

import java.util.logging.Level;

import java.util.logging.Logger;

import javax.swing.JFrame;

import javax.swing.JOptionPane;

import javax.swing.table.DefaultTableModel;

import javax.swing.table.TableModel;

import net.proteanit.sql.DbUtils;

import javax.swing.JTextField;

public class detailpenjualan extends javax.swing.JFrame {

Connection koneksi2;

gudang.session session = new gudang.session();

public static detailpenjualan frmInstance;

public JTextField useriD;

PreparedStatement pst;

private DefaultTableModel DftTblModel_Kelas;

private String SQL;

public String data;

ResultSet rst;
public detailpenjualan() {

initComponents();

koneksi2=koneksi.koneksiDB();

update();

autonumber();

delay();

setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);

frmInstance = this;

useriD= jTextField1;

private void update() {

DftTblModel_Kelas = new DefaultTableModel();

DftTblModel_Kelas.addColumn("KODE TRANSAKSI");

DftTblModel_Kelas.addColumn("ID pelanggan");

DftTblModel_Kelas.addColumn("nama pelanggan");

DftTblModel_Kelas.addColumn("nama produk");

DftTblModel_Kelas.addColumn("jumlah");

DftTblModel_Kelas.addColumn("TOTAL");

jTable1.setModel(DftTblModel_Kelas);

Connection conn = koneksi.koneksiDB();

try {

java.sql.Statement stmt = conn.createStatement();


SQL = "SELECT * FROM detailpenjualan pl inner join penjualan pr on
pl.penjualanID=pr.penjualanID inner join produk pk on pl.produkID=pk.produkID inner join pelanggan
pl1 on pr.pelangganID=pl1.pelangganID where namapelanggan LIKE '%"+jTextField1.getText()+"%' ";

java.sql.ResultSet res = stmt.executeQuery(SQL);

while (res.next()) {

DftTblModel_Kelas.addRow(new Object[]{

res.getString("penjualanID"),

res.getString("pelangganID"),

res.getString("namapelanggan"),

res.getString("namaproduk"),

res.getString("jumlah"),

res.getString("subtotal"),

});

} catch (SQLException e) {

System.out.println(e.getMessage());

private void autonumber() {

try{

String sql = "SELECT MAX(RIGHT(detailID,3)) AS NO FROM detailpenjualan";

pst=koneksi2.prepareStatement(sql);

rst=pst.executeQuery();

while (rst.next()) {

if (rst.first() == false) {

jTextField2.setText("0");

}else{

rst.last();
int auto_id = rst.getInt(1) + 1;

String no = String.valueOf(auto_id);

int nomorjual = no.length();

for (int j=3; j<1 - nomorjual; j++){

no = "0" + no;

jTextField2.setText("0000" + no);

rst.close();

}catch (Exception e) {JOptionPane.showMessageDialog(null, e);}

private void delay() {

Thread clock=new Thread(){

public void run(){

for(;;){

Calendar cal=Calendar.getInstance();

SimpleDateFormat format2=new SimpleDateFormat("yyyy-MM-dd");

jTextField3.setText(format2.format(cal.getTime()));

try{ sleep(1000);

} catch (InterruptedException ex){

Logger.getLogger(penjualan.class.getName()).log(Level.SEVERE, null, ex);

};
clock.start();

private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {

pelanggan2 dataKelas = new pelanggan2();

dataKelas.dispose();

dataKelas.setVisible(true);

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {

update();

private void jLabel2MouseClicked(java.awt.event.MouseEvent evt) {

new menu().setVisible(true);

dispose();

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy