Anda di halaman 1dari 10

REPORT PROJECT CLIENT SERVER Petunjuk : Lengkapi Daftar isian berikut sesuai dengan tugas yang telah dikerjakan

n Tambahkan baris baru jika baris isian yang tersedia tidak cukup Dibawa dan dikumpulkan saat ujian matakuliah Client server (dimasukkan kedalam lembar jawab ujian) Laporan ini digunakan untuk menjawab pertanyaan-pertanyaan saat ujian Client Server 1 Tema : Bahan Baku Nama Database : DBPCS5138 Nama File Database : SISI09

Daftar Tabel Nama Tabel : Bahan Baku NamaKolom dan tipe KodeBB NamaBB Stok Definisi Constraint pada kolom (jika ada) PrimaryKey

Nama Tabel : DetailBarangMasuk NamaKolom dan tipe Definisi Constraint pada kolom (jika ada) NoCatat PrimaryKey KodeBB Primarykey HargaBeli JmlBeli Nama Tabel : BarangMasuk NamaKolom dan tipe Nocatat NOBuktipembayaran Tanggal Kodepemasok TotalBeli potBeli Dibayar Sisa Nama Tabel : Pemasok NamaKolom dan tipe KodePemasok NamaPemasok Alamat Utang Definisi Constraint pada kolom (jika ada) Primary key

Definisi Constraint pada kolom (jika ada) Primary key

Nama Tabel :PembayaranUtang NamaKolom dan tipe Definisi Constraint pada kolom (jika ada) Nobayar Primary key TglBayar KodePemasok Primary key JmlBayar

Daftar Function No Nama Function

Isi Function

1 2 3

FCKodepemasok FCNoCatat FCTotPembelian

Menentukan kode pemasok

Menentukan no catat Menghitung Total Pembelian

Stored Procedure No Nama Proc 1 proc

Isi Procedure Insert Pemasok

SPInsertPemasok
2 procSPBarangMasuk Insert Data Barangmasuk

Trigger : No Script Trigger 1 2

Maksud tujuan pembuatan trigger Mengubah data hutang(jika hutang bertambah) Mengubah data hutang(jika hutang berkurang)

Project Library Nama Class/Interface Class Barang Class Detail Class LoginKaryawan Class Transaksi Interface RemoteClientBarang Interface RemoteClientLogin Interface RemoteServerBarang Interface RemoteServerLogin

interface RemoteServerTransaksi

Daftar atribut/ method String kode,String nama,double harga,double diskon,int stok void kdBrg, int banyak String nik,String nama,String pass; String nonota, private Date tgl,String kdMember,String NIKKasir; Void RefreshBarang void setIClient , void setLoginClient boolean insertBarang(Barang obj), boolean updateBarang(Barang obj) boolean deleteBarang(String kdBrg) public List<Barang> selectBarang() int daftarClientBarang(RemoteClientLogin r1, LoginKaryawan log) c void hapusClientBarang(int i), int daftarClientTransaksi(RemoteClientLogin r1, LoginKaryawan log) void hapusClientTransaksi (int i) public boolean insertTransaksi(Transaksi obj, List<Detail> listDetail)

Project Server

Listing kode class main server : public class MainServer { /** * @param args the command line arguments */ public static void main(String[] args) throws RemoteException { // TODO code application logic here new KoneksiDB().getKoneksi(); Registry registry=LocateRegistry.createRegistry(1100); ServiceLogin sl=new ServiceLogin(); registry.rebind("ServiceLogin",sl); ServiceBarang sb=new ServiceBarang(); sb.setSl(sl); registry.rebind("ServerBarang",sb); } }

Listing kode Class untuk koneksi server ke database : public class KoneksiDB { private Connection koneksi; private PreparedStatement ps; public Connection getKoneksi(){ if (koneksi==null){ try{ Class.forName("net.sourceforge.jtds.jdbc.Driver"); try{ String url="jdbc:jdts:sqlserver://localhost8080:1433/DBPCS5138"; koneksi=DriverManager.getConnection(url,"sa","amikom"); System.out.println("Koneksi Database Sukses"); } catch (SQLException se){ System.out.println("Koneksi Database Gagal Error:"+se); System.exit(0); } }catch (ClassNotFoundException cnfe){ System.out.println("Class tidak ditemukan, error:"+cnfe); System.exit(0); } } return koneksi; } public boolean eksekusiNonQuery(String query){ try { ps=koneksi.prepareStatement(query); ps.executeUpdate(); return true; }catch (SQLException e){ System.out.println("Salah Query:"+e); return false; } } public ResultSet eksekusiQuery(String query){ try{ ps=koneksi.prepareStatement(query); return ps.executeQuery(); }catch (SQLException e){

System.out.println("salah query:"+e); return null; } } } Listing kode Class Server :

Project Client Daftar nama class didalam project Nama Class/File FrmBarang FrmLogin ClientBarang Listing kode untuk setiap event didalam Form package appclienttransaksi5138;

Bentuk JFrameform JFrameform JavaClass

/** * * @author ACER */ public class FrmTransaksi extends javax.swing.JPanel { /** Creates new form FrmTransaksi */ public FrmTransaksi() { initComponents(); } /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code"> private void initComponents() { jPanel1 = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); jTextField1 = new javax.swing.JTextField(); jTextField2 = new javax.swing.JTextField(); jTextField3 = new javax.swing.JTextField(); jScrollPane1 = new javax.swing.JScrollPane(); jTable1 = new javax.swing.JTable(); jLabel4 = new javax.swing.JLabel(); jLabel5 = new javax.swing.JLabel(); jPanel2 = new javax.swing.JPanel(); jRadioButton1 = new javax.swing.JRadioButton(); jRadioButton2 = new javax.swing.JRadioButton(); jTextField4 = new javax.swing.JTextField(); jLabel6 = new javax.swing.JLabel(); jLabel7 = new javax.swing.JLabel(); jLabel8 = new javax.swing.JLabel(); jTextField5 = new javax.swing.JTextField(); jTextField6 = new javax.swing.JTextField(); jButton1 = new javax.swing.JButton(); jButton2 = new javax.swing.JButton(); jButton3 = new javax.swing.JButton(); jPanel1.setBackground(new java.awt.Color(153, 153, 153)); jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Transaksi"));

jLabel1.setText("Kode"); jLabel2.setText("Nama Barang"); jLabel3.setText("Stok"); jTable1.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { {null, null, null, null, null, null}, {null, null, null, null, null, null}, {null, null, null, null, null, null}, {null, null, null, null, null, null} }, new String [] { "Kode", "Nama Barang", "Banyak", "Harga", "Disc", "Sub Total" } )); jScrollPane1.setViewportView(jTable1); jLabel4.setForeground(new java.awt.Color(0, 0, 255)); jLabel4.setText("Enter"); jLabel5.setForeground(new java.awt.Color(0, 0, 255)); jLabel5.setText("Enter"); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 543, Short.MAX_VALUE) .addGroup(jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel1) .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 51, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabel5) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel2) .addComponent(jTextField2, javax.swing.GroupLayout.DEFAULT_SIZE, 330, Short.MAX_VALUE)) .addGap(18, 18, 18) .addComponent(jLabel4) .addGap(18, 18, 18) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, 49, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel3)) .addGap(15, 15, 15))) .addContainerGap()) ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel1) .addComponent(jLabel3) .addComponent(jLabel2)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE,

javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel5) .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel4)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 113, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(27, Short.MAX_VALUE)) ); jPanel2.setBackground(new java.awt.Color(153, 153, 153)); jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Customer")); jRadioButton1.setBackground(new java.awt.Color(153, 153, 153)); jRadioButton1.setText("Non Member"); jRadioButton2.setBackground(new java.awt.Color(153, 153, 153)); jRadioButton2.setText("Member"); jLabel6.setForeground(new java.awt.Color(0, 0, 255)); jLabel6.setText("(Diisi Dengan Kode Member)"); javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); jPanel2Layout.setHorizontalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jRadioButton1) .addGroup(jPanel2Layout.createSequentialGroup() .addComponent(jRadioButton2) .addGap(31, 31, 31) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel6) .addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, 119, javax.swing.GroupLayout.PREFERRED_SIZE)))) .addContainerGap(39, Short.MAX_VALUE)) ); jPanel2Layout.setVerticalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addContainerGap() .addComponent(jRadioButton1) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jRadioButton2) .addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jLabel6) .addContainerGap(21, Short.MAX_VALUE)) ); jLabel7.setText("Uang dibayarkan"); jLabel8.setText("Uang Kembali"); jButton1.setText("Proses"); jButton2.setText("Selesai"); jButton3.setText("Tutup"); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel7) .addComponent(jLabel8)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jTextField6) .addComponent(jTextField5, javax.swing.GroupLayout.DEFAULT_SIZE, 104, Short.MAX_VALUE))) .addComponent(jButton2)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jButton3) .addComponent(jButton1))) .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addContainerGap()) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(31, 31, 31) .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel7) .addComponent(jTextField5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel8) .addComponent(jTextField6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(31, 31, 31) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jButton2) .addComponent(jButton3))))) .addGroup(layout.createSequentialGroup() .addGap(33, 33, 33) .addComponent(jButton1))) .addContainerGap(43, Short.MAX_VALUE)) ); }// </editor-fold> // Variables declaration - do not modify private javax.swing.JButton jButton1; private javax.swing.JButton jButton2; private javax.swing.JButton jButton3; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4;

private javax.swing.JLabel jLabel5; private javax.swing.JLabel jLabel6; private javax.swing.JLabel jLabel7; private javax.swing.JLabel jLabel8; private javax.swing.JPanel jPanel1; private javax.swing.JPanel jPanel2; private javax.swing.JRadioButton jRadioButton1; private javax.swing.JRadioButton jRadioButton2; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JTable jTable1; private javax.swing.JTextField jTextField1; private javax.swing.JTextField jTextField2; private javax.swing.JTextField jTextField3; private javax.swing.JTextField jTextField4; private javax.swing.JTextField jTextField5; private javax.swing.JTextField jTextField6; // End of variables declaration } package appclienttransaksi5138; /** * * @author ACER */ public class FrmCariBarang extends javax.swing.JPanel { /** Creates new form FrmCariBarang */ public FrmCariBarang() { initComponents(); } /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code"> private void initComponents() { jLabel1 = new javax.swing.JLabel(); jTextField1 = new javax.swing.JTextField(); jScrollPane1 = new javax.swing.JScrollPane(); jTable1 = new javax.swing.JTable(); jButton1 = new javax.swing.JButton(); jButton2 = new javax.swing.JButton(); jLabel1.setText("Nama Barang Yang Dicari"); jTable1.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { {null, null, null, null}, {null, null, null, null}, {null, null, null, null}, {null, null, null, null} }, new String [] { "Kode", "Nama Barang", "Harga", "Disc" } )); jScrollPane1.setViewportView(jTable1); jButton1.setText("Pilih"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); }

}); jButton2.setText("Tutup"); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(21, 21, 21) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 451, Short.MAX_VALUE) .addGroup(layout.createSequentialGroup() .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 137, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 220, javax.swing.GroupLayout.PREFERRED_SIZE))) .addContainerGap()) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addContainerGap(275, Short.MAX_VALUE) .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 66, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(jButton2) .addGap(62, 62, 62)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(21, 21, 21) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(34, 34, 34) .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 254, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jButton2) .addComponent(jButton1)) .addContainerGap(41, Short.MAX_VALUE)) ); }// </editor-fold> private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: } // Variables declaration - do not modify private javax.swing.JButton jButton1; private javax.swing.JButton jButton2; private javax.swing.JLabel jLabel1; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JTable jTable1; private javax.swing.JTextField jTextField1; // End of variables declaration } 10 Screen Shot Tampilan Form