private void txtKodeSupplier_Validated(object sender, EventArgs e) { if (txtKodeSupplier.Text.Length > 0) { String strSQL, noNotaBaru = txtNoNotaBeli.Text.Trim(); Tabel Supplier = new Tabel("Supplier", "inventory_tigger"); int baris = Supplier.getBs().Find("KodeSupplier", txtKodeSupplier.Text.Trim()); if (baris >= 0) { String noNotaBeli, kd, sqlStr; noNotaBeli = txtNoNotaBeli.Text.Trim(); kd = txtKodeSupplier.Text.Trim(); sqlStr = "Update NotaBeli SET KodeSupplier='{0}' where noNotaBeli='{1}'"; sqlStr = String.Format(sqlStr, kd, noNotaBeli); notaBeli.eksekusiSQL(sqlStr); baris = notaBeli.getBs().Find("noNotaBeli", noNotaBaru); notaBeli.getBs().Position = baris; } else { //MessageBox.Show("KodeSupplier : " + txtKodeSupplier.Text.Trim() + " tidak ada !!"); FormCariSupplier fcs = new FormCariSupplier(); fcs.ShowDialog(); txtKodeSupplier.Text = fcs.KodeSupplier; txtKodeSupplier.Focus(); } } }
private void btnSave_Click(object sender, EventArgs e) { String sqlSTR, username, password, repass; bool brg, sup, pem, penjualan, pembelian, lapstock, lapdatasup; sqlSTR = ""; username = txtUsername.Text; password = txtPassword.Text; repass = txtKonFir.Text; brg = checBarang.Checked; sup = checSupplier.Checked; pem = checPemakai.Checked; penjualan = checJual.Checked; pembelian = checBeli.Checked; lapstock = checLapStock.Checked; lapdatasup = checLapSupp.Checked; if (password == repass) { if (baru) { sqlSTR = "Insert into usernya VALUES ('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}')"; sqlSTR = String.Format(sqlSTR, username, password, repass, brg, sup, pem, penjualan, pembelian, lapstock, lapdatasup); } else { sqlSTR = "update usernya set userName = '******', password = '******',setupBarang = '{2}','setupSupplier = '{3}', pembelian ='{4}',penjualan = '{5}',"; sqlSTR += "lapstock = '{7}', lapsupp = '{8}' where userName ='******'"; sqlSTR = String.Format(sqlSTR, username, password, repass, brg, sup, pem, penjualan, pembelian, lapstock, lapdatasup); } } pemakai.eksekusiSQL(sqlSTR); tutup(); }
private void btnDel_Click(object sender, EventArgs e) { DialogResult jwb; jwb = MessageBox.Show(" Hapus Nota no : " + txtNoNotaJual.Text + " ? ", "Konfirmasi", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (jwb == DialogResult.Yes) { String nomornota = txtNoNotaJual.Text.Trim(); String strSQL = " delete From itemNotaJual WHERE noNotajual='" + nomornota + "'"; detail.eksekusiSQL(strSQL); strSQL = " delete From NotaJual WHERE noNotaJual='" + nomornota + "'"; notaJual.eksekusiSQL(strSQL); MessageBox.Show("Penghapus selesai", "informasi", MessageBoxButtons.OK, MessageBoxIcon.Information); notaJual.getBs().MoveLast(); tampilDetail(); } else { MessageBox.Show("penghapusan dibatalkan", "informasi", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void txtJumlah_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == 13) { String no, kd, qt, hg, sqlStr; no = txtNoNotaBeli.Text.Trim(); kd = txtKodeBaranag.Text.Trim(); qt = txtQty.Text.Trim(); hg = txtHarga.Text.Trim(); sqlStr = "INSERT INTO itemNotaBeli(noNotaBeli,kodeBarang,qty,harga) VALUES ('{0}','{1}','{2}','{3}')"; sqlStr = String.Format(sqlStr, no, kd, qt, hg); //MessageBox.Show(sqlStr); detail.eksekusiSQL(sqlStr); hapus(); hitung(); } }
private void btnSave_Click(object sender, EventArgs e) { String sqlStr, kode, nama, beli, jual, stok, satuan; kode = txtKodeBarang.Text; nama = txtNamaBarang.Text; beli = txtHargaBeli.Text; jual = txtHargaJual.Text; stok = txtStok.Text; satuan = cmbSatuan.Text; if (baru) { if (barang.sudahAda("kodeBarang", kode)) { MessageBox.Show("Kode : " + kode + " sudah ada.."); txtKodeBarang.Focus(); return; } sqlStr = "Insert into barang values('{0}','{1}','{2}','{3}','{4}','{5}')"; sqlStr = String.Format(sqlStr, kode, nama, beli, jual, stok, satuan); } else { if (barang.bolehUpdate("kodeBarang", kode, idLama)) { MessageBox.Show("Kode : " + kode + " sudah ada.."); txtKodeBarang.Focus(); return; } else { sqlStr = "Update barang set kodeBarang='{0}', namaBarang='{1}', hargaBeli='{2}',"; sqlStr += "hargaJual='{3}', stok='{4}', satuan='{5}' where kodeBarang='{6}'"; sqlStr = String.Format(sqlStr, kode, nama, beli, jual, stok, satuan, idLama); } } barang.eksekusiSQL(sqlStr); tutup(); }
private void btnSave_Click(object sender, EventArgs e) { String sqlStr, nik, nama_dosen, alamat, kota; nik = txtNIK.Text.Trim(); nama_dosen = txtNamaDosen.Text.Trim(); alamat = txtAlamat.Text.Trim(); kota = txtKota.Text.Trim(); if (baru) { sqlStr = "INSERT INTO dosen VALUES('{0}','{1}','{2}','{3}')"; sqlStr = String.Format(sqlStr, nik, nama_dosen, alamat, kota); } else { sqlStr = "UPDATE dosen SET nik='{0}', nama_dosen='{1}', alamat='{2}',"; sqlStr += "kota ='{3}' WHERE nik='{4}'"; sqlStr = String.Format(sqlStr, nik, nama_dosen, alamat, kota, stok, satuan, idLama); } dosen.eksekusiSQL(sqlStr); tutup(); }
private void btnSave_Click(object sender, EventArgs e) { String sqlStr, kode, nama, alamat, kota, telpon; kode = txtKodeSupplier.Text; nama = txtNamaSupplier.Text; alamat = txtAlamat.Text; kota = txtKota.Text; telpon = txtTelepon.Text; if (baru) { sqlStr = "Insert into barang values('{0}','{1}','{2}','{3}','{4}')"; sqlStr = String.Format(sqlStr, kode, nama, alamat, kota, telpon); } else { sqlStr = "Update barang set kodeSupplier='{0}', namaSupplier='{1}', alamat='{2}',"; sqlStr += "kota='{3}', telpon='{4}' where kodeSupplier='{5}'"; sqlStr = String.Format(sqlStr, kode, nama, alamat, kota, telpon, idLama); } supplier.eksekusiSQL(sqlStr); tutup(); }