Toshiba_Kanban_Issuance/.svn/pristine/3f/3ffcc0fff8a70708deeedde182fab8609f39b811.svn-base

125 lines
4.5 KiB
Plaintext

Public Class issuanceForm
Private isUpdate = False
Private Sub txtSerial_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtSerial.KeyPress
If Asc(e.KeyChar) = 13 Then
Dim parts = New PartsRecords(txtSerial.Text)
If parts.Exist Then
txtPN.Text = parts.IonicsPN
txtDesc.Text = parts.Description
txtLot.Text = parts.LotNo
txtBox.Text = parts.Rack
txtQuantity.Text = parts.Quantity
lblStatus.Text = parts.Status
lblMFGDate.Text = parts.MFGDate
lblRCVDate.Text = parts.RCVDate
lblPDate.Text = parts.PrintedDate
lblBy.Text = parts.PrintedBy
cmbStatus.SelectedItem = parts.Status
enable()
If parts.Status <> "WHS" And parts.Status <> "LST" Then
btnIssue.Enabled = False
btnUpdate.Enabled = False
ElseIf parts.Status = "LST" Then
btnIssue.Enabled = False
End If
If parts.Remarks <> "" Then
txtRemarks.Text = parts.Remarks
Else
txtRemarks.Text = "N/A"
End If
Else
MessageBox.Show("Item not found.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End If
End If
End Sub
Public Sub enable()
btnIssue.Enabled = True
btnReset.Enabled = True
btnUpdate.Enabled = True
End Sub
Public Sub reset()
txtSerial.Text = Nothing
txtPN.Text = Nothing
txtDesc.Text = Nothing
txtLot.Text = Nothing
txtBox.Text = Nothing
txtQuantity.Text = Nothing
txtRemarks.ReadOnly = True
txtRemarks.Text = Nothing
cmbStatus.SelectedText = Nothing
cmbStatus.Text = Nothing
cmbStatus.Enabled = False
lblStatus.Text = Nothing
lblMFGDate.Text = Nothing
lblRCVDate.Text = Nothing
lblPDate.Text = Nothing
lblBy.Text = Nothing
btnIssue.Enabled = False
btnReset.Enabled = False
isUpdate = False
btnUpdate.Text = "Update"
btnUpdate.Enabled = False
End Sub
Public Sub updatemode()
txtRemarks.ReadOnly = False
cmbStatus.Enabled = True
btnUpdate.Text = "Save"
btnIssue.Enabled = False
isUpdate = True
End Sub
Private Sub issuanceForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.MdiParent = mainForm
Control.CheckForIllegalCrossThreadCalls = False
If loginForm.userType = "Supervisor" Then
btnUpdate.Visible = True
Else
btnUpdate.Visible = False
End If
End Sub
Private Sub btnReset_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnReset.Click
reset()
End Sub
Private Sub btnIssue_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnIssue.Click
Dim parts As New PartsRecords
If Not parts.issue(txtSerial.Text, txtPN.Text, DateTime.Parse(lblMFGDate.Text)) Then
If MessageBox.Show("There are older items are you sure you want to continue?", "Error", MessageBoxButtons.YesNo, MessageBoxIcon.Error) = Windows.Forms.DialogResult.Yes Then
parts.issue2(txtSerial.Text, txtPN.Text, DateTime.Parse(lblMFGDate.Text))
reset()
End If
Else
reset()
End If
End Sub
Private Sub btnUpdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUpdate.Click
If isUpdate Then
Dim parts As New PartsRecords
If cmbStatus.SelectedItem = "LST" And (txtRemarks.Text = "N/A" Or txtRemarks.Text = "") Then
MessageBox.Show("Please provide proper remarks.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
Else
If parts.updateStatus(txtSerial.Text, cmbStatus.SelectedItem, txtRemarks.Text) Then
MessageBox.Show("Successfully Saved.", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information)
End If
reset()
End If
Else
updatemode()
End If
End Sub
Private Sub txtRemarks_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtRemarks.TextChanged
End Sub
End Class