Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Imports System
- Imports System.Text
- Imports System.Drawing
- Imports System.Windows.Forms
- Imports System.ComponentModel
- Imports System.Collections.Generic
- Imports ComponentFactory.Krypton.Ribbon
- Imports ComponentFactory.Krypton.Toolkit
- Public Class frm_inventaris
- Dim proses As New ClsKoneksi
- Dim perintah As String
- Dim baris, carialat, carikode, brst As DataTable
- Sub bersih()
- txtkd.Text = ""
- txtnm.Text = ""
- txtpnjm.Text = ""
- txtkdalat.Text = ""
- txtjml.Text = ""
- txttrs.Text = ""
- txtkdk.Text = ""
- txtnmk.Text = ""
- txtjbtn.Text = ""
- txtnotelp.Text = ""
- txtjml.Text = ""
- dgdetail.Rows.Clear()
- dt2.Value = DateAdd(DateInterval.Day, 1, dt1.Value.Date)
- txtkd.Text = Format(Now, "dd-MM-yyyy") + "-"
- End Sub
- Private Sub KryptonPanel_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles KryptonPanel.Paint
- End Sub
- Private Sub frm_inventaris_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
- bersih()
- End Sub
- Private Sub frm_inventaris_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
- bersih()
- End Sub
- Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox1.Click
- Form1.tb.Text = "b"
- Form1.Button1.Enabled = False
- Form1.Button2.Enabled = False
- Form1.Button3.Enabled = False
- Form1.Button4.Enabled = False
- Form1.Button5.Enabled = False
- Form1.Button6.Enabled = False
- Form1.lcari.Visible = False
- Form1.txtcari.Visible = False
- Form1.ShowDialog()
- txtjml.Focus()
- End Sub
- Sub cari()
- If txtkdalat.Text = "" Then
- Else
- baris = proses.ExecuteQuery("Select label_alat as 'Label Alat' From MLabelAlat where kd_alat='" + txtkdalat.Text + "' and st='True' order by label_alat asc")
- dglabel.DataSource = baris
- dglabel.Columns(0).Width = 250
- txttrs.Text = baris.Rows.Count
- lb.Text = "0"
- End If
- End Sub
- Private Sub txtkdalat_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtkdalat.TextChanged
- cari()
- End Sub
- Private Sub dglabel_CellDoubleClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dglabel.CellDoubleClick
- Try
- Dim a As String()
- Dim b As String
- b = dglabel.Rows(e.RowIndex).Cells(0).Value.ToString
- a = {b}
- dgdetail.Rows.Add(a)
- dglabel.Rows.RemoveAt(e.RowIndex)
- Catch ex As Exception
- End Try
- End Sub
- Private Sub dt2_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles dt2.ValueChanged
- Dim a As String
- a = DateDiff(DateInterval.Day, dt1.Value.Date, dt2.Value.Date)
- If Val(a.ToString) < 0 Then
- dt2.Value = dt1.Value.Date.ToString
- Else
- End If
- End Sub
- Private Sub PictureBox3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox3.Click
- frm_karyawan.tb.Text = "c"
- frm_karyawan.ShowDialog()
- End Sub
- Sub ubah_bit()
- Dim c As Int16 = 0
- Dim a As String
- Do Until c = dgdetail.Rows.Count
- a = dgdetail.Rows(c).Cells(0).Value.ToString
- perintah = "Update MLabelAlat set st='False' where label_alat='" + a.ToString + "'"
- proses.ExecuteNonQuery(perintah)
- c = c + 1
- Loop
- KryptonMessageBox.Show("Transaksi berhasil", "Perhatian", MessageBoxButtons.OK, MessageBoxIcon.Information)
- End Sub
- Sub simpan_inventori()
- perintah = "Insert Into TRSInventaris values('" + txtkd.Text + "','" + txtkdk.Text + "','" + txtpetugas.Text + "','" + dt1.Text + "','" + dt2.Text + "')"
- proses.ExecuteNonQuery(perintah)
- End Sub
- Sub simpan_detail()
- Dim c As Int16 = 0
- Dim a As String
- Do Until c = dgdetail.Rows.Count
- a = dgdetail.Rows(c).Cells(0).Value.ToString
- perintah = "Insert Into TRSDetailInventaris values('" + txtkd.Text + "','" + a + "','True')"
- proses.ExecuteNonQuery(perintah)
- c = c + 1
- Loop
- End Sub
- Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
- If txtkd.Text = "" Or txtkdalat.Text = "" Or txtkdk.Text = "" Then
- KryptonMessageBox.Show("Data belum lengkap")
- Else
- Try
- simpan_detail()
- simpan_inventori()
- ubah_bit()
- lap_inventaris.Button2.Text = txtbeli.Text
- lap_inventaris.Button1.Text = txtkd.Text
- lap_inventaris.Show()
- bersih()
- Catch ex As Exception
- MsgBox("Kode Telah Terpakai")
- End Try
- End If
- End Sub
- Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
- bersih()
- End Sub
- Private Sub KryptonButton2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KryptonButton2.Click
- If dglabel.RowCount <= 0 Then
- Else
- Try
- Dim a As Int16
- dgdetail.Rows.Add({dglabel.Rows(lb.Text).Cells(0).Value.ToString})
- dglabel.Rows.RemoveAt(lb.Text)
- Catch ex As Exception
- End Try
- End If
- End Sub
- Private Sub KryptonButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KryptonButton1.Click
- Dim jml, a As Int16
- Dim isi As String()
- jml = 0
- a = dglabel.RowCount
- Do Until jml = a
- isi = {dglabel.Rows(0).Cells(0).Value.ToString}
- dgdetail.Rows.Add(isi)
- dglabel.Rows.RemoveAt(0)
- jml = jml + 1
- Loop
- End Sub
- Private Sub KryptonButton4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KryptonButton4.Click
- Dim a As String = KryptonMessageBox.Show("Apakah anda ingin menghapus semua data pinjam ?", "Perhatian", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
- If a = MsgBoxResult.Yes Then
- dgdetail.Rows.Clear()
- txtbeli.Text = "Barang pinjam 0"
- End If
- End Sub
- Private Sub KryptonButton3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KryptonButton3.Click
- If Val(lb2.Text) < 0 Then
- Else
- Try
- Dim a As String
- a = KryptonMessageBox.Show("Apakah ingin menghapus data ini?", "Perhatian", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
- If a = MsgBoxResult.Yes Then
- dgdetail.Rows.RemoveAt(lb2.Text)
- If Val(dgdetail.RowCount) = lb2.Text Then
- lb2.Text = Val(lb2.Text) - 1
- End If
- End If
- Catch ex As Exception
- End Try
- End If
- End Sub
- Private Sub dgdetail_CellDoubleClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgdetail.CellDoubleClick
- Dim a As String
- a = KryptonMessageBox.Show("Apakah ingin menghapus data ini?", "Perhatian", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
- If a = MsgBoxResult.Yes Then
- dgdetail.Rows.RemoveAt(e.RowIndex)
- End If
- End Sub
- Private Sub dgdetail_CellClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs)
- lb2.Text = e.RowIndex
- End Sub
- Private Sub dglabel_CellClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dglabel.CellClick, dgdetail.CellClick
- lb.Text = e.RowIndex
- End Sub
- Sub total()
- txtbeli.Text = "Barang pinjam sebanyak " + dgdetail.RowCount.ToString + " Item"
- End Sub
- Private Sub dgdetail_RowsRemoved(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewRowsRemovedEventArgs) Handles dgdetail.RowsRemoved
- total()
- End Sub
- Sub tambah()
- If txtjml.Text = "" Or txtpnjm.Text = "" Then
- Else
- Dim jm As Int16 = dglabel.RowCount
- If Val(txtpnjm.Text) > jm.ToString Then
- txtpnjm.ForeColor = Color.White
- txtpnjm.BackColor = Color.Red
- Else
- txtpnjm.ForeColor = Color.Black
- txtpnjm.BackColor = Color.White
- Dim a, b As Int16
- a = Val(txtpnjm.Text)
- b = 0
- Do Until b = a
- dgdetail.Rows.Add({dglabel.Rows(0).Cells(0).Value.ToString})
- dglabel.Rows.RemoveAt(0)
- b = b + 1
- Loop
- End If
- End If
- End Sub
- Private Sub PictureBox2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox2.Click
- tambah()
- End Sub
- Private Sub dgdetail_RowsAdded(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewRowsAddedEventArgs) Handles dgdetail.RowsAdded
- total()
- End Sub
- Private Sub txtkdk_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtkdk.TextChanged
- End Sub
- Private Sub txtpnjm_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtpnjm.TextChanged
- If txtpnjm.Text = "" Then
- Else
- If IsNumeric(txtpnjm.Text) Then
- Else
- KryptonMessageBox.Show("Inputan hanya berupa angka", "Perhatian", MessageBoxButtons.OK, MessageBoxIcon.Information)
- txtpnjm.Text = ""
- txtpnjm.Focus()
- End If
- End If
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement