Option Strict Off
Imports System.IO
Public Class 供應商商品單價設定
    Dim RI As Integer = -1
    Dim SK As String = "要查找的 KEY"
    Dim Str As String = Application.StartupPath
    Dim 物料規格, KKK2, 頁面 As String
    Dim NB1 As Integer
    Private ReadOnly 對話框(25) As String
    ReadOnly 群組碼(21) As String
    Private Sub Set_群組清單()
        Dim ds1 As New DataSet : 群組分類_dgv.DataSource = Nothing : ds1.Clear()
        群組分類_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
        群組分類_dgv.ColumnHeadersHeight = 25 : 群組分類_dgv.AllowUserToAddRows = False : 群組分類_dgv.RowTemplate.Height = 45
        SQL_物料群組() : da.Fill(ds1) : 群組分類_dgv.DataSource = ds1.Tables(0) : conn.Close() : 次項變形()
    End Sub
    Private Sub Set_清單1_1()
        Dim ds4 As New DataSet : 物料清單1_dgv.DataSource = Nothing : ds4.Clear()
        物料清單1_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
        物料清單1_dgv.ColumnHeadersHeight = 25 : 物料清單1_dgv.AllowUserToAddRows = False : 物料清單1_dgv.RowTemplate.Height = 45

        ConnOpen() : SQL_建築物料請購單申請_物料清單一() : CmdSet_For_DGV()
        da.Fill(ds4) : 物料清單1_dgv.DataSource = ds4.Tables(0) : conn.Close()
        物料清單1_dgv.Columns(0).FillWeight = 20 : 物料清單1_dgv.Columns(1).Visible = False : 物料清單1_dgv.Columns(2).FillWeight = 175
        物料清單1_dgv.Columns(4).Visible = False : 物料清單1_dgv.Columns(5).FillWeight = 45 : 物料清單1_dgv.Columns(3).Visible = False
        物料清單1_dgv.Columns(0).ReadOnly = True : 物料清單1_dgv.Columns(1).ReadOnly = True : 物料清單1_dgv.Columns(2).ReadOnly = True
        For i As Integer = 0 To 物料清單1_dgv.Rows.Count - 1 : 物料清單1_dgv(0, i).Value = i + 1 : Next
        If 低網速模式 = False Then
            物料清單1_dgv.Columns(6).FillWeight = 50 : 物料清單1_dgv.Columns(6).Visible = True
            Dim mycol As DataGridViewImageColumn = 物料清單1_dgv.Columns("圖檔")
            mycol.ImageLayout = DataGridViewImageCellLayout.Zoom
        Else : If 物料清單1_dgv.Columns.Count = 7 Then : 物料清單1_dgv.Columns(6).Visible = False : End If : End If
    End Sub
    Private Sub Set_歷史明細清單()
        Dim ds As New DataSet : 歷史明細_dgv.DataSource = Nothing : ds.Clear()
        歷史明細_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
        歷史明細_dgv.ColumnHeadersHeight = 25 : 歷史明細_dgv.AllowUserToAddRows = False
        PA = 供應商編碼_tb.Text : SQL_供應商商品_歷史採購清單()
        da.Fill(ds) : 歷史明細_dgv.DataSource = ds.Tables(0) : conn.Close()
        歷史明細_dgv.Columns(表頭(3)).DefaultCellStyle.Format = "#,##0" : 歷史明細_dgv.Columns(表頭(3)).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight
    End Sub
    Private Sub Set_明細清單()
        Dim ds As New DataSet : 明細_dgv.DataSource = Nothing : ds.Clear()
        明細_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
        明細_dgv.ColumnHeadersHeight = 40
        明細_dgv.AllowUserToAddRows = False

        If 小間距1_ch.Checked = False And 中間距1_ch.Checked = False And 大間距1_ch.Checked = True Then : 明細_dgv.RowTemplate.Height = 65
        ElseIf 小間距1_ch.Checked = False And 中間距1_ch.Checked = True And 大間距1_ch.Checked = False Then : 明細_dgv.RowTemplate.Height = 45
        ElseIf 小間距1_ch.Checked = True And 中間距1_ch.Checked = False And 大間距1_ch.Checked = False Then : 明細_dgv.RowTemplate.Height = 25 : End If

        PA = 供應商編碼_tb.Text : SQL_供應商商品_採購清單()
        da.Fill(ds) : 明細_dgv.DataSource = ds.Tables(0) : conn.Close()

        明細_dgv.Columns(0).FillWeight = 40 : 明細_dgv.Columns(1).FillWeight = 120 : 明細_dgv.Columns(2).FillWeight = 250 : 明細_dgv.Columns(3).FillWeight = 70
        明細_dgv.Columns(4).FillWeight = 100 : 明細_dgv.Columns(6).Visible = False : 明細_dgv.Columns(7).Visible = False : 明細_dgv.Columns(8).Visible = False
        明細_dgv.Columns(9).Visible = False : 明細_dgv.Columns(10).Visible = False : 明細_dgv.Columns(11).Visible = False : 明細_dgv.Columns(12).Visible = False
        明細_dgv.Columns(13).Visible = False : 明細_dgv.Columns(14).Visible = False : 明細_dgv.Columns(15).Visible = False : 明細_dgv.Columns(16).Visible = False
        明細_dgv.Columns(17).Visible = False : 明細_dgv.Columns(18).Visible = False : 明細_dgv.Columns(19).Visible = False : 明細_dgv.Columns(20).Visible = False
        明細_dgv.Columns(21).Visible = False : 明細_dgv.Columns(5).Visible = False : 明細_dgv.Columns(22).FillWeight = 70 : 明細_dgv.Columns(23).Visible = False
        明細_dgv.Columns(24).Visible = False : 明細_dgv.Columns(25).FillWeight = 30
        明細_dgv.Columns(表頭(3)).DefaultCellStyle.Format = "#,##0" : 明細_dgv.Columns(表頭(3)).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight
        明細_dgv.Columns(0).ReadOnly = True : 明細_dgv.Columns(1).ReadOnly = True : 明細_dgv.Columns(2).ReadOnly = True : 明細_dgv.Columns(表頭(5)).ReadOnly = True
        明細_dgv.EditMode = DataGridViewEditMode.EditOnEnter
        If 低網速模式 = False Then
            明細_dgv.Columns("Image").FillWeight = 80 : 明細_dgv.Columns("Image").Visible = True
            Dim mycol As DataGridViewImageColumn = 明細_dgv.Columns("Image")
            mycol.ImageLayout = DataGridViewImageCellLayout.Zoom
        Else : If 明細_dgv.Columns.Count = 25 Then : 明細_dgv.Columns("Image").Visible = False : End If : End If

        For i As Integer = 0 To 明細_dgv.Rows.Count - 1
            If IsDBNull(明細_dgv.Rows(i).Cells(25).Value) Then : 明細_dgv.Rows(i).Cells(25).Value = False : End If
            明細_dgv.Rows(i).Cells(表頭(0)).Value = i + 1
            If 明細_dgv.Rows(i).Cells(表頭(1)).Value.ToString <> "" Then
                Dim ZA1, ZA2, ZA3, ZA4, ZA5, ZA6, ZA7, ZA8 As String : 物料規格 = ""
                If 明細_dgv.Rows(i).Cells("A1").Value.ToString <> "" Then : ZA1 = 明細_dgv.Rows(i).Cells("A1").Value.ToString : 物料規格 = ZA1 : End If
                If 明細_dgv.Rows(i).Cells("A2").Value.ToString <> "" Then
                    ZA2 = 明細_dgv.Rows(i).Cells("A2").Value : If 物料規格 = "" Then : 物料規格 = ZA2 : Else : 物料規格 = 物料規格 + "、" + ZA2 : End If : End If
                If 明細_dgv.Rows(i).Cells("A3").Value.ToString <> "" Then
                    ZA3 = 明細_dgv.Rows(i).Cells("A3").Value : If 物料規格 = "" Then : 物料規格 = ZA3 : Else : 物料規格 = 物料規格 + "、" + ZA3 : End If : End If
                If 明細_dgv.Rows(i).Cells("A4").Value.ToString <> "" Then
                    ZA4 = 明細_dgv.Rows(i).Cells("A4").Value : If 物料規格 = "" Then : 物料規格 = ZA4 : Else : 物料規格 = 物料規格 + "、" + ZA4 : End If : End If
                If 明細_dgv.Rows(i).Cells("A5").Value.ToString <> "" Then
                    ZA5 = 明細_dgv.Rows(i).Cells("A5").Value : If 物料規格 = "" Then : 物料規格 = ZA5 : Else : 物料規格 = 物料規格 + "、" + ZA5 : End If : End If
                If 明細_dgv.Rows(i).Cells("A6").Value.ToString <> "" Then
                    ZA6 = 明細_dgv.Rows(i).Cells("A6").Value : If 物料規格 = "" Then : 物料規格 = ZA6 : Else : 物料規格 = 物料規格 + "、" + ZA6 : End If : End If
                If 明細_dgv.Rows(i).Cells("A7").Value.ToString <> "" Then
                    ZA7 = 明細_dgv.Rows(i).Cells("A7").Value : If 物料規格 = "" Then : 物料規格 = ZA7 : Else : 物料規格 = 物料規格 + "、" + ZA7 : End If : End If
                If 明細_dgv.Rows(i).Cells("A8").Value.ToString <> "" Then
                    ZA8 = 明細_dgv.Rows(i).Cells("A8").Value : If 物料規格 = "" Then : 物料規格 = ZA8 : Else : 物料規格 = 物料規格 + "、" + ZA8 : End If : End If

                If 明細_dgv.Rows(i).Cells(表頭(1)).Value.ToString <> "" Then
                    明細_dgv.Rows(i).Cells(表頭(2)).Value = 明細_dgv.Rows(i).Cells(表頭(2)).Value.ToString & " " & 物料規格
                End If
            End If
        Next
    End Sub
    Private Sub Set_清單1()
        PA1 = 群組碼_tb.Text
        Dim ds4 As New DataSet : 物料清單_dgv.DataSource = Nothing : ds4.Clear()
        物料清單_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
        物料清單_dgv.ColumnHeadersHeight = 25 : 物料清單_dgv.AllowUserToAddRows = False
        If 小間距_ch.Checked = False And 中間距_ch.Checked = False And 大間距_ch.Checked = True Then : 物料清單_dgv.RowTemplate.Height = 65
        ElseIf 小間距_ch.Checked = False And 中間距_ch.Checked = True And 大間距_ch.Checked = False Then : 物料清單_dgv.RowTemplate.Height = 45
        ElseIf 小間距_ch.Checked = True And 中間距_ch.Checked = False And 大間距_ch.Checked = False Then : 物料清單_dgv.RowTemplate.Height = 25 : End If
        表頭(16) = "單位."
        ConnOpen() : SQL_建築物料請購單申請_物料清單一() : CmdSet_For_DGV()

        da.Fill(ds4) : 物料清單_dgv.DataSource = ds4.Tables(0) : conn.Close()
        物料清單_dgv.Columns(0).Visible = False : 物料清單_dgv.Columns(1).FillWeight = 80 : 物料清單_dgv.Columns(2).FillWeight = 175 : 物料清單_dgv.Columns(3).Visible = False
        物料清單_dgv.Columns(4).Visible = False : 物料清單_dgv.Columns(5).FillWeight = 45
        物料清單_dgv.Columns(0).ReadOnly = True : 物料清單_dgv.Columns(1).ReadOnly = True : 物料清單_dgv.Columns(2).ReadOnly = True
        For i As Integer = 0 To 物料清單_dgv.Rows.Count - 1 : 物料清單_dgv(0, i).Value = i + 1 : Next
        If 低網速模式 = False Then
            物料清單_dgv.Columns(6).FillWeight = 50 : 物料清單_dgv.Columns(6).Visible = True
            Dim mycol As DataGridViewImageColumn = 物料清單_dgv.Columns("圖檔")
            mycol.ImageLayout = DataGridViewImageCellLayout.Zoom
        Else : If 物料清單_dgv.Columns.Count = 7 Then : 物料清單_dgv.Columns(6).Visible = False : End If : End If
    End Sub
    Private Sub Set_語言()
        語言_dgv.DataSource = Nothing
        語言_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
        語言_dgv.ColumnHeadersHeight = 25
        語言_dgv.AllowUserToAddRows = False
        For i As Integer = 0 To 語言_dgv.Rows.Count - 1 : 語言_dgv.Rows.RemoveAt(0) : Next
        If File.Exists(Str + "\LANGUAGE_FILE.csv") Then
            Dim filereader = My.Computer.FileSystem.OpenTextFileReader(Str + "\LANGUAGE_FILE.csv", System.Text.Encoding.Default)
            Dim line As String = filereader.ReadLine()
            While Not (line Is Nothing)
                line = filereader.ReadLine()
                If line <> Nothing Then
                    line = line.Replace("""", "")
                    If Strings.Left(line, 4) = "G000" Or Strings.Left(line, 8) = "H001-157" Or Strings.Left(line, 8) = "H610-102" Or Strings.Left(line, 8) = "H610-103" Or
                       Strings.Left(line, 8) = "H110-117" Or Strings.Left(line, 8) = "H212-103" Or Strings.Left(line, 4) = "H204" Or Strings.Left(line, 4) = 介面 Then
                        If 系統語言 = "繁體中文" Then
                            If Strings.Mid(line, 10, 2) = "CH" Then : 語言_dgv.Rows.Insert(0)
                                語言_dgv.Rows(0).Cells(0).Value = Strings.Left(line, 11)
                                If Strings.Mid(line, 13, 300).EndsWith(",") Then
                                    語言_dgv.Rows(0).Cells(1).Value = Strings.Mid(line, 13, 300).Substring(0, Strings.Mid(line, 13, 300).Length - 1)
                                Else : 語言_dgv.Rows(0).Cells(1).Value = Strings.Mid(line, 13, 300) : End If
                            End If
                        ElseIf 系統語言 = "English" Then
                            If Strings.Mid(line, 10, 2) = "EN" Then : 語言_dgv.Rows.Insert(0)
                                語言_dgv.Rows(0).Cells(0).Value = Strings.Left(line, 11)
                                If Strings.Mid(line, 13, 300).EndsWith(",") Then
                                    語言_dgv.Rows(0).Cells(1).Value = Strings.Mid(line, 13, 300).Substring(0, Strings.Mid(line, 13, 300).Length - 1)
                                Else : 語言_dgv.Rows(0).Cells(1).Value = Strings.Mid(line, 13, 300) : End If
                            End If
                        ElseIf 系統語言 = "Indonesian" Then
                            If Strings.Mid(line, 10, 2) = "IN" Then : 語言_dgv.Rows.Insert(0)
                                語言_dgv.Rows(0).Cells(0).Value = Strings.Left(line, 11)
                                If Strings.Mid(line, 13, 300).EndsWith(",") Then
                                    語言_dgv.Rows(0).Cells(1).Value = Strings.Mid(line, 13, 300).Substring(0, Strings.Mid(line, 13, 300).Length - 1)
                                Else : 語言_dgv.Rows(0).Cells(1).Value = Strings.Mid(line, 13, 300) : End If
                            End If
                        End If
                    End If
                End If
            End While
            filereader.Close()
        End If
    End Sub
    Private Sub Set_語言查詢()
        RI = -1 : For Each row As DataGridViewRow In 語言_dgv.Rows
            If Strings.Left(row.Cells(0).Value.ToString(), 8) = SK Then
                RI = row.Index : Exit For
            End If
        Next
    End Sub
    Private Sub 語言轉換讀取()
        Set_語言()
        SK = "H001-157" : Set_語言查詢() : Me.Text = 語言_dgv(1, RI).Value.ToString : SK = "G000-108" : Set_語言查詢() : ToolTip1.ToolTipTitle = 語言_dgv(1, RI).Value.ToString
        SK = "H212-100" : Set_語言查詢() : 料號_lb.Text = 語言_dgv(1, RI).Value.ToString : SK = "H212-101" : Set_語言查詢() : 群組編碼_lb.Text = 語言_dgv(1, RI).Value.ToString
        SK = "G000-176" : Set_語言查詢() : 切換_lb.Text = 語言_dgv(1, RI).Value.ToString : SK = "H204-124" : Set_語言查詢() : 表頭(16) = 語言_dgv(1, RI).Value.ToString
        SK = "H204-125" : Set_語言查詢() : 表頭(0) = 語言_dgv(1, RI).Value.ToString : SK = "H204-110" : Set_語言查詢() : 表頭(1) = 語言_dgv(1, RI).Value.ToString
        SK = "H204-121" : Set_語言查詢() : 表頭(2) = 語言_dgv(1, RI).Value.ToString : SK = "H204-114" : Set_語言查詢() : 表頭(3) = 語言_dgv(1, RI).Value.ToString
        SK = "H204-123" : Set_語言查詢() : 表頭(4) = 語言_dgv(1, RI).Value.ToString : SK = "G000-177" : Set_語言查詢() : 表頭(5) = 語言_dgv(1, RI).Value.ToString
        SK = "G000-178" : Set_語言查詢() : 表頭(6) = 語言_dgv(1, RI).Value.ToString : SK = "G000-179" : Set_語言查詢() : 表頭(7) = 語言_dgv(1, RI).Value.ToString
        SK = "G000-180" : Set_語言查詢() : 對話框(0) = 語言_dgv(1, RI).Value.ToString : SK = "G000-118" : Set_語言查詢() : 對話框(1) = 語言_dgv(1, RI).Value.ToString
        SK = "H610-102" : Set_語言查詢() : 對話框(2) = 語言_dgv(1, RI).Value.ToString : SK = "H610-103" : Set_語言查詢() : 對話框(3) = 語言_dgv(1, RI).Value.ToString
        SK = "G000-119" : Set_語言查詢() : 對話框(4) = 語言_dgv(1, RI).Value.ToString : SK = "G000-181" : Set_語言查詢() : 對話框(5) = 語言_dgv(1, RI).Value.ToString
        SK = "G000-182" : Set_語言查詢() : 對話框(6) = 語言_dgv(1, RI).Value.ToString : SK = "G000-120" : Set_語言查詢() : 對話框(7) = 語言_dgv(1, RI).Value.ToString
        SK = "H212-102" : Set_語言查詢() : 對話框(8) = 語言_dgv(1, RI).Value.ToString : SK = "H212-103" : Set_語言查詢() : 對話框(9) = 語言_dgv(1, RI).Value.ToString
        SK = "G000-110" : Set_語言查詢() : 對話框(10) = 語言_dgv(1, RI).Value.ToString : SK = "H212-104" : Set_語言查詢() : 對話框(11) = 語言_dgv(1, RI).Value.ToString
        SK = "G000-112" : Set_語言查詢() : 對話框(12) = 語言_dgv(1, RI).Value.ToString : SK = "G000-183" : Set_語言查詢() : 對話框(13) = 語言_dgv(1, RI).Value.ToString
        SK = "G000-184" : Set_語言查詢() : 對話框(14) = 語言_dgv(1, RI).Value.ToString : SK = "G000-185" : Set_語言查詢() : 對話框(15) = 語言_dgv(1, RI).Value.ToString
        SK = "G000-186" : Set_語言查詢() : 對話框(16) = 語言_dgv(1, RI).Value.ToString : SK = "G000-187" : Set_語言查詢() : 對話框(17) = 語言_dgv(1, RI).Value.ToString
        SK = "G000-188" : Set_語言查詢() : 對話框(18) = 語言_dgv(1, RI).Value.ToString : SK = "G000-189" : Set_語言查詢() : 對話框(19) = 語言_dgv(1, RI).Value.ToString
        SK = "G000-190" : Set_語言查詢() : 對話框(20) = 語言_dgv(1, RI).Value.ToString : SK = "G000-191" : Set_語言查詢() : 對話框(21) = 語言_dgv(1, RI).Value.ToString
        SK = "G000-192" : Set_語言查詢() : 對話框(22) = 語言_dgv(1, RI).Value.ToString : SK = "G000-193" : Set_語言查詢() : 對話框(23) = 語言_dgv(1, RI).Value.ToString
        SK = "G000-194" : Set_語言查詢() : 對話框(24) = 語言_dgv(1, RI).Value.ToString : SK = "H110-117" : Set_語言查詢() : 對話框(25) = 語言_dgv(1, RI).Value.ToString
    End Sub
    Private Sub 批量比對_bt_MouseEnter(sender As Object, e As EventArgs) Handles 批量比對_bt.MouseEnter
        ToolTip1.SetToolTip(Me.批量比對_bt, 對話框(8))
    End Sub
    Private Sub 比對新增_bt_MouseEnter(sender As Object, e As EventArgs) Handles 比對新增_bt.MouseEnter
        ToolTip1.SetToolTip(Me.比對新增_bt, 對話框(9))
    End Sub
    Private Sub 存檔_tb_MouseEnter(sender As Object, e As EventArgs) Handles 存檔_tb.MouseEnter
        ToolTip1.SetToolTip(Me.存檔_tb, 對話框(10))
    End Sub
    Private Sub 物料加入_bt_MouseEnter(sender As Object, e As EventArgs) Handles 物料加入_bt.MouseEnter
        ToolTip1.SetToolTip(Me.物料加入_bt, 對話框(11))
    End Sub
    Private Sub 刪除_bt_MouseEnter(sender As Object, e As EventArgs) Handles 刪除_bt.MouseEnter
        ToolTip1.SetToolTip(Me.刪除_bt, 對話框(12))
    End Sub
    Private Sub 回首頁_bt_MouseEnter(sender As Object, e As EventArgs) Handles 回首頁_bt.MouseEnter
        ToolTip1.SetToolTip(Me.回首頁_bt, 對話框(13))
    End Sub
    Private Sub 回次頁_bt_MouseEnter(sender As Object, e As EventArgs) Handles 回次頁_bt.MouseEnter
        ToolTip1.SetToolTip(Me.回次頁_bt, 對話框(14))
    End Sub
    Private Sub 管材_bt_MouseEnter(sender As Object, e As EventArgs) Handles 管材_bt.MouseEnter
        ToolTip1.SetToolTip(Me.管材_bt, 對話框(15))
    End Sub
    Private Sub 電線_bt_MouseEnter(sender As Object, e As EventArgs) Handles 電線_bt.MouseEnter
        ToolTip1.SetToolTip(Me.電線_bt, 對話框(16))
    End Sub
    Private Sub 電料_bt_MouseEnter(sender As Object, e As EventArgs) Handles 電料_bt.MouseEnter
        ToolTip1.SetToolTip(Me.電料_bt, 對話框(17))
    End Sub
    Private Sub 槽架_bt_MouseEnter(sender As Object, e As EventArgs) Handles 槽架_bt.MouseEnter
        ToolTip1.SetToolTip(Me.槽架_bt, 對話框(18))
    End Sub
    Private Sub 建材_bt_MouseEnter(sender As Object, e As EventArgs) Handles 建材_bt.MouseEnter
        ToolTip1.SetToolTip(Me.建材_bt, 對話框(19))
    End Sub
    Private Sub 五金_bt_MouseEnter(sender As Object, e As EventArgs) Handles 五金_bt.MouseEnter
        ToolTip1.SetToolTip(Me.五金_bt, 對話框(20))
    End Sub
    Private Sub 設備_bt_MouseEnter(sender As Object, e As EventArgs) Handles 設備_bt.MouseEnter
        ToolTip1.SetToolTip(Me.設備_bt, 對話框(21))
    End Sub
    Private Sub 工具_bt_MouseEnter(sender As Object, e As EventArgs) Handles 工具_bt.MouseEnter
        ToolTip1.SetToolTip(Me.工具_bt, 對話框(22))
    End Sub
    Private Sub 日用_bt_MouseEnter(sender As Object, e As EventArgs) Handles 日用_bt.MouseEnter
        ToolTip1.SetToolTip(Me.日用_bt, 對話框(23))
    End Sub
    Private Sub 其他_bt_MouseEnter(sender As Object, e As EventArgs) Handles 其他_bt.MouseEnter
        ToolTip1.SetToolTip(Me.其他_bt, 對話框(24))
    End Sub
    Private Sub 搜尋1_bt_MouseEnter(sender As Object, e As EventArgs) Handles 搜尋1_bt.MouseEnter
        ToolTip1.SetToolTip(Me.搜尋1_bt, 對話框(25))
    End Sub
    Private Sub 搜尋_bt_MouseEnter(sender As Object, e As EventArgs) Handles 搜尋_bt.MouseEnter
        ToolTip1.SetToolTip(Me.搜尋_bt, 對話框(25))
    End Sub
    Private Sub 類別管理_cb_下拉表單資料載入()
        SQL_供應商類別_下拉清單() : 類別管理_cb.Items.Clear() : 類別管理_cb.Items.Add("") : While (dr.Read()) : 類別管理_cb.Items.Add(dr("類別")) : End While : conn.Close()
    End Sub
    Private Sub 廠商_cb_下拉表單資料載入()
        SQL_供應商資料表_公司名_下拉用() : 廠商_cb.Items.Clear() : While (dr.Read()) : 廠商_cb.Items.Add(dr("公司名")) : End While : conn.Close()
    End Sub
    Private Sub 群組碼_cb_語轉_下拉表單資料載入()
        SQL_群組碼_語轉_下拉清單() : 新群組1_cb.Items.Clear() : While (dr.Read()) : 新群組1_cb.Items.Add(dr("群組")) : End While : conn.Close()
    End Sub
    Private Sub 群組編碼_cb_下拉表單資料載入()
        SQL_群組碼_下拉清單() : 群組編碼_cb.Items.Clear() : While (dr.Read()) : 群組編碼_cb.Items.Add(dr("群組碼")) : End While : conn.Close()
    End Sub
    Private Sub 供應商商品清單_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Me.MdiParent = HX_PGS_ERP_SYS : Me.WindowState = 2 : Me.AutoScroll = True
        H(212) = True : 介面 = "H212" : 語言轉換讀取() : 顯示說明(999, False)

        中間距_ch.Checked = True : 中間距1_ch.Checked = True : 首次開啟 = False : Panel1.SendToBack() : 主頁_p.BringToFront()
        切換_ts.Checked = True : Panel3.Visible = True : Panel2.Visible = False

        供應商商品清單_Size()
    End Sub
    Private Sub 供應商商品清單_Shown(sender As Object, e As EventArgs) Handles MyBase.Shown
        類別管理_cb_下拉表單資料載入() : PA = 供應商簡稱_tb.Text : 廠商_cb_下拉表單資料載入()
        群組碼_cb_語轉_下拉表單資料載入() : 群組編碼_cb_下拉表單資料載入() ': 新群組1_cb.SelectedIndex = 0
    End Sub
    Private Sub 供應商商品清單_SizeChanged(sender As Object, e As EventArgs) Handles MyBase.SizeChanged
        供應商商品清單_Size()
    End Sub
    Private Sub 供應商商品清單_Size()
        MyMod.清單字體大小調整()
        物料清單_dgv.RowsDefaultCellStyle.Font = New System.Drawing.Font("微軟正黑體", HX_PGS_ERP_SYS.字體_NUD.Value)
        物料規格_dgv.RowsDefaultCellStyle.Font = New System.Drawing.Font("微軟正黑體", HX_PGS_ERP_SYS.字體_NUD.Value)
        明細_dgv.RowsDefaultCellStyle.Font = New System.Drawing.Font("微軟正黑體", HX_PGS_ERP_SYS.字體_NUD.Value)
        歷史明細_dgv.RowsDefaultCellStyle.Font = New System.Drawing.Font("微軟正黑體", HX_PGS_ERP_SYS.字體_NUD.Value)
        物料清單1_dgv.RowsDefaultCellStyle.Font = New System.Drawing.Font("微軟正黑體", HX_PGS_ERP_SYS.字體_NUD.Value)
        物料規格1_dgv.RowsDefaultCellStyle.Font = New System.Drawing.Font("微軟正黑體", HX_PGS_ERP_SYS.字體_NUD.Value)
    End Sub
    Private Sub 供應商商品清單_Closed(sender As Object, e As EventArgs) Handles MyBase.Closed
        MyMod.虛擬桌面開啟()
    End Sub
    Private Sub 登入閒置控制_MouseMove(sender As Object, e As EventArgs) Handles MyBase.MouseMove
        timeNow = 0 : HX_PGS_ERP_SYS.Timer1.Enabled = False : HX_PGS_ERP_SYS.Timer1.Enabled = True
    End Sub
    Private Sub 登入閒置控制_KeyPress(sender As Object, e As EventArgs) Handles MyBase.KeyPress
        timeNow = 0 : HX_PGS_ERP_SYS.Timer1.Enabled = False : HX_PGS_ERP_SYS.Timer1.Enabled = True
    End Sub
    Private Sub 語轉扭_bt_Click(sender As Object, e As EventArgs) Handles 語轉扭_bt.Click
        介面 = "H212" : 語言轉換讀取() : If 切換_ts.Checked = False Then : Else : 回首頁_bt.PerformClick() : End If
        群組碼_cb_語轉_下拉表單資料載入() : 類別管理_cb_下拉表單資料載入()
    End Sub
    Private Sub 明細_dgv_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles 明細_dgv.MouseUp
        If 明細_dgv.SelectedCells.Count > 0 Then
            If 明細_dgv.SelectedCells(0).ColumnIndex = 25 Then
                If 明細_dgv.Rows(明細_dgv.SelectedCells(0).RowIndex).Cells(25).Value = False Then
                    明細_dgv.Rows(明細_dgv.SelectedCells(0).RowIndex).Cells(25).Value = True
                Else
                    明細_dgv.Rows(明細_dgv.SelectedCells(0).RowIndex).Cells(25).Value = False
                End If : 明細_dgv.CurrentCell = 明細_dgv.Rows(明細_dgv.SelectedCells(0).RowIndex).Cells(0)
            End If
        End If
    End Sub
    Private Sub 明細_dgv_CellClick(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles 明細_dgv.CellClick
        If e.RowIndex = -1 Then : Else
            PA1 = 明細_dgv.Rows(e.RowIndex).Cells("群組碼").Value.ToString : PA2 = 明細_dgv.Rows(e.RowIndex).Cells("料號原則").Value.ToString
            料號1_tb.Text = 明細_dgv.Rows(e.RowIndex).Cells(表頭(1)).Value.ToString : 物料圖_pb.Image = Nothing
            SQL_物料圖庫_圖檔讀取()
            While dr.Read() = True
                Dim unused As Byte() = New Byte(-1) {}
                Dim bytes As Byte() = DirectCast(dr.Item("圖檔"), Byte())
                Dim oStream As New MemoryStream(bytes)
                物料圖_pb.Image = Bitmap.FromStream(oStream)
            End While : conn.Close() : 物料圖_pb.SizeMode = 4
        End If
    End Sub
    Private Sub 物料清單_dgv_CellClick(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles 物料清單_dgv.CellClick
        If e.RowIndex = -1 Then : Else
            PA = 物料清單_dgv(1, e.RowIndex).Value.ToString : PA1 = 物料清單_dgv.Rows(e.RowIndex).Cells("群組碼").Value : PA2 = 物料清單_dgv.Rows(e.RowIndex).Cells("料號原則").Value
            SQL_物料圖庫_圖檔讀取()
            While dr.Read() = True
                Dim unused As Byte() = New Byte(-1) {}
                Dim bytes As Byte() = DirectCast(dr.Item("圖檔"), Byte())
                Dim oStream As New MemoryStream(bytes)
                物料圖_pb.Image = Bitmap.FromStream(oStream)
            End While : conn.Close() : 物料圖_pb.SizeMode = 4
            '------------------------------------------------------------------------------------------------------------------------------------------
            SQL_建築物料請購單申請_物料規格讀取()
            If dr.Read() Then : KKK2 = dr("規格庫編號") : PA3 = dr("規格庫抬頭指定") : PA4 = dr("群組碼") : End If : conn.Close()
            '------------------------------------------------------------------------------------------------------------------------------------------
            SQL_規格庫抬頭讀取()
            If dr.Read() Then : AAA1 = dr("A1") : AAA2 = dr("A2") : AAA3 = dr("A3") : AAA4 = dr("A4") : AAA5 = dr("A5") : AAA6 = dr("A6") : AAA7 = dr("A7") : AAA8 = dr("A8") : End If
            conn.Close()
            '------------------------------------------------------------------------------------------------------------------------------------------
            Dim ds3 As New DataSet : 物料規格_dgv.DataSource = Nothing : ds3.Clear()
            物料規格_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
            物料規格_dgv.ColumnHeadersHeight = 25 : 物料規格_dgv.AllowUserToAddRows = False : 物料規格_dgv.RowTemplate.Height = 20
            If KKK2 = "SQLB03" Then : SQL_物料規格_SQLB03()
            ElseIf KKK2 = "SQLB04" Then : SQL_物料規格_SQLB04()
            ElseIf KKK2 = "SQLB05" Then : SQL_物料規格_SQLB05()
            ElseIf KKK2 = "SQLB06" Then : SQL_物料規格_SQLB06()
            ElseIf KKK2 = "SQLB07" Then : SQL_物料規格_SQLB07()
            ElseIf KKK2 = "SQLB08" Then : SQL_物料規格_SQLB08() : End If
            da.Fill(ds3) : 物料規格_dgv.DataSource = ds3.Tables(0) : conn.Close() : 料號_tb.Text = ""

            物料規格_dgv.Columns(0).Visible = False : 物料規格_dgv.Columns(1).Visible = False : 物料規格_dgv.Columns(3).Visible = False
            物料規格_dgv.Columns(2).Width = 17 : 物料規格_dgv.Columns(12).Visible = False : 物料規格_dgv.Columns(13).Visible = False : 物料規格_dgv.Columns(14).Visible = False
            物料規格_dgv.Columns(15).Visible = False
            If KKK2 = "SQLB03" Then
                物料規格_dgv.Columns(7).Visible = False : 物料規格_dgv.Columns(8).Visible = False : 物料規格_dgv.Columns(9).Visible = False : 物料規格_dgv.Columns(10).Visible = False
                物料規格_dgv.Columns(11).Visible = False
                物料規格_dgv.Columns(4).FillWeight = 213 : 物料規格_dgv.Columns(5).FillWeight = 213 : 物料規格_dgv.Columns(6).FillWeight = 214
            ElseIf KKK2 = "SQLB04" Then
                物料規格_dgv.Columns(7).Visible = True : 物料規格_dgv.Columns(8).Visible = False : 物料規格_dgv.Columns(9).Visible = False : 物料規格_dgv.Columns(10).Visible = False
                物料規格_dgv.Columns(11).Visible = False
                物料規格_dgv.Columns(4).FillWeight = 160 : 物料規格_dgv.Columns(5).FillWeight = 160 : 物料規格_dgv.Columns(6).FillWeight = 160 : 物料規格_dgv.Columns(7).FillWeight = 160
            ElseIf KKK2 = "SQLB05" Then
                物料規格_dgv.Columns(7).Visible = True : 物料規格_dgv.Columns(8).Visible = True : 物料規格_dgv.Columns(9).Visible = False : 物料規格_dgv.Columns(10).Visible = False
                物料規格_dgv.Columns(11).Visible = False
                物料規格_dgv.Columns(4).FillWeight = 128 : 物料規格_dgv.Columns(5).FillWeight = 128 : 物料規格_dgv.Columns(6).FillWeight = 128 : 物料規格_dgv.Columns(7).FillWeight = 128
                物料規格_dgv.Columns(8).FillWeight = 128
            ElseIf KKK2 = "SQLB06" Then
                物料規格_dgv.Columns(7).Visible = True : 物料規格_dgv.Columns(8).Visible = True : 物料規格_dgv.Columns(9).Visible = True : 物料規格_dgv.Columns(10).Visible = False
                物料規格_dgv.Columns(11).Visible = False
                物料規格_dgv.Columns(4).FillWeight = 106 : 物料規格_dgv.Columns(5).FillWeight = 107 : 物料規格_dgv.Columns(6).FillWeight = 106 : 物料規格_dgv.Columns(7).FillWeight = 107
                物料規格_dgv.Columns(8).FillWeight = 106 : 物料規格_dgv.Columns(9).FillWeight = 108
            ElseIf KKK2 = "SQLB07" Then
                物料規格_dgv.Columns(7).Visible = True : 物料規格_dgv.Columns(8).Visible = True : 物料規格_dgv.Columns(9).Visible = True : 物料規格_dgv.Columns(10).Visible = True
                物料規格_dgv.Columns(11).Visible = False
                物料規格_dgv.Columns(4).FillWeight = 91 : 物料規格_dgv.Columns(5).FillWeight = 92 : 物料規格_dgv.Columns(6).FillWeight = 91 : 物料規格_dgv.Columns(7).FillWeight = 92
                物料規格_dgv.Columns(8).FillWeight = 91 : 物料規格_dgv.Columns(9).FillWeight = 92 : 物料規格_dgv.Columns(10).FillWeight = 91
            ElseIf KKK2 = "SQLB08" Then
                物料規格_dgv.Columns(7).Visible = True : 物料規格_dgv.Columns(8).Visible = True : 物料規格_dgv.Columns(9).Visible = True : 物料規格_dgv.Columns(10).Visible = True
                物料規格_dgv.Columns(11).Visible = True
                物料規格_dgv.Columns(4).FillWeight = 80 : 物料規格_dgv.Columns(5).FillWeight = 80 : 物料規格_dgv.Columns(6).FillWeight = 80 : 物料規格_dgv.Columns(7).FillWeight = 80
                物料規格_dgv.Columns(8).FillWeight = 80 : 物料規格_dgv.Columns(9).FillWeight = 80 : 物料規格_dgv.Columns(10).FillWeight = 80 : 物料規格_dgv.Columns(11).FillWeight = 80
            End If
            物料規格_dgv.EditMode = DataGridViewEditMode.EditOnEnter
            物料規格_dgv.Columns(0).ReadOnly = True : 物料規格_dgv.Columns(1).ReadOnly = True : 物料規格_dgv.Columns(2).ReadOnly = True : 物料規格_dgv.Columns(3).ReadOnly = True
            物料規格_dgv.Columns(4).ReadOnly = True : 物料規格_dgv.Columns(5).ReadOnly = True : 物料規格_dgv.Columns(6).ReadOnly = True : 物料規格_dgv.Columns(7).ReadOnly = True
            物料規格_dgv.Columns(8).ReadOnly = True : 物料規格_dgv.Columns(9).ReadOnly = True : 物料規格_dgv.Columns(10).ReadOnly = True : 物料規格_dgv.Columns(11).ReadOnly = True

            For i As Integer = 0 To 物料規格_dgv.Rows.Count - 1
                物料規格_dgv.Rows(i).Cells("No").Value = i + 1
                物料規格_dgv.Rows(i).Cells("申請數 Terapkan").Value = 0
                If Not IsNumeric(物料規格_dgv.Rows(i).Cells("申請數 Terapkan").Value) Then : MGB(對話框(0), 1)
                ElseIf Val(物料規格_dgv.Rows(i).Cells("申請數 Terapkan").Value) > 0 Then : 物料規格_dgv.Rows(i).Cells("Pilih").Value = True
                ElseIf Val(物料規格_dgv.Rows(i).Cells("申請數 Terapkan").Value) <= 0 Then
                    物料規格_dgv.Rows(i).Cells("申請數 Terapkan").Value = "0" : 物料規格_dgv.Rows(i).Cells("Pilih").Value = False
                End If
            Next i
        End If
    End Sub
    Private Sub 物料規格_dgv_CellClick(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles 物料規格_dgv.CellClick
        If e.RowIndex = -1 Then : Else : 料號_tb.Text = 物料規格_dgv.Rows(e.RowIndex).Cells("Nomor_Bagian").Value.ToString : End If
    End Sub
    Private Sub 物料清單1_dgv_CellClick(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles 物料清單1_dgv.CellClick
        If e.RowIndex = -1 Then : Else
            PA = 物料清單1_dgv(1, e.RowIndex).Value.ToString : PA1 = 物料清單1_dgv.Rows(e.RowIndex).Cells("群組碼").Value
            PA2 = 物料清單1_dgv.Rows(e.RowIndex).Cells("料號原則").Value : SQL_物料圖庫_圖檔讀取()
            While dr.Read() = True
                Dim unused As Byte() = New Byte(-1) {}
                Dim bytes As Byte() = DirectCast(dr.Item("圖檔"), Byte())
                Dim oStream As New MemoryStream(bytes)
                物料圖_pb.Image = Bitmap.FromStream(oStream)
            End While : conn.Close() : 物料圖_pb.SizeMode = 4
            '------------------------------------------------------------------------------------------------------------------------------------------
            SQL_建築物料請購單申請_物料規格讀取()
            If dr.Read() Then : KKK2 = dr("規格庫編號") : PA3 = dr("規格庫抬頭指定") : PA4 = dr("群組碼") : End If : conn.Close()
            '------------------------------------------------------------------------------------------------------------------------------------------
            SQL_規格庫抬頭讀取()
            If dr.Read() Then : AAA1 = dr("A1") : AAA2 = dr("A2") : AAA3 = dr("A3") : AAA4 = dr("A4") : AAA5 = dr("A5") : AAA6 = dr("A6") : AAA7 = dr("A7") : AAA8 = dr("A8") : End If
            conn.Close()
            '------------------------------------------------------------------------------------------------------------------------------------------
            Dim ds3 As New DataSet
            物料規格1_dgv.DataSource = Nothing : ds3.Clear()
            物料規格1_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
            物料規格1_dgv.ColumnHeadersHeight = 25 : 物料規格1_dgv.AllowUserToAddRows = False : 物料規格1_dgv.RowTemplate.Height = 20
            If KKK2 = "SQLB03" Then : SQL_物料規格_SQLB03() : ElseIf KKK2 = "SQLB04" Then : SQL_物料規格_SQLB04() : ElseIf KKK2 = "SQLB05" Then : SQL_物料規格_SQLB05()
            ElseIf KKK2 = "SQLB06" Then : SQL_物料規格_SQLB06() : ElseIf KKK2 = "SQLB07" Then : SQL_物料規格_SQLB07() : ElseIf KKK2 = "SQLB08" Then : SQL_物料規格_SQLB08() : End If
            da.Fill(ds3) : 物料規格1_dgv.DataSource = ds3.Tables(0) : conn.Close() : 料號_tb.Text = ""

            物料規格1_dgv.Columns(0).Visible = False : 物料規格1_dgv.Columns(1).Visible = False : 物料規格1_dgv.Columns(3).Visible = False
            物料規格1_dgv.Columns(2).Width = 17 : 物料規格1_dgv.Columns(12).Visible = False : 物料規格1_dgv.Columns(13).Visible = False : 物料規格1_dgv.Columns(14).Visible = False
            物料規格1_dgv.Columns(15).Visible = False
            If KKK2 = "SQLB03" Then
                物料規格1_dgv.Columns(7).Visible = False : 物料規格1_dgv.Columns(8).Visible = False : 物料規格1_dgv.Columns(9).Visible = False : 物料規格1_dgv.Columns(10).Visible = False
                物料規格1_dgv.Columns(11).Visible = False
                物料規格1_dgv.Columns(4).FillWeight = 213 : 物料規格1_dgv.Columns(5).FillWeight = 213 : 物料規格1_dgv.Columns(6).FillWeight = 214
            ElseIf KKK2 = "SQLB04" Then
                物料規格1_dgv.Columns(7).Visible = True : 物料規格1_dgv.Columns(8).Visible = False : 物料規格1_dgv.Columns(9).Visible = False : 物料規格1_dgv.Columns(10).Visible = False
                物料規格1_dgv.Columns(11).Visible = False
                物料規格1_dgv.Columns(4).FillWeight = 160 : 物料規格1_dgv.Columns(5).FillWeight = 160 : 物料規格1_dgv.Columns(6).FillWeight = 160 : 物料規格1_dgv.Columns(7).FillWeight = 160
            ElseIf KKK2 = "SQLB05" Then
                物料規格1_dgv.Columns(7).Visible = True : 物料規格1_dgv.Columns(8).Visible = True : 物料規格1_dgv.Columns(9).Visible = False : 物料規格1_dgv.Columns(10).Visible = False
                物料規格1_dgv.Columns(11).Visible = False
                物料規格1_dgv.Columns(4).FillWeight = 128 : 物料規格1_dgv.Columns(5).FillWeight = 128 : 物料規格1_dgv.Columns(6).FillWeight = 128 : 物料規格1_dgv.Columns(7).FillWeight = 128
                物料規格1_dgv.Columns(8).FillWeight = 128
            ElseIf KKK2 = "SQLB06" Then
                物料規格1_dgv.Columns(7).Visible = True : 物料規格1_dgv.Columns(8).Visible = True : 物料規格1_dgv.Columns(9).Visible = True : 物料規格1_dgv.Columns(10).Visible = False
                物料規格1_dgv.Columns(11).Visible = False
                物料規格1_dgv.Columns(4).FillWeight = 106 : 物料規格1_dgv.Columns(5).FillWeight = 107 : 物料規格1_dgv.Columns(6).FillWeight = 106 : 物料規格1_dgv.Columns(7).FillWeight = 107
                物料規格1_dgv.Columns(8).FillWeight = 106 : 物料規格1_dgv.Columns(9).FillWeight = 108
            ElseIf KKK2 = "SQLB07" Then
                物料規格1_dgv.Columns(7).Visible = True : 物料規格1_dgv.Columns(8).Visible = True : 物料規格1_dgv.Columns(9).Visible = True : 物料規格1_dgv.Columns(10).Visible = True
                物料規格1_dgv.Columns(11).Visible = False
                物料規格1_dgv.Columns(4).FillWeight = 91 : 物料規格1_dgv.Columns(5).FillWeight = 92 : 物料規格1_dgv.Columns(6).FillWeight = 91 : 物料規格1_dgv.Columns(7).FillWeight = 92
                物料規格1_dgv.Columns(8).FillWeight = 91 : 物料規格1_dgv.Columns(9).FillWeight = 92 : 物料規格1_dgv.Columns(10).FillWeight = 91
            ElseIf KKK2 = "SQLB08" Then
                物料規格1_dgv.Columns(7).Visible = True : 物料規格1_dgv.Columns(8).Visible = True : 物料規格1_dgv.Columns(9).Visible = True : 物料規格1_dgv.Columns(10).Visible = True
                物料規格1_dgv.Columns(11).Visible = True
                物料規格1_dgv.Columns(4).FillWeight = 80 : 物料規格1_dgv.Columns(5).FillWeight = 80 : 物料規格1_dgv.Columns(6).FillWeight = 80 : 物料規格1_dgv.Columns(7).FillWeight = 80
                物料規格1_dgv.Columns(8).FillWeight = 80 : 物料規格1_dgv.Columns(9).FillWeight = 80 : 物料規格1_dgv.Columns(10).FillWeight = 80 : 物料規格1_dgv.Columns(11).FillWeight = 80
            End If
            物料規格1_dgv.EditMode = DataGridViewEditMode.EditOnEnter
            物料規格1_dgv.Columns(0).ReadOnly = True : 物料規格1_dgv.Columns(1).ReadOnly = True : 物料規格1_dgv.Columns(2).ReadOnly = True : 物料規格1_dgv.Columns(3).ReadOnly = True
            物料規格1_dgv.Columns(4).ReadOnly = True : 物料規格1_dgv.Columns(5).ReadOnly = True : 物料規格1_dgv.Columns(6).ReadOnly = True : 物料規格1_dgv.Columns(7).ReadOnly = True
            物料規格1_dgv.Columns(8).ReadOnly = True : 物料規格1_dgv.Columns(9).ReadOnly = True : 物料規格1_dgv.Columns(10).ReadOnly = True : 物料規格1_dgv.Columns(11).ReadOnly = True

            For i As Integer = 0 To 物料規格1_dgv.Rows.Count - 1
                物料規格1_dgv.Rows(i).Cells("No").Value = i + 1 : 物料規格1_dgv.Rows(i).Cells("申請數 Terapkan").Value = 0
                If Not IsNumeric(物料規格1_dgv.Rows(i).Cells("申請數 Terapkan").Value) Then : MGB(對話框(0), 1)
                ElseIf Val(物料規格1_dgv.Rows(i).Cells("申請數 Terapkan").Value) > 0 Then : 物料規格1_dgv.Rows(i).Cells("Pilih").Value = True
                ElseIf Val(物料規格1_dgv.Rows(i).Cells("申請數 Terapkan").Value) <= 0 Then
                    物料規格1_dgv.Rows(i).Cells("申請數 Terapkan").Value = "0" : 物料規格1_dgv.Rows(i).Cells("Pilih").Value = False
                End If
            Next i
        End If
    End Sub
    Private Sub 物料規格1_dgv_CellClick(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles 物料規格1_dgv.CellClick
        If e.RowIndex = -1 Then : Else
            料號_tb.Text = 物料規格1_dgv.Rows(e.RowIndex).Cells("Nomor_Bagian").Value.ToString : 料號2_tb.Text = 物料規格1_dgv.Rows(e.RowIndex).Cells("Nomor_Bagian").Value.ToString
        End If
    End Sub
    Private Sub 物料規格1_dgv_CellContentCl(sender As Object, e As DataGridViewCellEventArgs) Handles 物料規格1_dgv.CellEnter
        For i As Integer = 0 To 物料規格1_dgv.Rows.Count - 1
            If Not IsNumeric(物料規格1_dgv.Rows(i).Cells("申請數 Terapkan").Value) Then : MGB(對話框(0), 1)
                物料規格1_dgv.Rows(i).Cells("申請數 Terapkan").Value = "0" : 物料規格1_dgv.Rows(i).Cells("Pilih").Value = False
            ElseIf Val(物料規格1_dgv.Rows(i).Cells("申請數 Terapkan").Value) > 0 Then : 物料規格1_dgv.Rows(i).Cells("Pilih").Value = True
            ElseIf Val(物料規格1_dgv.Rows(i).Cells("申請數 Terapkan").Value) <= 0 Then
                物料規格1_dgv.Rows(i).Cells("申請數 Terapkan").Value = "0" : 物料規格1_dgv.Rows(i).Cells("Pilih").Value = False
            End If
        Next i
    End Sub
    Private Sub 類別管理_cb_SelectedIndexChanged(sender As Object, e As EventArgs) Handles 類別管理_cb.SelectedIndexChanged
        PA20 = 類別管理_cb.Text : SQL_供應商類別管理_查詢()
        If dr.Read() Then : 供應商簡稱_tb.Text = dr("編碼").ToString : Else : 供應商簡稱_tb.Text = "" : End If
        PA = 供應商簡稱_tb.Text : 廠商_cb_下拉表單資料載入()
    End Sub
    Private Sub 廠商_cb_SelectedIndexChanged(sender As Object, e As EventArgs) Handles 廠商_cb.SelectedIndexChanged
        PA1 = 廠商_cb.Text : SQL_建築物料採購單生成_供應商資料二()
        If dr.Read() Then
            地址_tb.Text = dr("公司地址") : 電話_tb.Text = dr("公司電話1") : 郵件_tb.Text = dr("聯繫人1郵箱")
            傳真_tb.Text = dr("公司傳真1") : 供應商編碼_tb.Text = dr("供應商編碼") : End If
        conn.Close()
    End Sub
    Private Sub 供應商編碼_tb_TextChanged(sender As Object, e As EventArgs) Handles 供應商編碼_tb.TextChanged
        Set_歷史明細清單() : Set_明細清單()
    End Sub
    Private Sub 新群組1_cb_SelectedIndexChanged(sender As Object, e As EventArgs) Handles 新群組1_cb.SelectedIndexChanged
        PA = 新群組1_cb.Text : SQL_群組碼_語轉_選擇() : If dr.Read Then : 群組編碼_cb.Text = dr("群組碼").ToString : End If : PA = ""
    End Sub
    Private Sub 群組編碼_cb_SelectedIndexChanged(sender As Object, e As EventArgs) Handles 群組編碼_cb.SelectedIndexChanged
        群組碼_tb.Text = 群組編碼_cb.Text : Set_清單1()
    End Sub
    Private Sub 小間距_ch_CheckedChanged(sender As Object, e As EventArgs) Handles 小間距_ch.Click
        小間距_ch.Checked = True : 中間距_ch.Checked = False : 大間距_ch.Checked = False : Set_清單1()
    End Sub
    Private Sub 中間距_ch_CheckedChanged(sender As Object, e As EventArgs) Handles 中間距_ch.Click
        小間距_ch.Checked = False : 中間距_ch.Checked = True : 大間距_ch.Checked = False : Set_清單1()
    End Sub
    Private Sub 大間距_ch_CheckedChanged(sender As Object, e As EventArgs) Handles 大間距_ch.Click
        小間距_ch.Checked = False : 中間距_ch.Checked = False : 大間距_ch.Checked = True : Set_清單1()
    End Sub
    Private Sub 小間距1_ch_CheckedChanged(sender As Object, e As EventArgs) Handles 小間距1_ch.Click
        小間距1_ch.Checked = True : 中間距1_ch.Checked = False : 大間距1_ch.Checked = False : Set_明細清單()
    End Sub
    Private Sub 中間距1_ch_CheckedChanged(sender As Object, e As EventArgs) Handles 中間距1_ch.Click
        小間距1_ch.Checked = False : 中間距1_ch.Checked = True : 大間距1_ch.Checked = False : Set_明細清單()
    End Sub
    Private Sub 大間距1_ch_CheckedChanged(sender As Object, e As EventArgs) Handles 大間距1_ch.Click
        小間距1_ch.Checked = False : 中間距1_ch.Checked = False : 大間距1_ch.Checked = True : Set_明細清單()
    End Sub
    Private Sub 批量比對_bt_Click(sender As Object, e As EventArgs) Handles 批量比對_bt.Click
        NB1 = 0 : For A As Integer = 0 To 廠商_cb.Items.Count - 1 : 廠商_cb.SelectedIndex = A : 比對新增() : Next
        MGB(對話框(1) & " " & 對話框(2) & NB1 & 對話框(3), 1) : Set_明細清單()
    End Sub
    Private Sub 比對新增_bt_Click(sender As Object, e As EventArgs) Handles 比對新增_bt.Click
        NB1 = 0 : 比對新增() : MGB(對話框(1) & " " & 對話框(2) & NB1 & 對話框(3), 1) : Set_明細清單()
    End Sub
    Private Sub 存檔_tb_Click(sender As Object, e As EventArgs) Handles 存檔_tb.Click
        NB1 = 0 : PA1 = 供應商編碼_tb.Text
        For i As Integer = 0 To 明細_dgv.Rows.Count - 1
            資料數 = 明細_dgv.Rows.Count : MyMod.進度條() : NB1 += 1
            PA2 = 明細_dgv.Rows(i).Cells(表頭(1)).Value.ToString : PA3 = 明細_dgv.Rows(i).Cells(表頭(3)).Value.ToString : PA4 = 明細_dgv.Rows(i).Cells(表頭(4)).Value.ToString
            PA45 = 明細_dgv.Rows(i).Cells(25).Value.ToString
            SQL_供應商商品_採購清單_修改1()
        Next : HX_PGS_ERP_SYS.ToolStripProgressBar1.Value = 0 : 最終數 = 0 : MGB(對話框(4) & " " & 對話框(2) & NB1 & 對話框(3), 1) : Set_明細清單()
    End Sub
    Private Sub 物料加入_bt_Click(sender As Object, e As EventArgs) Handles 物料加入_bt.Click
        If 料號_tb.Text = "" Then : MGB(對話框(5), 1) : Else
            If 供應商編碼_tb.Text = "" Then : MGB(對話框(6), 1) : Else
                PA1 = 供應商編碼_tb.Text : PA2 = 料號_tb.Text : PA3 = "0" : PA5 = "" : PA4 = ""
                SQL_供應商商品_採購清單_查詢()
                If dr.Read Then : SQL_供應商商品_採購清單_修改() : Else : SQL_供應商商品_採購清單_新增() : End If
                MGB(對話框(4) & " " & 對話框(2) & NB1 & 對話框(3), 1) : Set_明細清單()
            End If
        End If
    End Sub
    Private Sub 刪除_bt_Click(sender As Object, e As EventArgs) Handles 刪除_bt.Click
        If 料號1_tb.Text = "" Then : MGB(對話框(5), 1) : Else
            If 供應商編碼_tb.Text = "" Then : MGB(對話框(6), 1) : Else
                PA1 = 供應商編碼_tb.Text : PA2 = 料號1_tb.Text : SQL_供應商商品_採購清單_刪除() : MGB(對話框(7), 1) : Set_明細清單()
            End If
        End If
    End Sub
    Private Sub 比對新增()
        Dim 下一筆需計算, 需要更新 As Boolean
        For i As Integer = 0 To 歷史明細_dgv.Rows.Count - 1
            資料數 = 歷史明細_dgv.Rows.Count : MyMod.進度條()
            If i = 0 Then
                需要更新 = True
                For ii As Integer = 0 To 明細_dgv.Rows.Count - 1
                    If 歷史明細_dgv.Rows(i).Cells(表頭(1)).Value.ToString = 明細_dgv.Rows(ii).Cells(表頭(1)).Value.ToString Then
                        If CInt(歷史明細_dgv.Rows(i).Cells(表頭(7)).Value.ToString) = CInt(明細_dgv.Rows(ii).Cells(表頭(5)).Value.ToString) And
                           CLng(歷史明細_dgv.Rows(i).Cells(表頭(3)).Value.ToString) = CLng(明細_dgv.Rows(ii).Cells(表頭(3)).Value.ToString) Then
                            需要更新 = False : Exit For : Else : 需要更新 = True
                        End If
                    End If
                Next
                If i < 歷史明細_dgv.Rows.Count - 1 Then
                    If 歷史明細_dgv.Rows(i).Cells(表頭(1)).Value.ToString <> 歷史明細_dgv.Rows(i + 1).Cells(表頭(1)).Value.ToString Then
                        下一筆需計算 = True : Else : 下一筆需計算 = False
                    End If
                End If
            Else
                If 下一筆需計算 = True Then
                    需要更新 = True
                    For ii As Integer = 0 To 明細_dgv.Rows.Count - 1
                        If 歷史明細_dgv.Rows(i).Cells(表頭(1)).Value.ToString = 明細_dgv.Rows(ii).Cells(表頭(1)).Value.ToString Then
                            If CInt(歷史明細_dgv.Rows(i).Cells(表頭(7)).Value.ToString) = CInt(明細_dgv.Rows(ii).Cells(表頭(5)).Value.ToString) And
                               CLng(歷史明細_dgv.Rows(i).Cells(表頭(3)).Value.ToString) = CLng(明細_dgv.Rows(ii).Cells(表頭(3)).Value.ToString) Then
                                需要更新 = False : Exit For : Else : 需要更新 = True : Exit For
                            End If
                        End If
                    Next
                Else : 需要更新 = False : End If
                If i < 歷史明細_dgv.Rows.Count - 1 Then
                    If 歷史明細_dgv.Rows(i).Cells(表頭(1)).Value.ToString <> 歷史明細_dgv.Rows(i + 1).Cells(表頭(1)).Value.ToString Then
                        下一筆需計算 = True : Else : 下一筆需計算 = False
                    End If
                End If
            End If
            If 需要更新 = True Then
                If CLng(歷史明細_dgv.Rows(i).Cells(表頭(3)).Value.ToString) > 0 Then
                    NB1 += 1 : PA1 = 歷史明細_dgv.Rows(i).Cells(表頭(6)).Value.ToString : PA2 = 歷史明細_dgv.Rows(i).Cells(表頭(1)).Value.ToString
                    PA3 = 歷史明細_dgv.Rows(i).Cells(表頭(3)).Value.ToString : PA5 = 歷史明細_dgv.Rows(i).Cells(表頭(7)).Value.ToString
                    SQL_供應商商品_採購清單_查詢() : If dr.Read Then : SQL_供應商商品_採購清單_修改() : Else : SQL_供應商商品_採購清單_新增() : End If
                End If
            End If
        Next : HX_PGS_ERP_SYS.ToolStripProgressBar1.Value = 0 : 最終數 = 0
    End Sub
    Private Sub 切換_ts_CheckedChanged(sender As Object, e As EventArgs) Handles 切換_ts.CheckedChanged
        If 首次開啟 = True Then : Else
            If 切換_ts.Checked = True Then : 切換_ts.Checked = True : Panel3.Visible = True : Panel2.Visible = False
            Else : 切換_ts.Checked = False : Panel3.Visible = False : Panel2.Visible = True : End If
        End If
    End Sub
    Private Sub 回首頁_bt_Click(sender As Object, e As EventArgs) Handles 回首頁_bt.Click
        物料查詢 = False : 主頁_p.BringToFront()
    End Sub
    Private Sub 回次頁_bt_Click(sender As Object, e As EventArgs) Handles 回次頁_bt.Click
        If 頁面 = "1" Then : 主頁_p.BringToFront() : ElseIf 頁面 = "2" Then : 次頁_p.BringToFront() : Else : 主頁_p.BringToFront() : End If
    End Sub
    Private Sub 次項變形()
        For i As Integer = 1 To 21 : Dim 選擇 As Panel = CType(Me.Controls.Find("AP" & i, True)(0), Panel) : 選擇.Visible = False : Next
        Dim SS As Integer
        If 群組分類_dgv.Rows.Count > 21 Then : SS = 21 : Else : SS = 群組分類_dgv.Rows.Count : End If
        For i As Integer = 1 To SS : Dim 選擇 As Panel = CType(Me.Controls.Find("AP" & i, True)(0), Panel) : 選擇.Visible = True : Next
        Dim 轉檔 As Boolean
        For i As Integer = 0 To 群組分類_dgv.Rows.Count - 1
            Dim 選擇 As PictureBox = CType(Me.Controls.Find("PB_" & i + 1, True)(0), PictureBox)
            If IsDBNull(群組分類_dgv.Rows(i).Cells(2).Value) = True Then : 轉檔 = False : Else : 轉檔 = True : End If
            While 轉檔 = True
                Dim unused As Byte() = New Byte(-1) {}
                Dim bytes As Byte() = DirectCast(群組分類_dgv.Rows(i).Cells(2).Value, Byte())
                Dim oStream As New MemoryStream(bytes)
                選擇.Image = Bitmap.FromStream(oStream) : 轉檔 = False
            End While : conn.Close() : 選擇.SizeMode = 4
            Dim 選擇1 As TextBox = CType(Me.Controls.Find("TB_" & i + 1, True)(0), TextBox) : 選擇1.Text = 群組分類_dgv.Rows(i).Cells(1).Value.ToString
            '---------未做換頁計算---------------------------------------------
            群組碼(i + 1) = 群組分類_dgv.Rows(i).Cells(0).Value.ToString
        Next
    End Sub
    Private Sub 管材_bt_Click(sender As Object, e As EventArgs) Handles 管材_bt.Click
        頁面 = "1" : PA1 = "管材" : Set_群組清單() : 次頁_p.BringToFront()
    End Sub
    Private Sub 電線_bt_Click(sender As Object, e As EventArgs) Handles 電線_bt.Click
        頁面 = "1" : PA1 = "電線" : Set_群組清單() : 次頁_p.BringToFront()
    End Sub
    Private Sub 電料_bt_Click(sender As Object, e As EventArgs) Handles 電料_bt.Click
        頁面 = "1" : PA1 = "電料" : Set_群組清單() : 次頁_p.BringToFront()
    End Sub
    Private Sub 槽架_bt_Click(sender As Object, e As EventArgs) Handles 槽架_bt.Click
        頁面 = "1" : PA1 = "槽架" : Set_群組清單() : 次頁_p.BringToFront()
    End Sub
    Private Sub 建材_bt_Click(sender As Object, e As EventArgs) Handles 建材_bt.Click
        頁面 = "1" : PA1 = "建材" : Set_群組清單() : 次頁_p.BringToFront()
    End Sub
    Private Sub 五金_bt_Click(sender As Object, e As EventArgs) Handles 五金_bt.Click
        頁面 = "1" : PA1 = "五金" : Set_群組清單() : 次頁_p.BringToFront()
    End Sub
    Private Sub 設備_bt_Click(sender As Object, e As EventArgs) Handles 設備_bt.Click
        頁面 = "1" : PA1 = "設備" : Set_群組清單() : 次頁_p.BringToFront()
    End Sub
    Private Sub 工具_bt_Click(sender As Object, e As EventArgs) Handles 工具_bt.Click
        頁面 = "1" : PA1 = "工具" : Set_群組清單() : 次頁_p.BringToFront()
    End Sub
    Private Sub 日用_bt_Click(sender As Object, e As EventArgs) Handles 日用_bt.Click
        頁面 = "1" : PA1 = "日用" : Set_群組清單() : 次頁_p.BringToFront()
    End Sub
    Private Sub 其他_bt_Click(sender As Object, e As EventArgs) Handles 其他_bt.Click
        頁面 = "1" : PA1 = "其他" : Set_群組清單() : 次頁_p.BringToFront()
    End Sub
    Private Sub PB_1_Click(sender As Object, e As EventArgs) Handles PB_1.Click
        頁面 = "2" : PA1 = 群組碼(1) : Set_清單1_1() : 物料_p.BringToFront()
    End Sub
    Private Sub PB_2_Click(sender As Object, e As EventArgs) Handles PB_2.Click
        頁面 = "2" : PA1 = 群組碼(2) : Set_清單1_1() : 物料_p.BringToFront()
    End Sub
    Private Sub PB_3_Click(sender As Object, e As EventArgs) Handles PB_3.Click
        頁面 = "2" : PA1 = 群組碼(3) : Set_清單1_1() : 物料_p.BringToFront()
    End Sub
    Private Sub PB_4_Click(sender As Object, e As EventArgs) Handles PB_4.Click
        頁面 = "2" : PA1 = 群組碼(4) : Set_清單1_1() : 物料_p.BringToFront()
    End Sub
    Private Sub PB_5_Click(sender As Object, e As EventArgs) Handles PB_5.Click
        頁面 = "2" : PA1 = 群組碼(5) : Set_清單1_1() : 物料_p.BringToFront()
    End Sub
    Private Sub PB_6_Click(sender As Object, e As EventArgs) Handles PB_6.Click
        頁面 = "2" : PA1 = 群組碼(6) : Set_清單1_1() : 物料_p.BringToFront()
    End Sub
    Private Sub PB_7_Click(sender As Object, e As EventArgs) Handles PB_7.Click
        頁面 = "2" : PA1 = 群組碼(7) : Set_清單1_1() : 物料_p.BringToFront()
    End Sub
    Private Sub PB_8_Click(sender As Object, e As EventArgs) Handles PB_8.Click
        頁面 = "2" : PA1 = 群組碼(8) : Set_清單1_1() : 物料_p.BringToFront()
    End Sub
    Private Sub PB_9_Click(sender As Object, e As EventArgs) Handles PB_9.Click
        頁面 = "2" : PA1 = 群組碼(9) : Set_清單1_1() : 物料_p.BringToFront()
    End Sub
    Private Sub PB_10_Click(sender As Object, e As EventArgs) Handles PB_10.Click
        頁面 = "2" : PA1 = 群組碼(10) : Set_清單1_1() : 物料_p.BringToFront()
    End Sub
    Private Sub PB_11_Click(sender As Object, e As EventArgs) Handles PB_11.Click
        頁面 = "2" : PA1 = 群組碼(11) : Set_清單1_1() : 物料_p.BringToFront()
    End Sub
    Private Sub PB_12_Click(sender As Object, e As EventArgs) Handles PB_12.Click
        頁面 = "2" : PA1 = 群組碼(12) : Set_清單1_1() : 物料_p.BringToFront()
    End Sub
    Private Sub PB_13_Click(sender As Object, e As EventArgs) Handles PB_13.Click
        頁面 = "2" : PA1 = 群組碼(13) : Set_清單1_1() : 物料_p.BringToFront()
    End Sub
    Private Sub PB_14_Click(sender As Object, e As EventArgs) Handles PB_14.Click
        頁面 = "2" : PA1 = 群組碼(14) : Set_清單1_1() : 物料_p.BringToFront()
    End Sub
    Private Sub PB_15_Click(sender As Object, e As EventArgs) Handles PB_15.Click
        頁面 = "2" : PA1 = 群組碼(15) : Set_清單1_1() : 物料_p.BringToFront()
    End Sub
    Private Sub PB_16_Click(sender As Object, e As EventArgs) Handles PB_16.Click
        頁面 = "2" : PA1 = 群組碼(16) : Set_清單1_1() : 物料_p.BringToFront()
    End Sub
    Private Sub PB_17_Click(sender As Object, e As EventArgs) Handles PB_17.Click
        頁面 = "2" : PA1 = 群組碼(17) : Set_清單1_1() : 物料_p.BringToFront()
    End Sub
    Private Sub PB_18_Click(sender As Object, e As EventArgs) Handles PB_18.Click
        頁面 = "2" : PA1 = 群組碼(18) : Set_清單1_1() : 物料_p.BringToFront()
    End Sub
    Private Sub PB_19_Click(sender As Object, e As EventArgs) Handles PB_19.Click
        頁面 = "2" : PA1 = 群組碼(19) : Set_清單1_1() : 物料_p.BringToFront()
    End Sub
    Private Sub PB_20_Click(sender As Object, e As EventArgs) Handles PB_20.Click
        頁面 = "2" : PA1 = 群組碼(20) : Set_清單1_1() : 物料_p.BringToFront()
    End Sub
    Private Sub PB_21_Click(sender As Object, e As EventArgs) Handles PB_21.Click
        頁面 = "2" : PA1 = 群組碼(21) : Set_清單1_1() : 物料_p.BringToFront()
    End Sub
    Private Sub TB_1_TextChanged(sender As Object, e As EventArgs) Handles TB_1.Click
        頁面 = "2" : PA1 = 群組碼(1) : Set_清單1_1() : 物料_p.BringToFront()
    End Sub
    Private Sub TB_2_TextChanged(sender As Object, e As EventArgs) Handles TB_2.Click
        頁面 = "2" : PA1 = 群組碼(2) : Set_清單1_1() : 物料_p.BringToFront()
    End Sub
    Private Sub TB_3_TextChanged(sender As Object, e As EventArgs) Handles TB_3.Click
        頁面 = "2" : PA1 = 群組碼(3) : Set_清單1_1() : 物料_p.BringToFront()
    End Sub
    Private Sub TB_4_TextChanged(sender As Object, e As EventArgs) Handles TB_4.Click
        頁面 = "2" : PA1 = 群組碼(4) : Set_清單1_1() : 物料_p.BringToFront()
    End Sub
    Private Sub TB_5_TextChanged(sender As Object, e As EventArgs) Handles TB_5.Click
        頁面 = "2" : PA1 = 群組碼(5) : Set_清單1_1() : 物料_p.BringToFront()
    End Sub
    Private Sub TB_6_TextChanged(sender As Object, e As EventArgs) Handles TB_6.Click
        頁面 = "2" : PA1 = 群組碼(6) : Set_清單1_1() : 物料_p.BringToFront()
    End Sub
    Private Sub TB_7_TextChanged(sender As Object, e As EventArgs) Handles TB_7.Click
        頁面 = "2" : PA1 = 群組碼(7) : Set_清單1_1() : 物料_p.BringToFront()
    End Sub
    Private Sub TB_8_TextChanged(sender As Object, e As EventArgs) Handles TB_8.Click
        頁面 = "2" : PA1 = 群組碼(8) : Set_清單1_1() : 物料_p.BringToFront()
    End Sub
    Private Sub TB_9_TextChanged(sender As Object, e As EventArgs) Handles TB_9.Click
        頁面 = "2" : PA1 = 群組碼(9) : Set_清單1_1() : 物料_p.BringToFront()
    End Sub
    Private Sub TB_10_TextChanged(sender As Object, e As EventArgs) Handles TB_10.Click
        頁面 = "2" : PA1 = 群組碼(10) : Set_清單1_1() : 物料_p.BringToFront()
    End Sub
    Private Sub TB_11_TextChanged(sender As Object, e As EventArgs) Handles TB_11.Click
        頁面 = "2" : PA1 = 群組碼(11) : Set_清單1_1() : 物料_p.BringToFront()
    End Sub
    Private Sub TB_12_TextChanged(sender As Object, e As EventArgs) Handles TB_12.Click
        頁面 = "2" : PA1 = 群組碼(12) : Set_清單1_1() : 物料_p.BringToFront()
    End Sub
    Private Sub TB_13_TextChanged(sender As Object, e As EventArgs) Handles TB_13.Click
        頁面 = "2" : PA1 = 群組碼(13) : Set_清單1_1() : 物料_p.BringToFront()
    End Sub
    Private Sub TB_14_TextChanged(sender As Object, e As EventArgs) Handles TB_14.Click
        頁面 = "2" : PA1 = 群組碼(14) : Set_清單1_1() : 物料_p.BringToFront()
    End Sub
    Private Sub TB_15_TextChanged(sender As Object, e As EventArgs) Handles TB_15.Click
        頁面 = "2" : PA1 = 群組碼(15) : Set_清單1_1() : 物料_p.BringToFront()
    End Sub
    Private Sub TB_16_TextChanged(sender As Object, e As EventArgs) Handles TB_16.Click
        頁面 = "2" : PA1 = 群組碼(16) : Set_清單1_1() : 物料_p.BringToFront()
    End Sub
    Private Sub TB_17_TextChanged(sender As Object, e As EventArgs) Handles TB_17.Click
        頁面 = "2" : PA1 = 群組碼(17) : Set_清單1_1() : 物料_p.BringToFront()
    End Sub
    Private Sub TB_18_TextChanged(sender As Object, e As EventArgs) Handles TB_18.Click
        頁面 = "2" : PA1 = 群組碼(18) : Set_清單1_1() : 物料_p.BringToFront()
    End Sub
    Private Sub TB_19_TextChanged(sender As Object, e As EventArgs) Handles TB_19.Click
        頁面 = "2" : PA1 = 群組碼(19) : Set_清單1_1() : 物料_p.BringToFront()
    End Sub
    Private Sub TB_20_TextChanged(sender As Object, e As EventArgs) Handles TB_20.Click
        頁面 = "2" : PA1 = 群組碼(20) : Set_清單1_1() : 物料_p.BringToFront()
    End Sub
    Private Sub TB_21_TextChanged(sender As Object, e As EventArgs) Handles TB_21.Click
        頁面 = "2" : PA1 = 群組碼(21) : Set_清單1_1() : 物料_p.BringToFront()
    End Sub
End Class