Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,027

HOME > .NET Framework > Forum > ช่วยดูโค้ดให้หน่อยคับพอดีหาส่วนที่ตั้งให้ใส่ข้อมูลได้เฉพาะตัวเลขไม่เจออะคับ



 

ช่วยดูโค้ดให้หน่อยคับพอดีหาส่วนที่ตั้งให้ใส่ข้อมูลได้เฉพาะตัวเลขไม่เจออะคับ

 



Topic : 072492

Guest




Code (VB.NET)
Option Explicit On
Option Strict On
Imports System.Data
Imports System.Data.SqlClient

Public Class MonitoringProductsForm
    Dim Conn As SqlConnection
    Dim Com As SqlCommand
    Dim strConn As String
    Dim dr As SqlDataReader

    Private Sub MonitoringProductsForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Cursor.Current = Cursors.WaitCursor
        strConn = DBConnString.strConn
        Conn = New SqlConnection

        With Conn
            If .State = ConnectionState.Open Then Close()
            .ConnectionString = strConn
            .Open()
        End With
        Conn.Close()

        gpbFreshOrganicLongan.Show()
        gpbStockInventoryControl.Show()
        gpbDryingOrganicLonganFleshGolden.Hide()
        gpbDryingOrganicLonganFleshGoldenBake.Hide()
        gpbDryingOrganicLonganFleshGoldenPacking.Hide()

        gpbDryingOrganicLongan.Hide()
        gpbDryingOrganicLonganPacking.Hide()

        gpbOrganicLonganTea.Hide()
        gpbOrganicLonganTeaBake.Hide()
        gpbOrganicLonganTeaPacking.Hide()

        gpbFreshOrganicLongan.Location = New Point(25, gpbProductMemberReceive.Location().Y() + 353)
        gpbStockInventoryControl.Location = New Point(25, gpbFreshOrganicLongan.Location().Y() + 231)

        cmdPrint.Location = New Point(817, gpbStockInventoryControl.Location().Y() + 229)
        lblcmdprint.Location = New Point(623, gpbStockInventoryControl.Location().Y() + 264)
        lblLast.Location = New Point(392, gpbStockInventoryControl.Location().Y() + 275)

        mtbBarcode.Focus()
        Cursor.Current = Cursors.Default
    End Sub

    Private Sub mtbBarcode_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles mtbBarcode.KeyDown
        If (e.KeyCode = Keys.Enter) Then
            If mtbBarcode.Text = "" Or mtbBarcode.MaskFull = False Then
                MessageBox.Show("กรุณากรอกหมายเลขให้ครบ", "ผลการตรวจสอบ", MessageBoxButtons.OK, MessageBoxIcon.Warning)
                Exit Sub
            End If

            SearchMonitoringProductsForm()
        End If
            
    End Sub

    Private Sub ClearData()
        lblNameProduct.Text = ""
        lblSizeProduct.Text = ""
        lblNameCustomer.Text = ""
        lblTypePacking.Text = ""
        lblNumber_Member.Text = ""
        lblName_Full.Text = ""
        lblAddress.Text = ""
        lblPhone.Text = ""
        lblFax.Text = ""
        lblblockBarcode.Text = ""
        lblSeblockBarcode.Text = ""
        lblAddressBarcode.Text = ""
        lblRaiBarcode.Text = ""
        lblJobBarcode.Text = ""
        lblSquaremetersBarcode.Text = ""

        lblLonganSpecies.Text = ""
        lblDiseaseAndInsects.Text = ""
        lblShellQuality.Text = ""
        lblTestResults.Text = ""
        lblSenderName.Text = ""
        lblSenderDate.Text = ""
        lblInspectorName.Text = ""
        lblInspectorDate.Text = ""


        dgvDetailProductReceive.Rows.Clear()
        dgvFreshOrganicLongan.Rows.Clear()
        dgvDryingOrganicLongan.Rows.Clear()
        dgvOrganicLonganTea.Rows.Clear()
        dgvOrganicLonganTeaBake.Rows.Clear()
        dgvOrganicLonganTeaPacking.Rows.Clear()
        dgvDryingOrganicLonganPacking.Rows.Clear()
        dgvDryingOrganicLonganFleshGoldenPacking.Rows.Clear()
        dgvStockInventoryControl.Rows.Clear()
        dgvDryingOrganicLonganFleshGoldenBake.Rows.Clear()
        dgvDryingOrganicLonganFleshGolden.Rows.Clear()

        cbkMember.Checked = False
        ckbProductMemberReceive.Checked = False
        ckbDryingOrganicLongan.Checked = False
        ckbOrganicLonganTea.Checked = False
        ckbOrganicLonganTeaBake.Checked = False
        ckbOrganicLonganTeaPacking.Checked = False
        ckbDryingOrganicLonganPacking.Checked = False
        ckbDryingOrganicLonganFleshGoldenBake.Checked = False
        ckbFreshOrganicLongan.Checked = False
        ckbDryingOrganicLonganFleshGolden.Checked = False
        ckbDryingOrganicLonganFleshGoldenPacking.Checked = False
        ckbStockInventoryControl.Checked = False
    End Sub

    Private Sub cmdPrint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdPrint.Click
        Dim dsReportMPD As New dsReportMPD
        Dim RpMTP As New ReprotMonitoringProduct
        '######################################Report การจัดการลำไยอินทรีย์######################################
        Try
            If dsReportMPD.dtFLM.Rows.Count > 0 Then
                dsReportMPD.dtFLM.Rows.Clear()
            End If
            For i = 0 To dgvFreshOrganicLongan.Rows.Count - 1
                Dim Dgvdr As New DataGridViewRow
                Dgvdr = dgvFreshOrganicLongan.Rows(i)
                dsReportMPD.dtFLM.Rows.Add(Dgvdr.Cells(0).Value, Dgvdr.Cells(1).Value, Dgvdr.Cells(2).Value, Dgvdr.Cells(3).Value, Dgvdr.Cells(4).Value, Dgvdr.Cells(5).Value _
                                          , Dgvdr.Cells(6).Value, Dgvdr.Cells(7).Value, Dgvdr.Cells(8).Value, Dgvdr.Cells(9).Value)
            Next
        Catch ex As Exception
        End Try
        '######################################Report การจัดควนลำไยอินทรีย์สด ######################################
        Try
            If dsReportMPD.dtDLG.Rows.Count > 0 Then
                dsReportMPD.dtDLG.Rows.Clear()
            End If
            For i = 0 To dgvDryingOrganicLonganFleshGolden.Rows.Count - 1
                Dim Dgvdr As New DataGridViewRow
                Dgvdr = dgvDryingOrganicLonganFleshGolden.Rows(i)
                dsReportMPD.dtDLG.Rows.Add(Dgvdr.Cells(0).Value, Dgvdr.Cells(1).Value, Dgvdr.Cells(2).Value, Dgvdr.Cells(3).Value, Dgvdr.Cells(4).Value, Dgvdr.Cells(5).Value _
                                         , Dgvdr.Cells(6).Value)
            Next
        Catch ex As Exception
        End Try
        '######################################Report การแปรรูปลำไยอินทรีย์สีทอง  ######################################
        Try
            If dsReportMPD.dtDLGB.Rows.Count > 0 Then
                dsReportMPD.dtDLGB.Rows.Clear()
            End If
            For i = 0 To dgvDryingOrganicLonganFleshGoldenBake.Rows.Count - 1
                Dim Dgvdr As New DataGridViewRow
                Dgvdr = dgvDryingOrganicLonganFleshGoldenBake.Rows(i)
                dsReportMPD.dtDLGB.Rows.Add(Dgvdr.Cells(0).Value, Dgvdr.Cells(1).Value, Dgvdr.Cells(2).Value, Dgvdr.Cells(3).Value, Dgvdr.Cells(4).Value, Dgvdr.Cells(5).Value _
                                         , Dgvdr.Cells(6).Value, Dgvdr.Cells(7).Value, Dgvdr.Cells(8).Value)
            Next
        Catch ex As Exception
        End Try
        '###################################### การแปรรูปลำไยอินทรีย์อบแห้ง ######################################
        Try
            If dsReportMPD.dtDL.Rows.Count > 0 Then
                dsReportMPD.dtDL.Rows.Clear()
            End If
            For i = 0 To dgvDryingOrganicLongan.Rows.Count - 1
                Dim Dgvdr As New DataGridViewRow
                Dgvdr = dgvDryingOrganicLongan.Rows(i)
                dsReportMPD.dtDL.Rows.Add(Dgvdr.Cells(0).Value, Dgvdr.Cells(1).Value, Dgvdr.Cells(2).Value, Dgvdr.Cells(3).Value, Dgvdr.Cells(4).Value, Dgvdr.Cells(5).Value _
                                         , Dgvdr.Cells(6).Value, Dgvdr.Cells(7).Value)
            Next
        Catch ex As Exception
        End Try
        '###################################### การแกะลำไยอบแห้ง ######################################
        Try
            If dsReportMPD.dtTL.Rows.Count > 0 Then
                dsReportMPD.dtTL.Rows.Clear()
            End If
            For i = 0 To dgvOrganicLonganTea.Rows.Count - 1
                Dim Dgvdr As New DataGridViewRow
                Dgvdr = dgvOrganicLonganTea.Rows(i)
                dsReportMPD.dtTL.Rows.Add(Dgvdr.Cells(0).Value, Dgvdr.Cells(1).Value, Dgvdr.Cells(2).Value, Dgvdr.Cells(3).Value, Dgvdr.Cells(4).Value, Dgvdr.Cells(5).Value _
                                         , Dgvdr.Cells(6).Value)
            Next
        Catch ex As Exception
        End Try
        '###################################### การแปรรูปชาลำไย  ######################################
        Try
            If dsReportMPD.dtTLB.Rows.Count > 0 Then
                dsReportMPD.dtTLB.Rows.Clear()
            End If
            For i = 0 To dgvOrganicLonganTeaBake.Rows.Count - 1
                Dim Dgvdr As New DataGridViewRow
                Dgvdr = dgvOrganicLonganTeaBake.Rows(i)
                dsReportMPD.dtTLB.Rows.Add(Dgvdr.Cells(0).Value, Dgvdr.Cells(1).Value, Dgvdr.Cells(2).Value, Dgvdr.Cells(3).Value, Dgvdr.Cells(4).Value, Dgvdr.Cells(5).Value _
                                         , Dgvdr.Cells(6).Value, Dgvdr.Cells(7).Value)
            Next
        Catch ex As Exception
        End Try
        '###################################### การบรรจุผลิตภัณฑ์  ######################################
        Try
            If dsReportMPD.dtPack.Rows.Count > 0 Then
                dsReportMPD.dtPack.Rows.Clear()
            End If

            If mtbBarcode.Text.Remove(0, 18).Remove(1, 1) = "1" Then
                dsReportMPD.dtPack.Rows.Add("", "", "", "", "", "", "", "", "", "")
            ElseIf mtbBarcode.Text.Remove(0, 18).Remove(1, 1) = "2" Then
                For i = 0 To dgvDryingOrganicLonganPacking.Rows.Count - 1
                    Dim Dgvdr As New DataGridViewRow
                    Dgvdr = dgvDryingOrganicLonganPacking.Rows(i)
                    dsReportMPD.dtPack.Rows.Add(Dgvdr.Cells(0).Value, Dgvdr.Cells(1).Value, Dgvdr.Cells(2).Value, Dgvdr.Cells(3).Value, Dgvdr.Cells(4).Value, Dgvdr.Cells(5).Value _
                                        , Dgvdr.Cells(6).Value, Dgvdr.Cells(7).Value, Dgvdr.Cells(8).Value, Dgvdr.Cells(9).Value)
                Next
            ElseIf mtbBarcode.Text.Remove(0, 18).Remove(1, 1) = "3" Then
                For i = 0 To dgvDryingOrganicLonganFleshGoldenPacking.Rows.Count - 1
                    Dim Dgvdr As New DataGridViewRow
                    Dgvdr = dgvDryingOrganicLonganFleshGoldenPacking.Rows(i)
                    dsReportMPD.dtPack.Rows.Add(Dgvdr.Cells(0).Value, Dgvdr.Cells(1).Value, Dgvdr.Cells(2).Value, Dgvdr.Cells(3).Value, Dgvdr.Cells(4).Value, Dgvdr.Cells(5).Value _
                                        , Dgvdr.Cells(6).Value, Dgvdr.Cells(7).Value, Dgvdr.Cells(8).Value, Dgvdr.Cells(9).Value)
                Next
            ElseIf mtbBarcode.Text.Remove(0, 18).Remove(1, 1) = "4" Then
                For i = 0 To dgvOrganicLonganTeaPacking.Rows.Count - 1
                    Dim Dgvdr As New DataGridViewRow
                    Dgvdr = dgvOrganicLonganTeaPacking.Rows(i)
                    dsReportMPD.dtPack.Rows.Add(Dgvdr.Cells(0).Value, Dgvdr.Cells(1).Value, Dgvdr.Cells(2).Value, Dgvdr.Cells(3).Value, Dgvdr.Cells(4).Value, Dgvdr.Cells(5).Value _
                                        , Dgvdr.Cells(6).Value, Dgvdr.Cells(7).Value, Dgvdr.Cells(8).Value, Dgvdr.Cells(9).Value)
                Next
            End If
        Catch ex As Exception
        End Try
        '######################################report เบิกจ่าย  ######################################
        Try
            If dsReportMPD.dtSic.Rows.Count > 0 Then
                dsReportMPD.dtSic.Rows.Clear()
            End If
            For i = 0 To dgvStockInventoryControl.Rows.Count - 1
                Dim Dgvdr As New DataGridViewRow
                Dgvdr = dgvStockInventoryControl.Rows(i)
                dsReportMPD.dtSic.Rows.Add(Dgvdr.Cells(0).Value, Dgvdr.Cells(1).Value, Dgvdr.Cells(2).Value, Dgvdr.Cells(3).Value, Dgvdr.Cells(4).Value, Dgvdr.Cells(5).Value _
                                          , Dgvdr.Cells(6).Value, Dgvdr.Cells(7).Value, Dgvdr.Cells(8).Value)
            Next
        Catch ex As Exception
        End Try
        '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
        RpMTP.SetDataSource(dsReportMPD)
        '######################################ข้อมูลผลิตภัณฑ์ลำไยอินทรีย์  ######################################
        Try
            RpMTP.SetParameterValue("mtbBarcode", mtbBarcode.Text)
            RpMTP.SetParameterValue("NameProduct", lblNameProduct.Text)
            RpMTP.SetParameterValue("SizeProduct", lblSizeProduct.Text)
            RpMTP.SetParameterValue("TypePacking", lblTypePacking.Text)
            RpMTP.SetParameterValue("NameCustomer", lblNameCustomer.Text)
        Catch ex As Exception
        End Try
        '###################################### ข้อมูลสมาชิกและแปลงผลผลิต  ######################################
        Try
            RpMTP.SetParameterValue("Number_Member", lblNumber_Member.Text)
            RpMTP.SetParameterValue("Name_Full", lblName_Full.Text)
            RpMTP.SetParameterValue("Address", lblAddress.Text)
            RpMTP.SetParameterValue("Phone", lblPhone.Text)
            RpMTP.SetParameterValue("Fax", lblFax.Text)
            RpMTP.SetParameterValue("blockNo", lblblockBarcode.Text)
            RpMTP.SetParameterValue("Seblock", lblSeblockBarcode.Text)
            RpMTP.SetParameterValue("AddressBlock", lblAddressBarcode.Text)
            RpMTP.SetParameterValue("Rai", lblRaiBarcode.Text)
            RpMTP.SetParameterValue("Job", lblJobBarcode.Text)
            RpMTP.SetParameterValue("Squaremeters", lblSquaremetersBarcode.Text)
        Catch ex As Exception
        End Try
        '###################################### ข้อมูลการรับผลผลิตสมาชิก  ######################################
        Try
            Dim Dgvdr As New DataGridViewRow
            Dgvdr = dgvDetailProductReceive.Rows(0)
            RpMTP.SetParameterValue("LonganSpecies", lblLonganSpecies.Text)
            RpMTP.SetParameterValue("ShellQuality", lblShellQuality.Text)
            RpMTP.SetParameterValue("DiseaseAndInsects", lblDiseaseAndInsects.Text)
            RpMTP.SetParameterValue("TestResults", lblTestResults.Text)
            RpMTP.SetParameterValue("TypeLonganPMR", Dgvdr.Cells(0).Value)
            RpMTP.SetParameterValue("WeightBeforeExtraction", CNmb(CStr(Dgvdr.Cells(1).Value)))
            RpMTP.SetParameterValue("WeightLoss", CNmb(CStr(Dgvdr.Cells(2).Value)))
            RpMTP.SetParameterValue("WeightNotOver", CNmb(CStr(Dgvdr.Cells(3).Value)))
            RpMTP.SetParameterValue("PriceNotPass", CNmb(CStr(Dgvdr.Cells(4).Value)))
            RpMTP.SetParameterValue("AmountNotPass", CNmb(CStr(Dgvdr.Cells(5).Value)))
            RpMTP.SetParameterValue("WeightThrough", CNmb(CStr(Dgvdr.Cells(6).Value)))
            RpMTP.SetParameterValue("PriceThrough", CNmb(CStr(Dgvdr.Cells(7).Value)))
            RpMTP.SetParameterValue("AmountThrough", CNmb(CStr(Dgvdr.Cells(8).Value)))
            RpMTP.SetParameterValue("TotalPayments", CNmb(CStr(Dgvdr.Cells(9).Value)))
            RpMTP.SetParameterValue("SenderName", lblSenderName.Text)
            RpMTP.SetParameterValue("SenderDate", lblSenderDate.Text)
            RpMTP.SetParameterValue("InspectorName", lblInspectorName.Text)
            RpMTP.SetParameterValue("InspectorDate", lblInspectorDate.Text)
        Catch ex As Exception
        End Try
        '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
        '###########################  Section   ###########################################
        If cbkMember.Checked = False Then
            RpMTP.ReportDefinition.Sections("SectionMember").SectionFormat.EnableSuppress = True
        End If
        If ckbProductMemberReceive.Checked = False Then
            RpMTP.ReportDefinition.Sections("SectionPMR").SectionFormat.EnableSuppress = True
        End If
        If ckbFreshOrganicLongan.Checked = False Then
            RpMTP.ReportDefinition.Sections("SectionFLM").SectionFormat.EnableSuppress = True
        End If
        If ckbDryingOrganicLonganFleshGolden.Checked = False Then
            RpMTP.ReportDefinition.Sections("SectionDLG").SectionFormat.EnableSuppress = True
        End If
        If ckbDryingOrganicLonganFleshGoldenBake.Checked = False Then
            RpMTP.ReportDefinition.Sections("SectionDLGB").SectionFormat.EnableSuppress = True
        End If
        If ckbDryingOrganicLongan.Checked = False Then
            RpMTP.ReportDefinition.Sections("SectionDL").SectionFormat.EnableSuppress = True
        End If
        If ckbOrganicLonganTea.Checked = False Then
            RpMTP.ReportDefinition.Sections("SectionTL").SectionFormat.EnableSuppress = True
        End If
        If ckbOrganicLonganTeaBake.Checked = False Then
            RpMTP.ReportDefinition.Sections("SectionTLB").SectionFormat.EnableSuppress = True
        End If
        If mtbBarcode.Text.Remove(0, 18).Remove(1, 1) = "1" Then
            RpMTP.ReportDefinition.Sections("SectionPack").SectionFormat.EnableSuppress = True
        ElseIf mtbBarcode.Text.Remove(0, 18).Remove(1, 1) = "2" Then
            If ckbDryingOrganicLonganPacking.Checked = False Then
                RpMTP.ReportDefinition.Sections("SectionPack").SectionFormat.EnableSuppress = True
            End If
        ElseIf mtbBarcode.Text.Remove(0, 18).Remove(1, 1) = "3" Then
            If ckbDryingOrganicLonganFleshGoldenPacking.Checked = False Then
                RpMTP.ReportDefinition.Sections("SectionPack").SectionFormat.EnableSuppress = True
            End If
        ElseIf mtbBarcode.Text.Remove(0, 18).Remove(1, 1) = "4" Then
            If ckbOrganicLonganTeaPacking.Checked = False Then
                RpMTP.ReportDefinition.Sections("SectionPack").SectionFormat.EnableSuppress = True
            End If
        End If
        If ckbStockInventoryControl.Checked = False Then
            RpMTP.ReportDefinition.Sections("SectionSIC").SectionFormat.EnableSuppress = True
        End If
        '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
        TemplteReport.Show()
        TemplteReport.MdiParent = MainAllMDI
        TemplteReport.CRVReport.ReportSource = RpMTP
    End Sub

    Private Sub cmdSearchBarCode_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdSearchBarCode.Click
        ViewBarcodeForm.ShowDialog()
    End Sub

    Public Sub SearchMonitoringProductsForm()
        Dim Sql As String = ""
        Dim dtMonitoringProduct As New DataTable()
        Dim bar As String = ""

        Com = New SqlCommand()
        With Conn
            If .State = ConnectionState.Open Then .Close()
            .ConnectionString = strConn
            .Open()
        End With

        ClearData()
        'bar = mtbBarcode.Text.Remove(1, 16).ToString
        'If bar = "R" Then

        'ElseIf bar = "U" Then
        'Sql = "SELECT BarCode FROM DetailGroup WHERE ID_DetailGroup=@ID_DetailGroup"
        'With Com
        '.Parameters.Clear()
        '.CommandType = CommandType.Text
        '.CommandText = Sql
        '.Connection = Conn
        '.Parameters.Add("@ID_DetailGroup", SqlDbType.NVarChar).Value = mtbBarcode.Text.Remove(6, 11).ToString
        'dr = .ExecuteReader()
        'If dr.HasRows Then
        ' dtMonitoringProduct.Load(dr)
        'ComboBox1.SelectedIndex = CInt(dtMonitoringProduct.Rows(0).Item("BarCode").ToString())
        'End If
        'End With
        'dr.Close()


        'Else



        '################################## ค้นหาหมายเลขบาร์โค้ดใน StorkProduct ##############################
        Sql = "SELECT BarCode FROM StorkProduct WHERE BarCode=@BarCode"
        With Com
            .Parameters.Clear()
            .CommandType = CommandType.Text
            .CommandText = Sql
            .Connection = Conn
            .Parameters.Add("@BarCode", SqlDbType.NVarChar).Value = mtbBarcode.Text.Trim()
            dr = .ExecuteReader()
            If dr.HasRows Then

            Else
                MessageBox.Show("ผลผลิตของหมายเลขบาร์โค้ดยังไม่ผ่านกระบวนการผลิตหรือหมายเลขบาร์โค้ดนี้ไม่มีในระบบ !!!", "ผลการทำงาน", MessageBoxButtons.OK, MessageBoxIcon.Information)
                mtbBarcode.Text = ""
                mtbBarcode.SelectionStart = 0
                Exit Sub
            End If
        End With
        dr.Close()
        '############################## ค้นหาข้อมูลสมาชิก ##############################
        Sql = "SELECT M.Number_Member,M.Name_F+'  '+M.Name_L AS Name_Full,M.No_Address,M.Villages,M.SubDistrict,M.District,M.Province,M.Zip_Code,"
        Sql &= "M.Phone,M.Fax,F.Se_Block,F.Num_Block,F.No_Block,F.Rai,F.Job,F.Squaremeters"
        Sql &= " FROM Member AS M,Farm AS F WHERE(M.Id_Member=@Id_Member AND M.Id_Member=F.Id_Member AND F.Num_Block=@Number_Block)"
        dtMonitoringProduct = New DataTable()
        With Com
            .Parameters.Clear()
            .CommandType = CommandType.Text
            .CommandText = Sql
            .Connection = Conn
            .Parameters.Add("@Id_Member", SqlDbType.NVarChar).Value = CStr(mtbBarcode.Text.Remove(3, 17))
            .Parameters.Add("@Number_Block", SqlDbType.NVarChar).Value = CStr(mtbBarcode.Text.Remove(0, 3).Remove(2, 15))
            dr = .ExecuteReader()
            If dr.HasRows Then
                dtMonitoringProduct.Load(dr)
                lblNumber_Member.Text = dtMonitoringProduct.Rows(0).Item("Number_Member").ToString()
                lblName_Full.Text = dtMonitoringProduct.Rows(0).Item("Name_Full").ToString()
                lblAddress.Text = dtMonitoringProduct.Rows(0).Item("No_Address").ToString() & "  หมู่" & dtMonitoringProduct.Rows(0).Item("Villages").ToString() & _
                        "  ต." & dtMonitoringProduct.Rows(0).Item("SubDistrict").ToString() & "  อ." & dtMonitoringProduct.Rows(0).Item("District").ToString() & _
                        "  จ." & dtMonitoringProduct.Rows(0).Item("Province").ToString() & "  " & dtMonitoringProduct.Rows(0).Item("Zip_Code").ToString()
                lblPhone.Text = dtMonitoringProduct.Rows(0).Item("Phone").ToString()
                lblFax.Text = dtMonitoringProduct.Rows(0).Item("Fax").ToString()
                lblblockBarcode.Text = dtMonitoringProduct.Rows(0).Item("Num_Block").ToString()
                lblSeblockBarcode.Text = dtMonitoringProduct.Rows(0).Item("Se_Block").ToString()
                lblAddressBarcode.Text = dtMonitoringProduct.Rows(0).Item("No_Block").ToString()
                lblRaiBarcode.Text = dtMonitoringProduct.Rows(0).Item("Rai").ToString()
                lblJobBarcode.Text = dtMonitoringProduct.Rows(0).Item("Job").ToString()
                lblSquaremetersBarcode.Text = dtMonitoringProduct.Rows(0).Item("Squaremeters").ToString()
            End If
        End With
        dr.Close()
        '############################## ค้นหาข้อมูลการเก็บผลผลิตลำไยอินทรีย์ ##############################
        Sql = "SELECT T.NameLongan,P.SenderName,P.SenderDate,FS.Name_F,P.InspectorDate,"
        Sql &= "D.WeightBeforeExtraction,D.WeightLoss,D.WeightNotOver,D.PriceNotPass,D.AmountNotPass,D.WeightThrough,D.PriceThrough,D.AmountThrough,D.TotalPayments,"
        Sql &= "Q.LonganSpeciesDot,Q.LonganSpeciesPink,Q.LonganSpeciesBanHo60,Q.LonganSpeciesPwgtag,Q.LonganSpeciesOther,Q.ShellQualityThin,"
        Sql &= "Q.ShellQualityThick,Q.ShellQualityNoblame,Q.ShellQualityTheBlame,Q.NoDiseaseAndInsects,Q.DiseaseAndInsectsHave,Q.TestResultsThrough,Q.TestResultsNotThrough"
        Sql &= " FROM ProductMemberReceive AS P,qualityLongan AS Q,DetailProductReceive AS D,TypeLongan AS T,FactoryStaff AS FS"
        Sql &= " WHERE(P.PMR=@PMR AND Q.PMRT=@PMR AND D.PMR=@PMR AND T.Id_Longan=@Id_Longan AND FS.IDFactoryStaff=P.IDFactoryStaff AND D.Id_Longan=@Id_Longan)"
        dtMonitoringProduct = New DataTable()
        With Com
            .Parameters.Clear()
            .CommandType = CommandType.Text
            .CommandText = Sql
            .Connection = Conn
            .Parameters.Add("@PMR", SqlDbType.NVarChar).Value = CStr(mtbBarcode.Text.Remove(0, 5).Remove(2, 2).Remove(6, 7))
            .Parameters.Add("@Id_Longan", SqlDbType.NVarChar).Value = CStr(mtbBarcode.Text.Remove(0, 7).Remove(2, 11))
            dr = .ExecuteReader()
            If dr.HasRows Then
                dtMonitoringProduct.Load(dr)
                If dtMonitoringProduct.Rows(0).Item("LonganSpeciesDot").ToString() = "1" Then
                    lblLonganSpecies.Text = "ดอ"
                ElseIf dtMonitoringProduct.Rows(0).Item("LonganSpeciesPink").ToString() = "1" Then
                    lblLonganSpecies.Text = "สีชมพู"
                ElseIf dtMonitoringProduct.Rows(0).Item("LonganSpeciesBanHo60").ToString() = "1" Then
                    lblLonganSpecies.Text = "บ้านโฮ่ง 60"
                ElseIf dtMonitoringProduct.Rows(0).Item("LonganSpeciesPwgtag").ToString() = "1" Then
                    lblLonganSpecies.Text = "พวงทอง"
                ElseIf dtMonitoringProduct.Rows(0).Item("LonganSpeciesOther").ToString() <> "0" Then
                    lblLonganSpecies.Text = dtMonitoringProduct.Rows(0).Item("LonganSpeciesOther").ToString()
                End If
                If dtMonitoringProduct.Rows(0).Item("ShellQualityThin").ToString() = "1" Then lblShellQuality.Text = "บาง,"
                If dtMonitoringProduct.Rows(0).Item("ShellQualityThick").ToString() = "1" Then lblShellQuality.Text &= "หนา,"
                If dtMonitoringProduct.Rows(0).Item("ShellQualityNoblame").ToString() = "1" Then lblShellQuality.Text &= "ไม่มีตำหนิ,"
                If dtMonitoringProduct.Rows(0).Item("ShellQualityTheBlame").ToString() <> "0" Then lblShellQuality.Text &= "มีตำหนิ  " & dtMonitoringProduct.Rows(0).Item("ShellQualityTheBlame").ToString()
                If dtMonitoringProduct.Rows(0).Item("NoDiseaseAndInsects").ToString() = "1" Then
                    lblDiseaseAndInsects.Text = "ไม่มี"
                ElseIf dtMonitoringProduct.Rows(0).Item("DiseaseAndInsectsHave").ToString() <> "0" Then
                    lblDiseaseAndInsects.Text = "มี ระบุ " & dtMonitoringProduct.Rows(0).Item("DiseaseAndInsectsHave").ToString()
                End If
                If dtMonitoringProduct.Rows(0).Item("TestResultsThrough").ToString() = "1" Then
                    lblTestResults.Text = "ผ่าน"
                ElseIf dtMonitoringProduct.Rows(0).Item("TestResultsNotThrough").ToString() = "1" Then
                    lblTestResults.Text = "ไม่ผ่าน"
                End If

                lblSenderName.Text = dtMonitoringProduct.Rows(0).Item("SenderName").ToString()
                lblSenderDate.Text = CDate(dtMonitoringProduct.Rows(0).Item("SenderDate")).ToString()
                lblInspectorName.Text = dtMonitoringProduct.Rows(0).Item("Name_F").ToString()
                lblInspectorDate.Text = CDate(dtMonitoringProduct.Rows(0).Item("InspectorDate")).ToString()

                dgvDetailProductReceive.Rows.Add()
                dgvDetailProductReceive.Rows(0).Cells(0).Value = dtMonitoringProduct.Rows(0).Item("NameLongan").ToString()
                dgvDetailProductReceive.Rows(0).Cells(1).Value = dtMonitoringProduct.Rows(0).Item("WeightBeforeExtraction").ToString()
                dgvDetailProductReceive.Rows(0).Cells(2).Value = dtMonitoringProduct.Rows(0).Item("WeightLoss").ToString()
                dgvDetailProductReceive.Rows(0).Cells(3).Value = dtMonitoringProduct.Rows(0).Item("WeightNotOver").ToString()
                dgvDetailProductReceive.Rows(0).Cells(4).Value = dtMonitoringProduct.Rows(0).Item("PriceNotPass").ToString()
                dgvDetailProductReceive.Rows(0).Cells(5).Value = dtMonitoringProduct.Rows(0).Item("AmountNotPass").ToString()
                dgvDetailProductReceive.Rows(0).Cells(6).Value = dtMonitoringProduct.Rows(0).Item("WeightThrough").ToString()
                dgvDetailProductReceive.Rows(0).Cells(7).Value = dtMonitoringProduct.Rows(0).Item("PriceThrough").ToString()
                dgvDetailProductReceive.Rows(0).Cells(8).Value = dtMonitoringProduct.Rows(0).Item("AmountThrough").ToString()
                dgvDetailProductReceive.Rows(0).Cells(9).Value = dtMonitoringProduct.Rows(0).Item("TotalPayments").ToString()
            End If
        End With
        dr.Close()
        '############################## ค้นหาข้อมูลผลิตภัณฑ์ลำไยอินทรีย์ ##############################
        If mtbBarcode.Text.Remove(0, 18).Remove(1, 1) = "1" Then
            gpbFreshOrganicLongan.Show()
            gpbStockInventoryControl.Show()
            gpbDryingOrganicLonganFleshGolden.Hide()
            gpbDryingOrganicLonganFleshGoldenBake.Hide()
            gpbDryingOrganicLongan.Hide()
            gpbDryingOrganicLonganPacking.Hide()
            gpbOrganicLonganTea.Hide()
            gpbOrganicLonganTeaBake.Hide()
            gpbOrganicLonganTeaPacking.Hide()
            gpbFreshOrganicLongan.Location = New Point(25, gpbProductMemberReceive.Location().Y() + 353)
            gpbStockInventoryControl.Location = New Point(25, gpbFreshOrganicLongan.Location().Y() + 231)

            cmdPrint.Location = New Point(817, gpbStockInventoryControl.Location().Y() + 229)
            lblcmdprint.Location = New Point(623, gpbStockInventoryControl.Location().Y() + 264)
            lblLast.Location = New Point(392, gpbStockInventoryControl.Location().Y() + 275)
            '############################## ค้นหาข้อมูลผลิตภัณฑ์ลำไยอินทรีย์สด ##############################
            Sql = "SELECT T.NameTypeProduct,F.SizePackaging,F.TypePackaging"
            Sql &= " FROM FreshOrganicLonganManaging AS F,TypeProduct AS T"
            Sql &= " WHERE F.BarCode=@BarCode AND T.ID_TypeProduct=@ID_TypeProduct "
            dtMonitoringProduct = New DataTable()
            With Com
                .Parameters.Clear()
                .CommandType = CommandType.Text
                .CommandText = Sql
                .Connection = Conn
                .Parameters.Add("@BarCode", SqlDbType.NVarChar).Value = mtbBarcode.Text.Trim()
                .Parameters.Add("@ID_TypeProduct", SqlDbType.NVarChar).Value = mtbBarcode.Text.Remove(0, 18)
                dr = .ExecuteReader()
                If dr.HasRows Then
                    dtMonitoringProduct.Load(dr)
                    lblNameProduct.Text = dtMonitoringProduct.Rows(0).Item("NameTypeProduct").ToString()
                    lblSizeProduct.Text = dtMonitoringProduct.Rows(0).Item("SizePackaging").ToString()
                    lblTypePacking.Text = dtMonitoringProduct.Rows(0).Item("TypePackaging").ToString()
                End If
            End With
            dr.Close()
            '################################ ค้นหาข้อมูลการแปรรูปลำไยอินทรียฺ์ ################################
            Sql = "SELECT T.NameLongan,F.DateAdd,F.LotNo,F.WeightBeforePacking,F.WeightLoss,F.WeightNotOver,F.WeightThrough,F.SizePackaging,F.TotalQuantity,F.TotalProducts,FS.Name_F"
            Sql &= " FROM FreshOrganicLonganManaging AS F,TypeLongan AS T,FactoryStaff AS FS"
            Sql &= " WHERE  F.BarCode=@BarCode AND F.Id_Longan=T.Id_Longan AND FS.IDFactoryStaff=F.IDFactoryStaffdgv"
            dtMonitoringProduct = New DataTable()
            With Com
                .Parameters.Clear()
                .CommandType = CommandType.Text
                .CommandText = Sql
                .Connection = Conn
                .Parameters.Add("@BarCode", SqlDbType.NVarChar).Value = mtbBarcode.Text.Trim()
                dr = .ExecuteReader()
                If dr.HasRows Then
                    dtMonitoringProduct.Load(dr)
                    For i = 0 To dtMonitoringProduct.Rows.Count - 1
                        Dim dtpdgv As New CalendarCell
                        dgvFreshOrganicLongan.Rows.Add()
                        dgvFreshOrganicLongan(0, dgvFreshOrganicLongan.Rows.Count - 1) = dtpdgv
                        dgvFreshOrganicLongan.Rows(dgvFreshOrganicLongan.Rows.Count - 1).Cells(0).Value = CDate(dtMonitoringProduct.Rows(i).Item("DateAdd"))
                        dgvFreshOrganicLongan.Rows(dgvFreshOrganicLongan.Rows.Count - 1).Cells(1).Value = dtMonitoringProduct.Rows(i).Item("LotNo").ToString()
                        dgvFreshOrganicLongan.Rows(dgvFreshOrganicLongan.Rows.Count - 1).Cells(2).Value = dtMonitoringProduct.Rows(i).Item("NameLongan").ToString()
                        dgvFreshOrganicLongan.Rows(dgvFreshOrganicLongan.Rows.Count - 1).Cells(3).Value = dtMonitoringProduct.Rows(i).Item("WeightBeforePacking").ToString()
                        dgvFreshOrganicLongan.Rows(dgvFreshOrganicLongan.Rows.Count - 1).Cells(4).Value = dtMonitoringProduct.Rows(i).Item("WeightLoss").ToString() + dtMonitoringProduct.Rows(i).Item("WeightNotOver").ToString()
                        dgvFreshOrganicLongan.Rows(dgvFreshOrganicLongan.Rows.Count - 1).Cells(5).Value = dtMonitoringProduct.Rows(i).Item("WeightThrough").ToString()
                        dgvFreshOrganicLongan.Rows(dgvFreshOrganicLongan.Rows.Count - 1).Cells(6).Value = dtMonitoringProduct.Rows(i).Item("SizePackaging").ToString()
                        dgvFreshOrganicLongan.Rows(dgvFreshOrganicLongan.Rows.Count - 1).Cells(7).Value = dtMonitoringProduct.Rows(i).Item("TotalQuantity").ToString()
                        dgvFreshOrganicLongan.Rows(dgvFreshOrganicLongan.Rows.Count - 1).Cells(8).Value = dtMonitoringProduct.Rows(i).Item("TotalProducts").ToString()
                        dgvFreshOrganicLongan.Rows(dgvFreshOrganicLongan.Rows.Count - 1).Cells(9).Value = dtMonitoringProduct.Rows(i).Item("Name_F").ToString()
                    Next
                End If
            End With
            dr.Close()
            '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
        ElseIf mtbBarcode.Text.Remove(0, 18).Remove(1, 1) = "2" Then
            gpbFreshOrganicLongan.Hide()
            gpbStockInventoryControl.Show()
            gpbDryingOrganicLonganFleshGolden.Hide()
            gpbDryingOrganicLonganFleshGoldenBake.Hide()
            gpbDryingOrganicLonganFleshGoldenPacking.Hide()
            gpbOrganicLonganTea.Hide()
            gpbOrganicLonganTeaBake.Hide()
            gpbOrganicLonganTeaPacking.Hide()
            gpbDryingOrganicLongan.Show()
            gpbDryingOrganicLonganPacking.Show()

            gpbDryingOrganicLongan.Location = New Point(25, gpbProductMemberReceive.Location().Y() + 353)
            gpbDryingOrganicLonganPacking.Location = New Point(25, gpbDryingOrganicLongan.Location().Y() + 231)
            gpbStockInventoryControl.Location = New Point(25, gpbDryingOrganicLonganPacking.Location().Y() + 231)
            cmdPrint.Location = New Point(817, gpbStockInventoryControl.Location().Y() + 229)
            lblcmdprint.Location = New Point(623, gpbStockInventoryControl.Location().Y() + 264)
            lblLast.Location = New Point(392, gpbStockInventoryControl.Location().Y() + 275)
            '############################## ค้นหาข้อมูลผลิตภัณฑ์ลำไยอินทรีย์อบแห้งทั้งผล ##############################
            Sql = "SELECT T.NameTypeProduct,D.SizePackaging,D.TypePackaging"
            Sql &= " FROM DryingOrganicLonganPacking AS D,TypeProduct AS T"
            Sql &= " WHERE D.BarCode=@BarCode AND T.ID_TypeProduct=@ID_TypeProduct AND T.ID_TypeProduct=D.ID_TypeProduct"
            dtMonitoringProduct = New DataTable()
            With Com
                .Parameters.Clear()
                .CommandType = CommandType.Text
                .CommandText = Sql
                .Connection = Conn
                .Parameters.Add("@BarCode", SqlDbType.NVarChar).Value = mtbBarcode.Text.Trim()
                .Parameters.Add("@ID_TypeProduct", SqlDbType.NVarChar).Value = mtbBarcode.Text.Remove(0, 18)
                dr = .ExecuteReader()
                If dr.HasRows Then
                    dtMonitoringProduct.Load(dr)
                    lblNameProduct.Text = dtMonitoringProduct.Rows(0).Item("NameTypeProduct").ToString()
                    lblSizeProduct.Text = dtMonitoringProduct.Rows(0).Item("SizePackaging").ToString()
                    lblTypePacking.Text = dtMonitoringProduct.Rows(0).Item("TypePackaging").ToString()
                End If
            End With
            dr.Close()
            '############################## ค้นหาข้อมูลการแปรรูปลำไยอินทรีย์อบแห้ง ##############################
            Sql = "SELECT T.NameLongan,D.DateAdd,D.LotNo,D.LamiFreshWeight,D.WeightLoss,D.LmaiDryWeight,D.OvenNumber,FS.Name_F"
            Sql &= " FROM DryingOrganicLonganBake AS D,TypeLongan AS T,FactoryStaff AS FS"
            Sql &= " WHERE D.BarCode=@BarCode AND D.LotNo=@LotNo AND D.Id_Longan=T.Id_Longan AND FS.IDFactoryStaff=D.IDFactoryStaffdgv"
            dtMonitoringProduct = New DataTable()
            With Com
                .Parameters.Clear()
                .CommandType = CommandType.Text
                .CommandText = Sql
                .Connection = Conn
                .Parameters.Add("@BarCode", SqlDbType.NVarChar).Value = CStr(mtbBarcode.Text.Remove(13, 7))
                .Parameters.Add("@LotNo", SqlDbType.NVarChar).Value = "D" & CStr(mtbBarcode.Text.Remove(0, 13).Remove(5, 2)) & CStr(mtbBarcode.Text.Remove(0, 5).Remove(2, 13))
                dr = .ExecuteReader()
                If dr.HasRows Then
                    dtMonitoringProduct.Load(dr)
                    For i = 0 To dtMonitoringProduct.Rows.Count - 1
                        Dim dtpdgv As New CalendarCell
                        dgvDryingOrganicLongan.Rows.Add()
                        dgvDryingOrganicLongan(0, dgvDryingOrganicLongan.Rows.Count - 1) = dtpdgv
                        dgvDryingOrganicLongan.Rows(dgvDryingOrganicLongan.Rows.Count - 1).Cells(0).Value = CDate(dtMonitoringProduct.Rows(i).Item("DateAdd").ToString())
                        dgvDryingOrganicLongan.Rows(dgvDryingOrganicLongan.Rows.Count - 1).Cells(1).Value = dtMonitoringProduct.Rows(i).Item("LotNo").ToString()
                        dgvDryingOrganicLongan.Rows(dgvDryingOrganicLongan.Rows.Count - 1).Cells(2).Value = dtMonitoringProduct.Rows(i).Item("NameLongan").ToString()
                        dgvDryingOrganicLongan.Rows(dgvDryingOrganicLongan.Rows.Count - 1).Cells(3).Value = dtMonitoringProduct.Rows(i).Item("LamiFreshWeight").ToString()
                        dgvDryingOrganicLongan.Rows(dgvDryingOrganicLongan.Rows.Count - 1).Cells(4).Value = dtMonitoringProduct.Rows(i).Item("WeightLoss").ToString()
                        dgvDryingOrganicLongan.Rows(dgvDryingOrganicLongan.Rows.Count - 1).Cells(5).Value = dtMonitoringProduct.Rows(i).Item("LmaiDryWeight").ToString()
                        dgvDryingOrganicLongan.Rows(dgvDryingOrganicLongan.Rows.Count - 1).Cells(6).Value = dtMonitoringProduct.Rows(i).Item("OvenNumber").ToString()
                        dgvDryingOrganicLongan.Rows(dgvDryingOrganicLongan.Rows.Count - 1).Cells(7).Value = dtMonitoringProduct.Rows(i).Item("Name_F").ToString()
                    Next
                End If
            End With
            dr.Close()
            '############################## ค้นหาข้อมูลการบรรจุลำไยอินทรีย์อบแห้งทั้งผล ##############################
            Sql = "SELECT T.NameTypeProduct,G.DateAdd,G.LotNo,G.WeightBeforePackaging,G.SizePackaging,G.NumberPackagingPer,G.TotalPackageIncluded,G.TotalWeight,G.TypePackaging,FS.Name_F"
            Sql &= " FROM DryingOrganicLonganPacking AS G,TypeProduct AS T,FactoryStaff AS FS"
            Sql &= " WHERE G.BarCode=@BarCode AND G.LotNo=@LotNo AND G.ID_TypeProduct=T.ID_TypeProduct AND FS.IDFactoryStaff=G.IDFactoryStaffdgv"
            dtMonitoringProduct = New DataTable()
            With Com
                .Parameters.Clear()
                .CommandType = CommandType.Text
                .CommandText = Sql
                .Connection = Conn
                .Parameters.Add("@BarCode", SqlDbType.NVarChar).Value = mtbBarcode.Text
                .Parameters.Add("@LotNo", SqlDbType.NVarChar).Value = "D" & CStr(mtbBarcode.Text.Remove(0, 13).Remove(5, 2)) & CStr(mtbBarcode.Text.Remove(0, 5).Remove(2, 13))
                dr = .ExecuteReader()
                If dr.HasRows Then
                    dtMonitoringProduct.Load(dr)
                    For i = 0 To dtMonitoringProduct.Rows.Count - 1
                        Dim dtpdgv As New CalendarCell
                        dgvDryingOrganicLonganPacking.Rows.Add()
                        dgvDryingOrganicLonganPacking(0, dgvDryingOrganicLonganPacking.Rows.Count - 1) = dtpdgv
                        dgvDryingOrganicLonganPacking.Rows(dgvDryingOrganicLonganPacking.Rows.Count - 1).Cells(0).Value = CDate(dtMonitoringProduct.Rows(i).Item("DateAdd").ToString())
                        dgvDryingOrganicLonganPacking.Rows(dgvDryingOrganicLonganPacking.Rows.Count - 1).Cells(1).Value = dtMonitoringProduct.Rows(i).Item("LotNo").ToString()
                        dgvDryingOrganicLonganPacking.Rows(dgvDryingOrganicLonganPacking.Rows.Count - 1).Cells(2).Value = dtMonitoringProduct.Rows(i).Item("NameTypeProduct").ToString()
                        dgvDryingOrganicLonganPacking.Rows(dgvDryingOrganicLonganPacking.Rows.Count - 1).Cells(3).Value = dtMonitoringProduct.Rows(i).Item("WeightBeforePackaging").ToString()
                        dgvDryingOrganicLonganPacking.Rows(dgvDryingOrganicLonganPacking.Rows.Count - 1).Cells(4).Value = dtMonitoringProduct.Rows(i).Item("SizePackaging").ToString()
                        dgvDryingOrganicLonganPacking.Rows(dgvDryingOrganicLonganPacking.Rows.Count - 1).Cells(5).Value = dtMonitoringProduct.Rows(i).Item("NumberPackagingPer").ToString()
                        dgvDryingOrganicLonganPacking.Rows(dgvDryingOrganicLonganPacking.Rows.Count - 1).Cells(6).Value = dtMonitoringProduct.Rows(i).Item("TotalPackageIncluded").ToString()
                        dgvDryingOrganicLonganPacking.Rows(dgvDryingOrganicLonganPacking.Rows.Count - 1).Cells(7).Value = dtMonitoringProduct.Rows(i).Item("TotalWeight").ToString()
                        dgvDryingOrganicLonganPacking.Rows(dgvDryingOrganicLonganPacking.Rows.Count - 1).Cells(8).Value = dtMonitoringProduct.Rows(i).Item("TypePackaging").ToString()
                        dgvDryingOrganicLonganPacking.Rows(dgvDryingOrganicLonganPacking.Rows.Count - 1).Cells(9).Value = dtMonitoringProduct.Rows(i).Item("Name_F").ToString()
                    Next
                End If
            End With
            dr.Close()
            '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
        ElseIf mtbBarcode.Text.Remove(0, 18).Remove(1, 1) = "3" Then
            gpbFreshOrganicLongan.Hide()
            gpbStockInventoryControl.Show()
            gpbDryingOrganicLonganFleshGolden.Show()
            gpbDryingOrganicLonganFleshGoldenBake.Show()
            gpbDryingOrganicLonganFleshGoldenPacking.Show()
            gpbDryingOrganicLongan.Hide()
            gpbDryingOrganicLonganPacking.Hide()
            gpbOrganicLonganTea.Hide()
            gpbOrganicLonganTeaBake.Hide()
            gpbOrganicLonganTeaPacking.Hide()
            gpbDryingOrganicLonganFleshGolden.Location = New Point(25, gpbProductMemberReceive.Location().Y() + 353)
            gpbDryingOrganicLonganFleshGoldenBake.Location = New Point(25, gpbDryingOrganicLonganFleshGolden.Location().Y() + 231)
            gpbDryingOrganicLonganFleshGoldenPacking.Location = New Point(25, gpbDryingOrganicLonganFleshGoldenBake.Location().Y() + 231)
            gpbStockInventoryControl.Location = New Point(25, gpbDryingOrganicLonganFleshGoldenPacking.Location().Y() + 231)

            cmdPrint.Location = New Point(817, gpbStockInventoryControl.Location().Y() + 229)
            lblcmdprint.Location = New Point(623, gpbStockInventoryControl.Location().Y() + 264)
            lblLast.Location = New Point(392, gpbStockInventoryControl.Location().Y() + 275)
            '############################## ค้นหาข้อมูลผลิตภัณฑ์ลำไยอินทรีย์สีทอง ##############################
            Sql = "SELECT T.NameTypeProduct,D.SizePackaging,D.TypePackaging"
            Sql &= " FROM DryingOrganicLonganFleshGoldenPacking AS D,TypeProduct AS T"
            Sql &= " WHERE D.BarCode=@BarCode AND T.ID_TypeProduct=@ID_TypeProduct AND T.ID_TypeProduct=D.ID_TypeProduct"
            dtMonitoringProduct = New DataTable()
            With Com
                .Parameters.Clear()
                .CommandType = CommandType.Text
                .CommandText = Sql
                .Connection = Conn
                .Parameters.Add("@BarCode", SqlDbType.NVarChar).Value = mtbBarcode.Text.Trim()
                .Parameters.Add("@ID_TypeProduct", SqlDbType.NVarChar).Value = mtbBarcode.Text.Remove(0, 18)
                dr = .ExecuteReader()
                If dr.HasRows Then
                    dtMonitoringProduct.Load(dr)
                    lblNameProduct.Text = dtMonitoringProduct.Rows(0).Item("NameTypeProduct").ToString()
                    lblSizeProduct.Text = dtMonitoringProduct.Rows(0).Item("SizePackaging").ToString()
                    lblTypePacking.Text = dtMonitoringProduct.Rows(0).Item("TypePackaging").ToString()
                End If
            End With
            dr.Close()
            '############################## ค้นหาข้อมูลการควนลำไยอินทรีย์##############################
            Sql = "SELECT T.NameLongan,G.DateAdd,G.LotNo,G.InpusDLG,G.PeelAndSeed,G.LmaiMeat,FS.Name_F"
            Sql &= " FROM DryingOrganicLonganFleshGolden AS G,TypeLongan AS T,FactoryStaff AS FS"
            Sql &= " WHERE G.BarCode=@BarCode AND G.LotNo=@LotNo AND G.Id_Longan=T.Id_Longan AND FS.IDFactoryStaff=G.IDFactoryStaffdgv"
            dtMonitoringProduct = New DataTable()
            With Com
                .Parameters.Clear()
                .CommandType = CommandType.Text
                .CommandText = Sql
                .Connection = Conn
                .Parameters.Add("@BarCode", SqlDbType.NVarChar).Value = CStr(mtbBarcode.Text.Remove(13, 7))
                .Parameters.Add("@LotNo", SqlDbType.NVarChar).Value = "G" & CStr(mtbBarcode.Text.Remove(0, 13).Remove(5, 2)) & CStr(mtbBarcode.Text.Remove(0, 5).Remove(2, 13))
                dr = .ExecuteReader()
                If dr.HasRows Then
                    dtMonitoringProduct.Load(dr)
                    For i = 0 To dtMonitoringProduct.Rows.Count - 1
                        Dim dtpdgv As New CalendarCell
                        dgvDryingOrganicLonganFleshGolden.Rows.Add()
                        dgvDryingOrganicLonganFleshGolden(0, dgvDryingOrganicLonganFleshGolden.Rows.Count - 1) = dtpdgv
                        dgvDryingOrganicLonganFleshGolden.Rows(dgvDryingOrganicLonganFleshGolden.Rows.Count - 1).Cells(0).Value = CDate(dtMonitoringProduct.Rows(i).Item("DateAdd").ToString())
                        dgvDryingOrganicLonganFleshGolden.Rows(dgvDryingOrganicLonganFleshGolden.Rows.Count - 1).Cells(1).Value = dtMonitoringProduct.Rows(i).Item("LotNo").ToString()
                        dgvDryingOrganicLonganFleshGolden.Rows(dgvDryingOrganicLonganFleshGolden.Rows.Count - 1).Cells(2).Value = dtMonitoringProduct.Rows(i).Item("NameLongan").ToString()
                        dgvDryingOrganicLonganFleshGolden.Rows(dgvDryingOrganicLonganFleshGolden.Rows.Count - 1).Cells(3).Value = dtMonitoringProduct.Rows(i).Item("InpusDLG").ToString()
                        dgvDryingOrganicLonganFleshGolden.Rows(dgvDryingOrganicLonganFleshGolden.Rows.Count - 1).Cells(4).Value = dtMonitoringProduct.Rows(i).Item("PeelAndSeed").ToString()
                        dgvDryingOrganicLonganFleshGolden.Rows(dgvDryingOrganicLonganFleshGolden.Rows.Count - 1).Cells(5).Value = dtMonitoringProduct.Rows(i).Item("LmaiMeat").ToString()
                        dgvDryingOrganicLonganFleshGolden.Rows(dgvDryingOrganicLonganFleshGolden.Rows.Count - 1).Cells(6).Value = dtMonitoringProduct.Rows(i).Item("Name_F").ToString()
                    Next
                End If
            End With
            dr.Close()
            '############################## ค้นหาข้อมูลการแปรรูปลำไยอินทรีย์สีทอง##############################
            Sql = "SELECT T.NameLongan,G.DateAdd,G.LotNo,G.InpusLmaiMeat,G.WeightLoss,G.TotalLmaiMeat,G.TotalTray,G.OvenNumber,FS.Name_F"
            Sql &= " FROM DryingOrganicLonganFleshGoldenBake AS G,TypeLongan AS T,FactoryStaff AS FS"
            Sql &= " WHERE G.BarCode=@BarCode AND G.LotNo=@LotNo AND G.Id_Longan=T.Id_Longan AND FS.IDFactoryStaff=G.IDFactoryStaffdgv"
            dtMonitoringProduct = New DataTable()
            With Com
                .Parameters.Clear()
                .CommandType = CommandType.Text
                .CommandText = Sql
                .Connection = Conn
                .Parameters.Add("@BarCode", SqlDbType.NVarChar).Value = CStr(mtbBarcode.Text.Remove(13, 7))
                .Parameters.Add("@LotNo", SqlDbType.NVarChar).Value = "G" & CStr(mtbBarcode.Text.Remove(0, 13).Remove(5, 2)) & CStr(mtbBarcode.Text.Remove(0, 5).Remove(2, 13))
                dr = .ExecuteReader()
                If dr.HasRows Then
                    dtMonitoringProduct.Load(dr)
                    For i = 0 To dtMonitoringProduct.Rows.Count - 1
                        Dim dtpdgv As New CalendarCell
                        dgvDryingOrganicLonganFleshGoldenBake.Rows.Add()
                        dgvDryingOrganicLonganFleshGoldenBake(0, dgvDryingOrganicLonganFleshGoldenBake.Rows.Count - 1) = dtpdgv
                        dgvDryingOrganicLonganFleshGoldenBake.Rows(dgvDryingOrganicLonganFleshGoldenBake.Rows.Count - 1).Cells(0).Value = CDate(dtMonitoringProduct.Rows(i).Item("DateAdd").ToString())
                        dgvDryingOrganicLonganFleshGoldenBake.Rows(dgvDryingOrganicLonganFleshGoldenBake.Rows.Count - 1).Cells(1).Value = dtMonitoringProduct.Rows(i).Item("LotNo").ToString()
                        dgvDryingOrganicLonganFleshGoldenBake.Rows(dgvDryingOrganicLonganFleshGoldenBake.Rows.Count - 1).Cells(2).Value = dtMonitoringProduct.Rows(i).Item("NameLongan").ToString()
                        dgvDryingOrganicLonganFleshGoldenBake.Rows(dgvDryingOrganicLonganFleshGoldenBake.Rows.Count - 1).Cells(3).Value = dtMonitoringProduct.Rows(i).Item("InpusLmaiMeat").ToString()
                        dgvDryingOrganicLonganFleshGoldenBake.Rows(dgvDryingOrganicLonganFleshGoldenBake.Rows.Count - 1).Cells(4).Value = dtMonitoringProduct.Rows(i).Item("WeightLoss").ToString()
                        dgvDryingOrganicLonganFleshGoldenBake.Rows(dgvDryingOrganicLonganFleshGoldenBake.Rows.Count - 1).Cells(5).Value = dtMonitoringProduct.Rows(i).Item("TotalLmaiMeat").ToString()
                        dgvDryingOrganicLonganFleshGoldenBake.Rows(dgvDryingOrganicLonganFleshGoldenBake.Rows.Count - 1).Cells(6).Value = dtMonitoringProduct.Rows(i).Item("TotalTray").ToString()
                        dgvDryingOrganicLonganFleshGoldenBake.Rows(dgvDryingOrganicLonganFleshGoldenBake.Rows.Count - 1).Cells(7).Value = dtMonitoringProduct.Rows(i).Item("OvenNumber").ToString()
                        dgvDryingOrganicLonganFleshGoldenBake.Rows(dgvDryingOrganicLonganFleshGoldenBake.Rows.Count - 1).Cells(8).Value = dtMonitoringProduct.Rows(i).Item("Name_F").ToString()
                    Next
                End If
            End With
            dr.Close()
            '############################## ค้นหาข้อมูลการบรรจุลำไยอินทรีย์สีทอง ##############################
            Sql = "SELECT T.NameTypeProduct,G.DateAdd,G.LotNo,G.WeightBeforePackaging,G.SizePackaging,G.NumberPackagingPer,G.TotalPackageIncluded,G.TotalWeight,G.TypePackaging,FS.Name_F"
            Sql &= " FROM DryingOrganicLonganFleshGoldenPacking AS G,TypeProduct AS T,FactoryStaff AS FS"
            Sql &= " WHERE G.BarCode=@BarCode AND G.LotNo=@LotNo AND G.ID_TypeProduct=T.ID_TypeProduct AND FS.IDFactoryStaff=G.IDFactoryStaffdgv"
            dtMonitoringProduct = New DataTable()
            With Com
                .Parameters.Clear()
                .CommandType = CommandType.Text
                .CommandText = Sql
                .Connection = Conn
                .Parameters.Add("@BarCode", SqlDbType.NVarChar).Value = mtbBarcode.Text
                .Parameters.Add("@LotNo", SqlDbType.NVarChar).Value = "G" & CStr(mtbBarcode.Text.Remove(0, 13).Remove(5, 2)) & CStr(mtbBarcode.Text.Remove(0, 5).Remove(2, 13))
                dr = .ExecuteReader()
                If dr.HasRows Then
                    dtMonitoringProduct.Load(dr)
                    For i = 0 To dtMonitoringProduct.Rows.Count - 1
                        Dim dtpdgv As New CalendarCell
                        dgvDryingOrganicLonganFleshGoldenPacking.Rows.Add()
                        dgvDryingOrganicLonganFleshGoldenPacking(0, dgvDryingOrganicLonganFleshGoldenPacking.Rows.Count - 1) = dtpdgv
                        dgvDryingOrganicLonganFleshGoldenPacking.Rows(dgvDryingOrganicLonganFleshGoldenPacking.Rows.Count - 1).Cells(0).Value = CDate(dtMonitoringProduct.Rows(i).Item("DateAdd").ToString())
                        dgvDryingOrganicLonganFleshGoldenPacking.Rows(dgvDryingOrganicLonganFleshGoldenPacking.Rows.Count - 1).Cells(1).Value = dtMonitoringProduct.Rows(i).Item("LotNo").ToString()
                        dgvDryingOrganicLonganFleshGoldenPacking.Rows(dgvDryingOrganicLonganFleshGoldenPacking.Rows.Count - 1).Cells(2).Value = dtMonitoringProduct.Rows(i).Item("NameTypeProduct").ToString()
                        dgvDryingOrganicLonganFleshGoldenPacking.Rows(dgvDryingOrganicLonganFleshGoldenPacking.Rows.Count - 1).Cells(3).Value = dtMonitoringProduct.Rows(i).Item("WeightBeforePackaging").ToString()
                        dgvDryingOrganicLonganFleshGoldenPacking.Rows(dgvDryingOrganicLonganFleshGoldenPacking.Rows.Count - 1).Cells(4).Value = dtMonitoringProduct.Rows(i).Item("SizePackaging").ToString()
                        dgvDryingOrganicLonganFleshGoldenPacking.Rows(dgvDryingOrganicLonganFleshGoldenPacking.Rows.Count - 1).Cells(5).Value = dtMonitoringProduct.Rows(i).Item("NumberPackagingPer").ToString()
                        dgvDryingOrganicLonganFleshGoldenPacking.Rows(dgvDryingOrganicLonganFleshGoldenPacking.Rows.Count - 1).Cells(6).Value = dtMonitoringProduct.Rows(i).Item("TotalPackageIncluded").ToString()
                        dgvDryingOrganicLonganFleshGoldenPacking.Rows(dgvDryingOrganicLonganFleshGoldenPacking.Rows.Count - 1).Cells(7).Value = dtMonitoringProduct.Rows(i).Item("TotalWeight").ToString()
                        dgvDryingOrganicLonganFleshGoldenPacking.Rows(dgvDryingOrganicLonganFleshGoldenPacking.Rows.Count - 1).Cells(8).Value = dtMonitoringProduct.Rows(i).Item("TypePackaging").ToString()
                        dgvDryingOrganicLonganFleshGoldenPacking.Rows(dgvDryingOrganicLonganFleshGoldenPacking.Rows.Count - 1).Cells(9).Value = dtMonitoringProduct.Rows(i).Item("Name_F").ToString()
                    Next
                End If
            End With
            dr.Close()
            '@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
        ElseIf mtbBarcode.Text.Remove(0, 18).Remove(1, 1) = "4" Then
            gpbFreshOrganicLongan.Hide()
            gpbStockInventoryControl.Show()
            gpbDryingOrganicLonganFleshGolden.Hide()
            gpbDryingOrganicLonganFleshGoldenBake.Hide()
            gpbDryingOrganicLonganFleshGoldenPacking.Hide()
            gpbDryingOrganicLongan.Show()
            gpbDryingOrganicLonganPacking.Hide()
            gpbOrganicLonganTea.Show()
            gpbOrganicLonganTeaBake.Show()
            gpbOrganicLonganTeaPacking.Show()

            gpbDryingOrganicLongan.Location = New Point(25, gpbProductMemberReceive.Location().Y() + 353)

            gpbOrganicLonganTea.Location = New Point(25, gpbDryingOrganicLongan.Location().Y() + 231)
            gpbOrganicLonganTeaBake.Location = New Point(25, gpbOrganicLonganTea.Location().Y() + 231)
            gpbOrganicLonganTeaPacking.Location = New Point(25, gpbOrganicLonganTeaBake.Location().Y() + 231)
            gpbStockInventoryControl.Location = New Point(25, gpbOrganicLonganTeaPacking.Location().Y() + 231)
            cmdPrint.Location = New Point(817, gpbStockInventoryControl.Location().Y() + 229)
            lblcmdprint.Location = New Point(623, gpbStockInventoryControl.Location().Y() + 264)
            lblLast.Location = New Point(392, gpbStockInventoryControl.Location().Y() + 275)
            '############################## ค้นหาข้อมูลผลิตภัณฑ์ชา ##############################
            Sql = "SELECT T.NameTypeProduct,TL.SizePackaging,TL.TypePackaging"
            Sql &= " FROM OrganicLonganTeaPacking AS TL,TypeProduct AS T"
            Sql &= " WHERE TL.BarCode=@BarCode AND T.ID_TypeProduct=@ID_TypeProduct AND T.ID_TypeProduct=TL.ID_TypeProduct"
            dtMonitoringProduct = New DataTable()
            With Com
                .Parameters.Clear()
                .CommandType = CommandType.Text
                .CommandText = Sql
                .Connection = Conn
                .Parameters.Add("@BarCode", SqlDbType.NVarChar).Value = mtbBarcode.Text.Trim()
                .Parameters.Add("@ID_TypeProduct", SqlDbType.NVarChar).Value = mtbBarcode.Text.Remove(0, 18)
                dr = .ExecuteReader()
                If dr.HasRows Then
                    dtMonitoringProduct.Load(dr)
                    lblNameProduct.Text = dtMonitoringProduct.Rows(0).Item("NameTypeProduct").ToString()
                    lblSizeProduct.Text = dtMonitoringProduct.Rows(0).Item("SizePackaging").ToString()
                    lblTypePacking.Text = dtMonitoringProduct.Rows(0).Item("TypePackaging").ToString()
                End If
            End With
            dr.Close()
            '############################## ค้นหาข้อมูลการแปรรูปลำไยอินทรีย์อบแห้ง ##############################
            Sql = "SELECT T.NameLongan,D.DateAdd,D.LotNo,D.LamiFreshWeight,D.WeightLoss,D.LmaiDryWeight,D.OvenNumber,FS.Name_F"
            Sql &= " FROM DryingOrganicLonganBake AS D,TypeLongan AS T,FactoryStaff AS FS"
            Sql &= " WHERE D.BarCode=@BarCode AND D.LotNo=@LotNo AND D.Id_Longan=T.Id_Longan AND FS.IDFactoryStaff=D.IDFactoryStaffdgv"
            dtMonitoringProduct = New DataTable()
            With Com
                .Parameters.Clear()
                .CommandType = CommandType.Text
                .CommandText = Sql
                .Connection = Conn
                .Parameters.Add("@BarCode", SqlDbType.NVarChar).Value = CStr(mtbBarcode.Text.Remove(13, 7))
                .Parameters.Add("@LotNo", SqlDbType.NVarChar).Value = "D" & CStr(mtbBarcode.Text.Remove(0, 13).Remove(5, 2)) & CStr(mtbBarcode.Text.Remove(0, 5).Remove(2, 13))
                dr = .ExecuteReader()
                If dr.HasRows Then
                    dtMonitoringProduct.Load(dr)
                    For i = 0 To dtMonitoringProduct.Rows.Count - 1
                        Dim dtpdgv As New CalendarCell
                        dgvDryingOrganicLongan.Rows.Add()
                        dgvDryingOrganicLongan(0, dgvDryingOrganicLongan.Rows.Count - 1) = dtpdgv
                        dgvDryingOrganicLongan.Rows(dgvDryingOrganicLongan.Rows.Count - 1).Cells(0).Value = CDate(dtMonitoringProduct.Rows(i).Item("DateAdd").ToString())
                        dgvDryingOrganicLongan.Rows(dgvDryingOrganicLongan.Rows.Count - 1).Cells(1).Value = dtMonitoringProduct.Rows(i).Item("LotNo").ToString()
                        dgvDryingOrganicLongan.Rows(dgvDryingOrganicLongan.Rows.Count - 1).Cells(2).Value = dtMonitoringProduct.Rows(i).Item("NameLongan").ToString()
                        dgvDryingOrganicLongan.Rows(dgvDryingOrganicLongan.Rows.Count - 1).Cells(3).Value = dtMonitoringProduct.Rows(i).Item("LamiFreshWeight").ToString()
                        dgvDryingOrganicLongan.Rows(dgvDryingOrganicLongan.Rows.Count - 1).Cells(4).Value = dtMonitoringProduct.Rows(i).Item("WeightLoss").ToString()
                        dgvDryingOrganicLongan.Rows(dgvDryingOrganicLongan.Rows.Count - 1).Cells(5).Value = dtMonitoringProduct.Rows(i).Item("LmaiDryWeight").ToString()
                        dgvDryingOrganicLongan.Rows(dgvDryingOrganicLongan.Rows.Count - 1).Cells(6).Value = dtMonitoringProduct.Rows(i).Item("OvenNumber").ToString()
                        dgvDryingOrganicLongan.Rows(dgvDryingOrganicLongan.Rows.Count - 1).Cells(7).Value = dtMonitoringProduct.Rows(i).Item("Name_F").ToString()
                    Next
                End If
            End With
            dr.Close()
            '############################## ค้นหาข้อมูลการแกะลำไยอบแห้ง ##############################
            Sql = "SELECT T.NameLongan,LT.DateAdd,LT.LotNo,LT.InputWeight,LT.PeelAndSeed,LT.LmaiMeatWeight,FS.Name_F"
            Sql &= " FROM OrganicLonganTea AS LT,TypeLongan AS T,FactoryStaff AS FS"
            Sql &= " WHERE LT.BarCode=@BarCode AND LT.LotNo=@LotNo AND LT.Id_Longan=T.Id_Longan AND FS.IDFactoryStaff=LT.IDFactoryStaffdgv"
            dtMonitoringProduct = New DataTable()
            With Com
                .Parameters.Clear()
                .CommandType = CommandType.Text
                .CommandText = Sql
                .Connection = Conn
                .Parameters.Add("@BarCode", SqlDbType.NVarChar).Value = CStr(mtbBarcode.Text.Remove(13, 7))
                .Parameters.Add("@LotNo", SqlDbType.NVarChar).Value = "T" & CStr(mtbBarcode.Text.Remove(0, 13).Remove(5, 2)) & CStr(mtbBarcode.Text.Remove(0, 5).Remove(2, 13))
                dr = .ExecuteReader()
                If dr.HasRows Then
                    dtMonitoringProduct.Load(dr)
                    For i = 0 To dtMonitoringProduct.Rows.Count - 1
                        Dim dtpdgv As New CalendarCell
                        dgvOrganicLonganTea.Rows.Add()
                        dgvOrganicLonganTea(0, dgvOrganicLonganTea.Rows.Count - 1) = dtpdgv
                        dgvOrganicLonganTea.Rows(dgvOrganicLonganTea.Rows.Count - 1).Cells(0).Value = CDate(dtMonitoringProduct.Rows(i).Item("DateAdd").ToString())
                        dgvOrganicLonganTea.Rows(dgvOrganicLonganTea.Rows.Count - 1).Cells(1).Value = dtMonitoringProduct.Rows(i).Item("LotNo").ToString()
                        dgvOrganicLonganTea.Rows(dgvOrganicLonganTea.Rows.Count - 1).Cells(2).Value = dtMonitoringProduct.Rows(i).Item("NameLongan").ToString()
                        dgvOrganicLonganTea.Rows(dgvOrganicLonganTea.Rows.Count - 1).Cells(3).Value = dtMonitoringProduct.Rows(i).Item("InputWeight").ToString()
                        dgvOrganicLonganTea.Rows(dgvOrganicLonganTea.Rows.Count - 1).Cells(4).Value = dtMonitoringProduct.Rows(i).Item("PeelAndSeed").ToString()
                        dgvOrganicLonganTea.Rows(dgvOrganicLonganTea.Rows.Count - 1).Cells(5).Value = dtMonitoringProduct.Rows(i).Item("LmaiMeatWeight").ToString()
                        dgvOrganicLonganTea.Rows(dgvOrganicLonganTea.Rows.Count - 1).Cells(6).Value = dtMonitoringProduct.Rows(i).Item("Name_F").ToString()
                    Next
                End If
            End With
            dr.Close()
            '############################## ค้นหาข้อมูลการแปรรูปชา ##############################
            Sql = "SELECT T.NameLongan,D.DateAdd,D.LotNo,D.InpusLmaiMeat,D.WeightLoss,D.TotalLmaiMeat,D.OvenNumber,FS.Name_F"
            Sql &= " FROM OrganicLonganTeaBake AS D,TypeLongan AS T,FactoryStaff AS FS"
            Sql &= " WHERE D.BarCode=@BarCode AND D.LotNo=@LotNo AND D.Id_Longan=T.Id_Longan AND FS.IDFactoryStaff=D.IDFactoryStaffdgv"
            dtMonitoringProduct = New DataTable()
            With Com
                .Parameters.Clear()
                .CommandType = CommandType.Text
                .CommandText = Sql
                .Connection = Conn
                .Parameters.Add("@BarCode", SqlDbType.NVarChar).Value = CStr(mtbBarcode.Text.Remove(13, 7))
                .Parameters.Add("@LotNo", SqlDbType.NVarChar).Value = "T" & CStr(mtbBarcode.Text.Remove(0, 13).Remove(5, 2)) & CStr(mtbBarcode.Text.Remove(0, 5).Remove(2, 13))
                dr = .ExecuteReader()
                If dr.HasRows Then
                    dtMonitoringProduct.Load(dr)
                    For i = 0 To dtMonitoringProduct.Rows.Count - 1
                        Dim dtpdgv As New CalendarCell
                        dgvOrganicLonganTeaBake.Rows.Add()
                        dgvOrganicLonganTeaBake(0, dgvOrganicLonganTeaBake.Rows.Count - 1) = dtpdgv
                        dgvOrganicLonganTeaBake.Rows(dgvOrganicLonganTeaBake.Rows.Count - 1).Cells(0).Value = CDate(dtMonitoringProduct.Rows(i).Item("DateAdd").ToString())
                        dgvOrganicLonganTeaBake.Rows(dgvOrganicLonganTeaBake.Rows.Count - 1).Cells(1).Value = dtMonitoringProduct.Rows(i).Item("LotNo").ToString()
                        dgvOrganicLonganTeaBake.Rows(dgvOrganicLonganTeaBake.Rows.Count - 1).Cells(2).Value = dtMonitoringProduct.Rows(i).Item("NameLongan").ToString()
                        dgvOrganicLonganTeaBake.Rows(dgvOrganicLonganTeaBake.Rows.Count - 1).Cells(3).Value = dtMonitoringProduct.Rows(i).Item("InpusLmaiMeat").ToString()
                        dgvOrganicLonganTeaBake.Rows(dgvOrganicLonganTeaBake.Rows.Count - 1).Cells(4).Value = dtMonitoringProduct.Rows(i).Item("WeightLoss").ToString()
                        dgvOrganicLonganTeaBake.Rows(dgvOrganicLonganTeaBake.Rows.Count - 1).Cells(5).Value = dtMonitoringProduct.Rows(i).Item("TotalLmaiMeat").ToString()
                        dgvOrganicLonganTeaBake.Rows(dgvOrganicLonganTeaBake.Rows.Count - 1).Cells(6).Value = dtMonitoringProduct.Rows(i).Item("OvenNumber").ToString()
                        dgvOrganicLonganTeaBake.Rows(dgvOrganicLonganTeaBake.Rows.Count - 1).Cells(7).Value = dtMonitoringProduct.Rows(i).Item("Name_F").ToString()
                    Next
                End If
            End With
            dr.Close()
            '############################## ค้นหาข้อมูลการบรรจุชา ##############################
            Sql = "SELECT T.NameTypeProduct,LT.DateAdd,LT.LotNo,LT.WeightBeforePackaging,LT.SizePackaging,LT.NumberPackagingPer,LT.TotalPackageIncluded,LT.TotalWeight,LT.TypePackaging,FS.Name_F"
            Sql &= " FROM OrganicLonganTeaPacking AS LT,TypeProduct AS T,FactoryStaff AS FS"
            Sql &= " WHERE LT.BarCode=@BarCode AND LT.LotNo=@LotNo AND LT.ID_TypeProduct=T.ID_TypeProduct AND FS.IDFactoryStaff=LT.IDFactoryStaffdgv"
            dtMonitoringProduct = New DataTable()
            With Com
                .Parameters.Clear()
                .CommandType = CommandType.Text
                .CommandText = Sql
                .Connection = Conn
                .Parameters.Add("@BarCode", SqlDbType.NVarChar).Value = mtbBarcode.Text
                .Parameters.Add("@LotNo", SqlDbType.NVarChar).Value = "T" & CStr(mtbBarcode.Text.Remove(0, 13).Remove(5, 2)) & CStr(mtbBarcode.Text.Remove(0, 5).Remove(2, 13))
                dr = .ExecuteReader()
                If dr.HasRows Then
                    dtMonitoringProduct.Load(dr)
                    For i = 0 To dtMonitoringProduct.Rows.Count - 1
                        Dim dtpdgv As New CalendarCell
                        dgvOrganicLonganTeaPacking.Rows.Add()
                        dgvOrganicLonganTeaPacking(0, dgvOrganicLonganTeaPacking.Rows.Count - 1) = dtpdgv
                        dgvOrganicLonganTeaPacking.Rows(dgvOrganicLonganTeaPacking.Rows.Count - 1).Cells(0).Value = CDate(dtMonitoringProduct.Rows(i).Item("DateAdd").ToString())
                        dgvOrganicLonganTeaPacking.Rows(dgvOrganicLonganTeaPacking.Rows.Count - 1).Cells(1).Value = dtMonitoringProduct.Rows(i).Item("LotNo").ToString()
                        dgvOrganicLonganTeaPacking.Rows(dgvOrganicLonganTeaPacking.Rows.Count - 1).Cells(2).Value = dtMonitoringProduct.Rows(i).Item("NameTypeProduct").ToString()
                        dgvOrganicLonganTeaPacking.Rows(dgvOrganicLonganTeaPacking.Rows.Count - 1).Cells(3).Value = dtMonitoringProduct.Rows(i).Item("WeightBeforePackaging").ToString()
                        dgvOrganicLonganTeaPacking.Rows(dgvOrganicLonganTeaPacking.Rows.Count - 1).Cells(4).Value = dtMonitoringProduct.Rows(i).Item("SizePackaging").ToString()
                        dgvOrganicLonganTeaPacking.Rows(dgvOrganicLonganTeaPacking.Rows.Count - 1).Cells(5).Value = dtMonitoringProduct.Rows(i).Item("NumberPackagingPer").ToString()
                        dgvOrganicLonganTeaPacking.Rows(dgvOrganicLonganTeaPacking.Rows.Count - 1).Cells(6).Value = dtMonitoringProduct.Rows(i).Item("TotalPackageIncluded").ToString()
                        dgvOrganicLonganTeaPacking.Rows(dgvOrganicLonganTeaPacking.Rows.Count - 1).Cells(7).Value = dtMonitoringProduct.Rows(i).Item("TotalWeight").ToString()
                        dgvOrganicLonganTeaPacking.Rows(dgvOrganicLonganTeaPacking.Rows.Count - 1).Cells(8).Value = dtMonitoringProduct.Rows(i).Item("TypePackaging").ToString()
                        dgvOrganicLonganTeaPacking.Rows(dgvOrganicLonganTeaPacking.Rows.Count - 1).Cells(9).Value = dtMonitoringProduct.Rows(i).Item("Name_F").ToString()
                    Next
                End If
            End With
            dr.Close()
        End If
        '############################## ค้นหาข้อมูลการเบิกจ่ายผลผลิตลำไยอินทรีย์  ##############################
        Sql = "SELECT T.NameTypeProduct,S.DateAdd,S.LotNo,S.SizePackaging,S.NumberPackagingPer,S.PackagingPer,S.TotalWeight,S.NameCustomer,FS.Name_F"
        Sql &= " FROM StockInventoryControl AS S,TypeProduct AS T,FactoryStaff AS FS"
        Sql &= " WHERE  S.BarCode=@BarCode AND S.ID_TypeProduct=T.ID_TypeProduct AND FS.IDFactoryStaff=S.IDFactoryStaffdgv"
        dtMonitoringProduct = New DataTable()
        With Com
            .Parameters.Clear()
            .CommandType = CommandType.Text
            .CommandText = Sql
            .Connection = Conn
            .Parameters.Add("@BarCode", SqlDbType.NVarChar).Value = mtbBarcode.Text.Trim()
            dr = .ExecuteReader()
            If dr.HasRows Then
                dtMonitoringProduct.Load(dr)
                For i = 0 To dtMonitoringProduct.Rows.Count - 1
                    Dim dtpdgv As New CalendarCell
                    dgvStockInventoryControl.Rows.Add()
                    dgvStockInventoryControl(0, dgvStockInventoryControl.Rows.Count - 1) = dtpdgv
                    dgvStockInventoryControl.Rows(dgvStockInventoryControl.Rows.Count - 1).Cells(0).Value = CDate(dtMonitoringProduct.Rows(i).Item("DateAdd").ToString())
                    dgvStockInventoryControl.Rows(dgvStockInventoryControl.Rows.Count - 1).Cells(1).Value = dtMonitoringProduct.Rows(i).Item("LotNo").ToString()
                    dgvStockInventoryControl.Rows(dgvStockInventoryControl.Rows.Count - 1).Cells(2).Value = dtMonitoringProduct.Rows(i).Item("NameTypeProduct").ToString()
                    dgvStockInventoryControl.Rows(dgvStockInventoryControl.Rows.Count - 1).Cells(3).Value = dtMonitoringProduct.Rows(i).Item("SizePackaging").ToString()
                    dgvStockInventoryControl.Rows(dgvStockInventoryControl.Rows.Count - 1).Cells(4).Value = dtMonitoringProduct.Rows(i).Item("NumberPackagingPer").ToString()
                    dgvStockInventoryControl.Rows(dgvStockInventoryControl.Rows.Count - 1).Cells(5).Value = dtMonitoringProduct.Rows(i).Item("PackagingPer").ToString()
                    dgvStockInventoryControl.Rows(dgvStockInventoryControl.Rows.Count - 1).Cells(6).Value = dtMonitoringProduct.Rows(i).Item("TotalWeight").ToString()
                    dgvStockInventoryControl.Rows(dgvStockInventoryControl.Rows.Count - 1).Cells(7).Value = dtMonitoringProduct.Rows(i).Item("NameCustomer").ToString()
                    dgvStockInventoryControl.Rows(dgvStockInventoryControl.Rows.Count - 1).Cells(8).Value = dtMonitoringProduct.Rows(i).Item("Name_F").ToString()
                    lblNameCustomer.Text &= dtMonitoringProduct.Rows(i).Item("NameCustomer").ToString() & "  , "
                Next
            End If
        End With
        'End If
        Conn.Close()
        dr.Close()

    End Sub

    Function CNmb(ByVal NumberConvert As String) As String
        If NumberConvert <> "" Then
            Dim NumberInteger As Integer = CInt(Math.Floor(CDbl(NumberConvert)))
            If CStr(NumberInteger).Length > 3 Then
                Dim NumberLength As Integer = CInt(Math.Floor(CDbl(CStr(NumberInteger).Length) / 3))
                Dim NumberString As String = ""
                For i = 0 To NumberLength - 1
                    If CStr(NumberInteger).Length > 3 Then
                        NumberString = "," & CStr(NumberInteger).Remove(0, CInt(CStr(NumberInteger).Length) - 3) & NumberString
                        NumberInteger = CInt(CStr(NumberInteger).Remove(CInt(CStr(NumberInteger).Length) - 3, 3))
                    End If
                Next
                NumberConvert = CStr(NumberInteger) & NumberString & NumberConvert.Remove(0, CInt(CStr(Math.Floor(CDbl(NumberConvert))).Length))
            End If
        Else
            NumberConvert = ""
        End If
        Return NumberConvert
    End Function
End Class



ช่วยดูโค้ดให้หน่อยคับพอดีหาส่วนที่ตั้งให้ใส่ข้อมูลได้เฉพาะตัวเลขไม่เจออะคับ
ส่วนตัว textboxชื่อว่า mtbBarcode
พอดีแก้งานคนอื่นอะคับหาไม่เจอ



Tag : .NET, Ms SQL Server 2005, VB.NET







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2012-01-23 21:55:17 By : maaeda01 View : 983 Reply : 1
 

 

No. 1



โพสกระทู้ ( 74,058 )
บทความ ( 838 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์
Twitter Facebook

Code (VB.NET)
Public Class Form1

    Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
        Select Case Asc(e.KeyChar)
            Case 48 To 57 ' key โค๊ด ของตัวเลขจะอยู่ระหว่าง48-57ครับ 48คือเลข0 57คือเลข9ตามลำดับ
                e.Handled = False
            Case 8, 13, 46 ' ปุ่ม Backspace = 8,ปุ่ม Enter = 13, ปุ่มDelete = 46
                e.Handled = False

            Case Else
                e.Handled = True
                MessageBox.Show("สามารถกดได้แค่ตัวเลข")
        End Select
  
    End Sub


Go to : VB.NET วิธีการทำให้ TextBox รับค่าได้เฉพาะภาษาไทยหรือภาษาอังกฤษหรือตัวเลข สำหรับ VB.NET ครับ






แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-01-23 22:21:56 By : webmaster
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : ช่วยดูโค้ดให้หน่อยคับพอดีหาส่วนที่ตั้งให้ใส่ข้อมูลได้เฉพาะตัวเลขไม่เจออะคับ
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)







Exchange: นำเข้าสินค้าจากจีน, Taobao, เฟอร์นิเจอร์, ของพรีเมี่ยม, ร่ม, ปากกา, power bank, แฟลชไดร์ฟ, กระบอกน้ำ

Load balance : Server 03
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่