1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- Public Class 合約編號修改器
- Private Sub 合約編號修改器_Load(sender As Object, e As EventArgs) Handles MyBase.Load
- End Sub
- Private Sub 合約編號修改器_Shown(sender As Object, e As EventArgs) Handles MyBase.Shown
- 合約編號_tb.Text = PA18 : 合約編號1_tb.Text = PA19 : 合約編號2_tb.Text = PA20 : 合約編號3_tb.Text = PA21
- If Strings.Left(PA18, 2) = "HX" Then : 合約編號_cb.Text = "HX" : ElseIf Strings.Left(PA18, 3) = "PGS" Then : 合約編號_cb.Text = "PGS" : Else : 合約編號_cb.Text = "" : End If
- End Sub
- Private Sub 合約編號修正_bt_Click(sender As Object, e As EventArgs) Handles 合約編號修正_bt.Click
- Dim 合約編號條件 As Boolean = True
- If 合約編號_cb.Text = "" Then : MsgBox("沒有選擇我方公司!!") : 合約編號條件 = False : End If
- If 合約編號1_tb.Text = "" Then : MsgBox("沒有甲方公司英文縮寫!!") : 合約編號條件 = False : Else
- Dim d As Int32
- For index = 0 To 合約編號1_tb.Text.Length - 1
- d = Asc(合約編號1_tb.Text(index))
- Dim 可能不行 As Boolean = False
- If (d < 65 Or d > 90) Then : 可能不行 = True : End If 'c變數若在65~90是大寫的英文字母
- If 可能不行 = True Then
- If (d < 97 Or d > 122) Then : 可能不行 = True : Else : 可能不行 = False : End If 'c變數若在97~122是小寫的英文字母
- If 可能不行 = True Then '然後查表, c變數若在48~57, 表示它是數字,
- If (d < 48 Or d > 57) Then : MsgBox("甲方公司需要英文或是數字不可中文或其他!!") : 合約編號條件 = False : Exit For : End If
- End If
- End If
- Next
- End If
- If 合約編號2_tb.Text = "" Then : MsgBox("沒有立約日期!!") : 合約編號條件 = False : End If
- Dim c As Int32 '然後查表, c變數若在48~57, 表示它是數字,
- For index = 0 To 合約編號2_tb.Text.Length - 1
- c = Asc(合約編號2_tb.Text(index))
- If c < 48 Or c > 57 Then : MsgBox("立約日期只能是數字!!") : 合約編號條件 = False : Exit For : Else
- If Len(合約編號2_tb.Text) <> 6 Then : MsgBox("立約日期的格式為YYMMDD (年兩位,月兩位,日兩位),數字規格不符!!") : 合約編號條件 = False : Exit For : End If
- End If
- Next
- If 合約編號3_tb.Text = "" Then : MsgBox("沒有合約序號!!") : 合約編號條件 = False
- ElseIf IsNumeric(合約編號3_tb.Text) = False Then : MsgBox("序號只能是數字!!") : 合約編號條件 = False
- End If
-
- If 合約編號條件 = False Then : Else
- PA17 = 合約編號_tb.Text : PA18 = 合約編號_cb.Text & "-" & 合約編號1_tb.Text & " " & 合約編號2_tb.Text & "-" & 合約編號3_tb.Text
- PA19 = 合約編號1_tb.Text : PA20 = 合約編號2_tb.Text : PA21 = 合約編號3_tb.Text : PA22 = 合約編號_cb.Text
- SQL_合約編號修改()
- Me.Close()
- End If
- End Sub
- End Class
|