123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322 |
- Option Strict Off
- Imports System.Data.SqlClient
- Imports System.IO
- Public Class 樣品報價控制表
- Dim conn As New SqlConnection
- Dim da As New SqlDataAdapter
- Dim cmd As New SqlCommand
- Dim ds As New DataSet : Dim ds1 As New DataSet : Dim ds2 As New DataSet : Dim ds4 As New DataSet : Dim ds5 As New DataSet : Dim ds6 As New DataSet
- Dim dr As SqlDataReader
- Dim 條件變更 As String
- Private Sub Set_DGV1載入前設定()
- DataGridView1.DataSource = Nothing : ds.Clear()
- DataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
- DataGridView1.ColumnHeadersHeight = 25
- DataGridView1.AllowUserToAddRows = False
- DataGridView1.RowTemplate.Height = 24
- If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
- End Sub
- Private Sub Set_DGV1載入後設定()
- cmd.Connection = conn : cmd.CommandText = SQL1 : da.SelectCommand = cmd : da.Fill(ds) : DataGridView1.DataSource = ds.Tables(0) : conn.Close() : Set_grid()
- End Sub
- Private Sub Set_清單()
- Set_DGV1載入前設定()
- SQL1 = "SELECT 樣品訂單控制表.季節, 樣品訂單控制表.客戶, 樣品訂單控制表.工廠, 樣品訂單清單.SO, 樣品訂單清單.版次,
- 樣品訂單清單.項次, 樣品訂單控制表.型體號碼, 樣品訂單控制表.型體名稱, 樣品訂單清單.顏色, 樣品訂單清單.數量,
- 樣品訂單清單.已報價 AS 已建立報價, 樣品訂單清單.流水號
- FROM 樣品訂單清單 LEFT OUTER JOIN
- 樣品訂單控制表 ON 樣品訂單清單.SO = 樣品訂單控制表.SO AND 樣品訂單清單.版次 = 樣品訂單控制表.版次
- " & 條件變更 & "
- ORDER BY 樣品訂單清單.SO, 樣品訂單清單.版次, 樣品訂單清單.項次"
- Set_DGV1載入後設定()
- End Sub
- Private Sub Set_grid()
- DataGridView1.Columns(0).Width = 55 : DataGridView1.Columns(1).Width = 170 : DataGridView1.Columns(2).Width = 70 : DataGridView1.Columns(3).Width = 55 : DataGridView1.Columns(4).Width = 40
- DataGridView1.Columns(5).Width = 40 : DataGridView1.Columns(6).Width = 90 : DataGridView1.Columns(7).Width = 100 : DataGridView1.Columns(8).Width = 120 : DataGridView1.Columns(9).Width = 70
- DataGridView1.Columns(10).Width = 60 : DataGridView1.Columns(11).Visible = False
- End Sub
- Private Sub Set_DGV2載入前設定()
- DataGridView2.DataSource = Nothing : ds1.Clear()
- DataGridView2.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
- DataGridView2.ColumnHeadersHeight = 25
- DataGridView2.AllowUserToAddRows = False
- DataGridView2.RowTemplate.Height = 50
- If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
- End Sub
- Private Sub Set_DGV2載入後設定()
- cmd.Connection = conn : cmd.CommandText = SQL1 : da.SelectCommand = cmd : da.Fill(ds1) : DataGridView2.DataSource = ds1.Tables(0) : conn.Close() : Set_grid1()
- End Sub
- Private Sub Set_清單1()
- Set_DGV2載入前設定()
- If PA = "" Then
- SQL1 = "SELECT SEASON, CUST, FCTY, STYLE, STYLENAME, COLOR, SO, 版次, 項次, MATERIALS, MATERIAL_CLASS,
- OUTSOLE, INSOLE, FC, REMARK
- FROM 樣品單價控制表 ORDER BY SO DESC, 版次, 項次"
- Else
- SQL1 = "SELECT SEASON, CUST, FCTY, STYLE, STYLENAME, COLOR, SO, 版次, 項次, MATERIALS, MATERIAL_CLASS,
- OUTSOLE, INSOLE, FC, REMARK
- FROM 樣品單價控制表
- WHERE SEASON LIKE N'%" & PA & "%' OR CUST LIKE N'%" & PA & "%' OR FCTY LIKE N'%" & PA & "%' OR STYLE LIKE N'%" & PA & "%' OR STYLENAME LIKE N'%" & PA & "%' OR
- COLOR LIKE N'%" & PA & "%' OR SO LIKE N'%" & PA & "%' OR 版次 LIKE N'%" & PA & "%' OR 項次 LIKE N'%" & PA & "%' OR MATERIALS LIKE N'%" & PA & "%' OR
- MATERIAL_CLASS LIKE N'%" & PA & "%' OR OUTSOLE LIKE N'%" & PA & "%' OR INSOLE LIKE N'%" & PA & "%' OR REMARK LIKE N'%" & PA & "%' ORDER BY SO DESC, 版次, 項次"
- End If
- 列印用SQL = SQL1
- Set_DGV2載入後設定()
- End Sub
- Private Sub Set_grid1()
- DataGridView2.Columns(0).Width = 60 : DataGridView2.Columns(1).Width = 150 : DataGridView2.Columns(2).Width = 70 : DataGridView2.Columns(3).Width = 90 : DataGridView2.Columns(4).Width = 100
- DataGridView2.Columns(5).Width = 120 : DataGridView2.Columns(6).Width = 60 : DataGridView2.Columns(7).Width = 40 : DataGridView2.Columns(8).Width = 40 : DataGridView2.Columns(9).Width = 343
- DataGridView2.Columns(10).Width = 150 : DataGridView2.Columns(11).Width = 342 : DataGridView2.Columns(12).Width = 100 : DataGridView2.Columns(13).Width = 50 : DataGridView2.Columns(14).Width = 150
-
- DataGridView2.Columns(13).DefaultCellStyle.Format = "#,##0.00"
- DataGridView2.Columns(13).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight
- DataGridView2.Columns(13).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleRight
-
- DataGridView2.Columns(9).DefaultCellStyle.BackColor = Color.MistyRose : DataGridView2.Columns(10).DefaultCellStyle.BackColor = Color.MistyRose
- DataGridView2.Columns(11).DefaultCellStyle.BackColor = Color.MistyRose : DataGridView2.Columns(12).DefaultCellStyle.BackColor = Color.MistyRose
- DataGridView2.Columns(13).DefaultCellStyle.BackColor = Color.MistyRose : DataGridView2.Columns(14).DefaultCellStyle.BackColor = Color.MistyRose
- DataGridView2.EditMode = DataGridViewEditMode.EditOnEnter
- End Sub
-
- Private Sub Set_DGV3載入前設定()
- DataGridView3.DataSource = Nothing : ds2.Clear()
- DataGridView3.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
- DataGridView3.ColumnHeadersHeight = 25
- DataGridView3.AllowUserToAddRows = False
- If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
- End Sub
- Private Sub Set_DGV3載入後設定()
- cmd.Connection = conn : cmd.CommandText = SQL1 : da.SelectCommand = cmd : da.Fill(ds2) : DataGridView3.DataSource = ds2.Tables(0) : conn.Close() : Set_grid2()
- End Sub
- Private Sub Set_清單2()
- Set_DGV3載入前設定()
- SQL1 = "SELECT METOO選擇按鈕.選擇, 樣品訂單清單.項次, 樣品訂單部件表.部件, 樣品訂單部件表.材料名稱,
- 樣品訂單部件表.材料說明 AS 顏色, 樣品訂單部件表.廠商, 樣品訂單部件表.備註, 樣品訂單部件表.版次,
- 樣品訂單部件表.流水號, 樣品訂單部件表.項次 AS 排列
- FROM 樣品訂單部件表 INNER JOIN
- 樣品訂單清單 ON 樣品訂單部件表.流水號 = 樣品訂單清單.流水號 LEFT OUTER JOIN
- METOO選擇按鈕 ON 樣品訂單部件表.SO = METOO選擇按鈕.對應 " &
- "WHERE (樣品訂單部件表.SO LIKE N'" & TextBox1.Text & "') AND (樣品訂單部件表.版次 LIKE N'" & TextBox3.Text & "') AND (樣品訂單清單.項次 LIKE N'" & TextBox4.Text & "') " &
- "AND (LEFT(樣品訂單部件表.部件,1) LIKE N'A' OR LEFT(樣品訂單部件表.部件,1) LIKE N'E') " &
- "ORDER BY 樣品訂單部件表.流水號, 樣品訂單部件表.項次, 樣品訂單部件表.部件"
- Set_DGV3載入後設定()
- End Sub
- Private Sub Set_grid2()
- DataGridView3.Columns(0).Width = 40 : DataGridView3.Columns(1).Width = 40 : DataGridView3.Columns(2).Width = 200 : DataGridView3.Columns(3).Width = 260 : DataGridView3.Columns(4).Width = 171
- DataGridView3.Columns(5).Visible = False : DataGridView3.Columns(6).Visible = False : DataGridView3.Columns(7).Visible = False : DataGridView3.Columns(8).Visible = False
- DataGridView3.Columns(9).Visible = False
- End Sub
- Private Sub 樣品報價控制表_Load(sender As Object, e As EventArgs) Handles MyBase.Load
- Me.MdiParent = WINPROFIT_ERP_SYS : Me.WindowState = 2 : Me.AutoScroll = True
- If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
- SQL1 = "UPDATE 樣品訂單清單 SET 已報價 = N'0' WHERE (已報價 IS NULL)"
- cmd.Connection = conn : cmd.CommandText = SQL1 : da.SelectCommand = cmd : cmd.ExecuteNonQuery() : conn.Close()
- CheckBox1.Checked = True : CheckBox2.Checked = False : TextBox9.Visible = False
- DataGridView3.Visible = False
- 條件變更 = " WHERE (樣品訂單清單.已報價 LIKE N'0')"
- Set_清單() : Set_清單1()
- End Sub
- Private Sub DataGridView1_RowPostPaint(ByVal sender As Object, ByVal e As DataGridViewRowPostPaintEventArgs) Handles DataGridView1.RowPostPaint
- Dim linePen As New Pen(Color.Blue, 2)
- If e.RowIndex = DataGridView1.Rows.Count - 1 Then
- Exit Sub
- Else
- If DataGridView1(3, e.RowIndex).Value.ToString <> DataGridView1(3, e.RowIndex + 1).Value.ToString Then
- Dim startX As Integer = IIf(DataGridView1.RowHeadersVisible, DataGridView1.RowHeadersWidth, 0)
- Dim startY As Integer = e.RowBounds.Top + e.RowBounds.Height - 1
- Dim endX As Integer = startX + DataGridView1.Columns.GetColumnsWidth(DataGridViewElementStates.Visible) - DataGridView1.HorizontalScrollingOffset
- e.Graphics.DrawLine(linePen, startX, startY, endX, startY)
- Exit Sub
- End If
- End If
- End Sub
- Private Sub DataGridView2_RowPostPaint(ByVal sender As Object, ByVal e As DataGridViewRowPostPaintEventArgs) Handles DataGridView2.RowPostPaint
- Dim linePen As New Pen(Color.Blue, 2)
- If e.RowIndex = DataGridView2.Rows.Count - 1 Then
- Exit Sub
- Else
- If DataGridView2(6, e.RowIndex).Value.ToString <> DataGridView2(6, e.RowIndex + 1).Value.ToString Then
- Dim startX As Integer = IIf(DataGridView2.RowHeadersVisible, DataGridView2.RowHeadersWidth, 0)
- Dim startY As Integer = e.RowBounds.Top + e.RowBounds.Height - 1
- Dim endX As Integer = startX + DataGridView2.Columns.GetColumnsWidth(DataGridViewElementStates.Visible) - DataGridView2.HorizontalScrollingOffset
- e.Graphics.DrawLine(linePen, startX, startY, endX, startY)
- Exit Sub
- End If
- End If
- End Sub
- Private Sub DataGridView1_CellClick(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles DataGridView1.CellClick
- If e.RowIndex = -1 Then : Else
- TextBox1.Text = DataGridView1.Rows(e.RowIndex).Cells("SO").Value : TextBox3.Text = DataGridView1.Rows(e.RowIndex).Cells("版次").Value
- TextBox4.Text = DataGridView1.Rows(e.RowIndex).Cells("項次").Value : TextBox2.Text = DataGridView1.Rows(e.RowIndex).Cells("季節").Value
- TextBox5.Text = DataGridView1.Rows(e.RowIndex).Cells("工廠").Value : TextBox6.Text = DataGridView1.Rows(e.RowIndex).Cells("型體號碼").Value
- TextBox7.Text = DataGridView1.Rows(e.RowIndex).Cells("型體名稱").Value : TextBox8.Text = DataGridView1.Rows(e.RowIndex).Cells("顏色").Value
- TextBox9.Text = DataGridView1.Rows(e.RowIndex).Cells("數量").Value : TextBox16.Text = DataGridView1.Rows(e.RowIndex).Cells("客戶").Value
-
- PictureBox1.Image = Nothing : conn.Close()
- If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
- SQL1 = "SELECT TOP(1) 圖片 FROM 鞋型圖片資料庫 " &
- "WHERE 客戶 LIKE N'" & DataGridView1.Rows(e.RowIndex).Cells("客戶").Value & "' AND 形體號 LIKE N'" & DataGridView1.Rows(e.RowIndex).Cells("型體號碼").Value &
- "' AND 形體名 LIKE N'" & DataGridView1.Rows(e.RowIndex).Cells("型體名稱").Value & "' AND 類別 LIKE N'設計圖'"
- cmd.Connection = conn : cmd.CommandText = SQL1 : dr = cmd.ExecuteReader
- If dr.Read() Then
- PictureBox1.Image = Nothing : conn.Close()
- If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
- SQL1 = "SELECT TOP(1) 圖片 FROM 鞋型圖片資料庫 " &
- "WHERE 客戶 LIKE N'" & DataGridView1.Rows(e.RowIndex).Cells("客戶").Value & "' AND 形體號 LIKE N'" & DataGridView1.Rows(e.RowIndex).Cells("型體號碼").Value &
- "' AND 形體名 LIKE N'" & DataGridView1.Rows(e.RowIndex).Cells("型體名稱").Value & "' AND 類別 LIKE N'設計圖'"
- cmd.Connection = conn : cmd.CommandText = SQL1 : dr = cmd.ExecuteReader
- While dr.Read() = True
- Dim bytes As Byte() = New Byte(-1) {} : bytes = DirectCast(dr.Item("圖片"), Byte()) : Dim oStream As New MemoryStream(bytes) : PictureBox1.Image = Bitmap.FromStream(oStream)
- End While
- conn.Close()
- Else
- conn.Close()
- End If : PictureBox1.SizeMode = 4
-
- Set_清單2()
- Dim II As Integer = 0
- TextBox10.Text = ""
- For i As Integer = 0 To DataGridView3.Rows.Count - 1
- If Strings.Left(DataGridView3.Rows(i).Cells("部件").Value, 1) = "A" Then
- TextBox10.Text = TextBox10.Text & II + 1 & ". " & DataGridView3.Rows(i).Cells("材料名稱").Value & " " : II += 1
- End If
- Next
- II = 0
- TextBox12.Text = ""
- For i As Integer = 0 To DataGridView3.Rows.Count - 1
- If Strings.Left(DataGridView3.Rows(i).Cells("部件").Value, 1) = "E" Then
- TextBox12.Text = TextBox12.Text & II + 1 & ". " & DataGridView3.Rows(i).Cells("材料名稱").Value & " " : II += 1
- End If
- Next
- End If
- End Sub
- Private Sub DataGridView2_CellClick(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles DataGridView2.CellClick
- If e.RowIndex = -1 Then : Else
- TextBox1.Text = DataGridView2.Rows(e.RowIndex).Cells("SO").Value : TextBox3.Text = DataGridView2.Rows(e.RowIndex).Cells("版次").Value
- TextBox4.Text = DataGridView2.Rows(e.RowIndex).Cells("項次").Value : TextBox2.Text = DataGridView2.Rows(e.RowIndex).Cells("SEASON").Value
- TextBox5.Text = DataGridView2.Rows(e.RowIndex).Cells("FCTY").Value : TextBox6.Text = DataGridView2.Rows(e.RowIndex).Cells("STYLE").Value
- TextBox7.Text = DataGridView2.Rows(e.RowIndex).Cells("STYLENAME").Value : TextBox8.Text = DataGridView2.Rows(e.RowIndex).Cells("COLOR").Value
- TextBox16.Text = DataGridView2.Rows(e.RowIndex).Cells("CUST").Value : TextBox10.Text = DataGridView2.Rows(e.RowIndex).Cells("MATERIALS").Value
- TextBox11.Text = DataGridView2.Rows(e.RowIndex).Cells("MATERIAL_CLASS").Value : TextBox12.Text = DataGridView2.Rows(e.RowIndex).Cells("OUTSOLE").Value
- TextBox13.Text = DataGridView2.Rows(e.RowIndex).Cells("INSOLE").Value : TextBox14.Text = DataGridView2.Rows(e.RowIndex).Cells("FC").Value
- TextBox15.Text = DataGridView2.Rows(e.RowIndex).Cells("REMARK").Value
-
- PictureBox1.Image = Nothing : conn.Close()
- If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
- SQL1 = "SELECT TOP(1) 圖片 FROM 鞋型圖片資料庫 " &
- "WHERE 客戶 LIKE N'" & DataGridView2.Rows(e.RowIndex).Cells("CUST").Value & "' AND 形體號 LIKE N'" & DataGridView2.Rows(e.RowIndex).Cells("STYLE").Value &
- "' AND 形體名 LIKE N'" & DataGridView2.Rows(e.RowIndex).Cells("STYLENAME").Value & "' AND 類別 LIKE N'設計圖'"
- cmd.Connection = conn : cmd.CommandText = SQL1 : dr = cmd.ExecuteReader
- If dr.Read() Then
- PictureBox1.Image = Nothing : conn.Close()
- If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
- SQL1 = "SELECT TOP(1) 圖片 FROM 鞋型圖片資料庫 " &
- "WHERE 客戶 LIKE N'" & DataGridView2.Rows(e.RowIndex).Cells("CUST").Value & "' AND 形體號 LIKE N'" & DataGridView2.Rows(e.RowIndex).Cells("STYLE").Value &
- "' AND 形體名 LIKE N'" & DataGridView2.Rows(e.RowIndex).Cells("STYLENAME").Value & "' AND 類別 LIKE N'設計圖'"
- cmd.Connection = conn : cmd.CommandText = SQL1 : dr = cmd.ExecuteReader
- While dr.Read() = True
- Dim bytes As Byte() = New Byte(-1) {} : bytes = DirectCast(dr.Item("圖片"), Byte()) : Dim oStream As New MemoryStream(bytes) : PictureBox1.Image = Bitmap.FromStream(oStream)
- End While
- conn.Close()
- Else
- conn.Close()
- End If : PictureBox1.SizeMode = 4
- TextBox14.Text = Format(Val(TextBox14.Text), "#,##0.00")
- End If
- End Sub
- Private Sub CheckBox1_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox1.Click
- CheckBox1.Checked = True : CheckBox2.Checked = False
- 條件變更 = " WHERE (樣品訂單清單.已報價 LIKE N'0')"
- DataGridView3.DataSource = Nothing : ds2.Clear()
- Button9.Enabled = True
- Set_清單()
- End Sub
- Private Sub CheckBox2_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox2.Click
- CheckBox1.Checked = False : CheckBox2.Checked = True
- 條件變更 = " WHERE (樣品訂單清單.已報價 LIKE N'1')"
- DataGridView3.DataSource = Nothing : ds2.Clear()
- Button9.Enabled = False
- Set_清單()
- End Sub
- Private Sub Button9_Click(sender As Object, e As EventArgs) Handles Button9.Click
- For i As Integer = 0 To DataGridView1.Rows.Count - 1
- 資料數 = DataGridView1.Rows.Count : MyModule1.進度條()
- If DataGridView1.Rows(i).Cells("型體名稱").Value = "" Then
- Else
- TextBox1.Text = DataGridView1.Rows(i).Cells("SO").Value : TextBox3.Text = DataGridView1.Rows(i).Cells("版次").Value
- TextBox4.Text = DataGridView1.Rows(i).Cells("項次").Value : TextBox2.Text = DataGridView1.Rows(i).Cells("季節").Value
- TextBox5.Text = DataGridView1.Rows(i).Cells("工廠").Value : TextBox6.Text = DataGridView1.Rows(i).Cells("型體號碼").Value
- TextBox7.Text = DataGridView1.Rows(i).Cells("型體名稱").Value : TextBox8.Text = DataGridView1.Rows(i).Cells("顏色").Value
- TextBox9.Text = DataGridView1.Rows(i).Cells("數量").Value : TextBox16.Text = DataGridView1.Rows(i).Cells("客戶").Value
- Set_清單2()
- Dim II As Integer = 0
- TextBox10.Text = ""
- For iii As Integer = 0 To DataGridView3.Rows.Count - 1
- If Strings.Left(DataGridView3.Rows(iii).Cells("部件").Value, 1) = "A" Then
- TextBox10.Text = TextBox10.Text & II + 1 & ". " & DataGridView3.Rows(iii).Cells("材料名稱").Value & " " : II += 1
- End If
- Next
- II = 0
- TextBox12.Text = ""
- For iii As Integer = 0 To DataGridView3.Rows.Count - 1
- If Strings.Left(DataGridView3.Rows(iii).Cells("部件").Value, 1) = "E" Then
- TextBox12.Text = TextBox12.Text & II + 1 & ". " & DataGridView3.Rows(iii).Cells("材料名稱").Value & " " : II += 1
- End If
- Next
-
- If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
- SQL1 = "INSERT INTO 樣品單價控制表 (SEASON, CUST, FCTY, STYLE, STYLENAME, COLOR, SO, 版次, 項次, MATERIALS, MATERIAL_CLASS, OUTSOLE, INSOLE, FC, REMARK) " &
- "VALUES (N'" & TextBox2.Text & "', N'" & TextBox16.Text & "', N'" & TextBox5.Text & "', N'" & TextBox6.Text & "', N'" & TextBox7.Text & "', N'" & TextBox8.Text & "', N'" & TextBox1.Text &
- "', N'" & TextBox3.Text & "', N'" & TextBox4.Text & "', N'" & TextBox10.Text & "', N'', N'" & TextBox12.Text & "', N'', N'0.0', N'')"
- cmd.Connection = conn : cmd.CommandText = SQL1 : cmd.ExecuteNonQuery() : conn.Close()
- If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
- SQL1 = "UPDATE 樣品訂單清單 SET 已報價 = N'1' WHERE (流水號 LIKE N'" & DataGridView1.Rows(i).Cells("流水號").Value & "')"
- cmd.Connection = conn : cmd.CommandText = SQL1 : da.SelectCommand = cmd : cmd.ExecuteNonQuery() : conn.Close()
- End If
- Next : WINPROFIT_ERP_SYS.ToolStripProgressBar1.Value = 0 : 最終數 = 0
- Set_清單() : Set_清單1() : MsgBox("資料新增完成")
- End Sub
- Private Sub Button11_Click(sender As Object, e As EventArgs) Handles Button11.Click
- For i As Integer = 0 To DataGridView2.Rows.Count - 1
- 資料數 = DataGridView2.Rows.Count : MyModule1.進度條()
- If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
- SQL1 = "UPDATE 樣品單價控制表 SET MATERIAL_CLASS = N'" & DataGridView2.Rows(i).Cells("MATERIAL_CLASS").Value & "', INSOLE = N'" & DataGridView2.Rows(i).Cells("INSOLE").Value &
- "', FC = N'" & DataGridView2.Rows(i).Cells("FC").Value & "', REMARK = N'" & DataGridView2.Rows(i).Cells("REMARK").Value & "', MATERIALS = N'" & DataGridView2.Rows(i).Cells("MATERIALS").Value &
- "', OUTSOLE = N'" & DataGridView2.Rows(i).Cells("OUTSOLE").Value & "' " &
- "WHERE (SO LIKE N'" & DataGridView2.Rows(i).Cells("SO").Value & "' AND 版次 LIKE N'" & DataGridView2.Rows(i).Cells("版次").Value & "' " &
- "AND 項次 LIKE N'" & DataGridView2.Rows(i).Cells("項次").Value & "')"
- cmd.Connection = conn : cmd.CommandText = SQL1 : da.SelectCommand = cmd : cmd.ExecuteNonQuery() : conn.Close()
- Next : WINPROFIT_ERP_SYS.ToolStripProgressBar1.Value = 0 : 最終數 = 0
- Set_清單1() : MsgBox("資料存檔完成")
- End Sub
- Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
- If TextBox1.Text = "" And TextBox3.Text = "" And TextBox4.Text = "" Then
- MsgBox("沒有選取要刪除的資料")
- Else
- Dim aa As MsgBoxResult
- aa = MsgBox("確定要刪除該筆資料?", MsgBoxStyle.OkCancel)
- If aa = MsgBoxResult.Ok Then
- If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
- SQL1 = "DELETE FROM 樣品單價控制表 WHERE (SO LIKE N'" & TextBox1.Text & "' AND 版次 LIKE N'" & TextBox3.Text & "' " &
- "AND 項次 LIKE N'" & TextBox4.Text & "')"
- cmd.CommandText = SQL1 : cmd.Connection = conn : cmd.ExecuteNonQuery() : conn.Close()
- If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
- SQL1 = "UPDATE 樣品訂單清單 SET 已報價 = N'0' WHERE (SO LIKE N'" & TextBox1.Text & "' AND 版次 LIKE N'" & TextBox3.Text & "' " &
- "AND 項次 LIKE N'" & TextBox4.Text & "')"
- cmd.Connection = conn : cmd.CommandText = SQL1 : da.SelectCommand = cmd : cmd.ExecuteNonQuery() : conn.Close()
- MsgBox("刪除完成") : Set_清單() : Set_清單1()
- End If
- End If
- End Sub
- Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
- PA = InputBox("請輸入要查詢的關鍵字") : Set_清單1() : PA = ""
- End Sub
-
- Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
- If 列印用SQL = "" Then
- MsgBox("沒有列印資料,請重新搜尋後列印")
- Else
- 列印_樣品報價單.ShowDialog() : 列印用SQL = ""
- End If
- End Sub
- End Class
|