123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642 |
- Option Strict Off
- Imports System.Data.SqlClient
- Imports System.IO
- Imports System.Net
- Public Class 量產訂單明細表
- ReadOnly conn As New SqlConnection
- ReadOnly da As New SqlDataAdapter
- ReadOnly cmd As New SqlCommand
- ReadOnly ds As New DataSet : ReadOnly ds2 As New DataSet : ReadOnly ds3 As New DataSet
- Dim dr As SqlDataReader
- Dim Date1 As String : Dim Date2 As String : Dim Date3 As String : Dim Date4 As String : Dim Date5 As String : Dim Date6 As String : Dim Date7 As String
- ReadOnly DTP(6) As String : Dim 新流水號3 As String
- Private m_Leftx As Integer = 152
- Private m_Lefty As Integer = 0
- Dim m_MousePosX As Integer
- Dim m_MousePosY As Integer
- Dim m_DeltaX As Integer
- Dim m_DeltaY As Integer
- Private Sub 基本資料載入()
- If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
- SQL1 = "SELECT 訂單控制表.訂單流水號, 訂單控制表.客戶訂單號, 訂單控制表.生產工廠, 工廠控制表.供應商資料, 工廠控制表.供應商地址, " &
- "SUM(訂單控制表.訂單數量) AS 訂單數量 FROM 訂單控制表 INNER JOIN 工廠控制表 ON 訂單控制表.生產工廠 = 工廠控制表.工廠 " &
- "WHERE (訂單控制表.訂單流水號 LIKE '" & TextBox13.Text & "') " &
- "GROUP BY 訂單控制表.訂單流水號, 訂單控制表.客戶訂單號, 訂單控制表.生產工廠, 工廠控制表.供應商資料, 工廠控制表.供應商地址"
- cmd.Connection = conn : cmd.CommandText = SQL1 : dr = cmd.ExecuteReader
- If dr.Read() Then
- TextBox1.Text = dr("客戶訂單號").ToString : TextBox2.Text = dr("供應商資料").ToString : TextBox5.Text = dr("供應商地址").ToString
- TextBox14.Text = dr("生產工廠").ToString : TextBox51.Text = Format(Val(dr("訂單數量").ToString), "#,##0")
- Else : TextBox1.Text = "" : End If : conn.Close()
- End Sub
- Private Sub Set_DGV1載入前設定()
- DataGridView1.DataSource = Nothing : ds.Clear()
- DataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
- DataGridView1.ColumnHeadersHeight = 25
- DataGridView1.AllowUserToAddRows = False
- 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()
- End Sub
- Private Sub Set_訂單清單()
- Set_DGV1載入前設定()
- SQL1 = "SELECT 訂單明細表.訂單流水號, 訂單明細表.客戶訂單號, 訂單明細表.ItemNumber, 訂單控制表.GOODBOX AS ProductName,
- 訂單明細表.Color, 訂單明細表.DM, 訂單明細表.[4], 訂單明細表.[4.5], 訂單明細表.[5], 訂單明細表.[5.5],
- 訂單明細表.[6], 訂單明細表.[6.5], 訂單明細表.[7], 訂單明細表.[7.5], 訂單明細表.[8], 訂單明細表.[8.5], 訂單明細表.[9],
- 訂單明細表.[9.5], 訂單明細表.[10], 訂單明細表.[10.5], 訂單明細表.[11], 訂單明細表.[11.5], 訂單明細表.[12],
- 訂單明細表.[12.5], 訂單明細表.[13], 訂單明細表.[14],
- 訂單明細表.[4] + 訂單明細表.[4.5] + 訂單明細表.[5] + 訂單明細表.[5.5] + 訂單明細表.[6] + 訂單明細表.[6.5] + 訂單明細表.[7]
- + 訂單明細表.[7.5] + 訂單明細表.[8] + 訂單明細表.[8.5] + 訂單明細表.[9] + 訂單明細表.[9.5] + 訂單明細表.[10] + 訂單明細表.[10.5]
- + 訂單明細表.[11] + 訂單明細表.[11.5] + 訂單明細表.[12] + 訂單明細表.[12.5] + 訂單明細表.[13] + 訂單明細表.[14] AS TOTAL,
- 訂單明細表.資料流水號
- FROM 訂單明細表 FULL OUTER JOIN
- 訂單控制表 ON 訂單明細表.資料流水號 = 訂單控制表.資料流水號
- WHERE (訂單明細表.客戶訂單號 LIKE N'" & TextBox1.Text & "') AND (訂單明細表.訂單流水號 LIKE N'" & TextBox13.Text & "')
- ORDER BY ProductName, 訂單明細表.Color"
- 列印用SQL = SQL1
- Set_DGV1載入後設定()
- End Sub
- Private Sub Set_grid()
- DataGridView1.Columns(0).Visible = False : DataGridView1.Columns(1).Visible = False
- DataGridView1.Columns(2).FillWeight = 120 : DataGridView1.Columns(3).FillWeight = 150 : DataGridView1.Columns(4).FillWeight = 100 : DataGridView1.Columns(5).FillWeight = 70
- DataGridView1.Columns(6).FillWeight = 40 : DataGridView1.Columns(7).FillWeight = 40 : DataGridView1.Columns(8).FillWeight = 40 : DataGridView1.Columns(9).FillWeight = 40
- DataGridView1.Columns(10).FillWeight = 40 : DataGridView1.Columns(11).FillWeight = 40 : DataGridView1.Columns(12).FillWeight = 40 : DataGridView1.Columns(13).FillWeight = 40
- DataGridView1.Columns(14).FillWeight = 40 : DataGridView1.Columns(15).FillWeight = 40 : DataGridView1.Columns(16).FillWeight = 40 : DataGridView1.Columns(17).FillWeight = 40
- DataGridView1.Columns(18).FillWeight = 40 : DataGridView1.Columns(19).FillWeight = 40 : DataGridView1.Columns(20).FillWeight = 40 : DataGridView1.Columns(21).FillWeight = 40
- DataGridView1.Columns(22).FillWeight = 40 : DataGridView1.Columns(23).FillWeight = 40 : DataGridView1.Columns(24).FillWeight = 40 : DataGridView1.Columns(25).FillWeight = 40
- DataGridView1.Columns(26).FillWeight = 60 : DataGridView1.Columns(27).Visible = False
- DataGridView1.Columns(7).DefaultCellStyle.Format = "#,##0" : DataGridView1.Columns(8).DefaultCellStyle.Format = "#,##0" : DataGridView1.Columns(9).DefaultCellStyle.Format = "#,##0"
- DataGridView1.Columns(10).DefaultCellStyle.Format = "#,##0" : DataGridView1.Columns(11).DefaultCellStyle.Format = "#,##0" : DataGridView1.Columns(12).DefaultCellStyle.Format = "#,##0"
- DataGridView1.Columns(13).DefaultCellStyle.Format = "#,##0" : DataGridView1.Columns(14).DefaultCellStyle.Format = "#,##0" : DataGridView1.Columns(15).DefaultCellStyle.Format = "#,##0"
- DataGridView1.Columns(16).DefaultCellStyle.Format = "#,##0" : DataGridView1.Columns(17).DefaultCellStyle.Format = "#,##0" : DataGridView1.Columns(18).DefaultCellStyle.Format = "#,##0"
- DataGridView1.Columns(19).DefaultCellStyle.Format = "#,##0" : DataGridView1.Columns(20).DefaultCellStyle.Format = "#,##0" : DataGridView1.Columns(21).DefaultCellStyle.Format = "#,##0"
- DataGridView1.Columns(22).DefaultCellStyle.Format = "#,##0" : DataGridView1.Columns(23).DefaultCellStyle.Format = "#,##0" : DataGridView1.Columns(24).DefaultCellStyle.Format = "#,##0"
- DataGridView1.Columns(25).DefaultCellStyle.Format = "#,##0" : DataGridView1.Columns(26).DefaultCellStyle.Format = "#,##0" : DataGridView1.Columns(6).DefaultCellStyle.Format = "#,##0"
- DataGridView1.EditMode = DataGridViewEditMode.EditOnEnter
- End Sub
- Private Sub Set_DGV2載入前設定()
- DataGridView2.DataSource = Nothing : ds2.Clear()
- DataGridView2.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
- DataGridView2.ColumnHeadersHeight = 25
- DataGridView2.AllowUserToAddRows = False
- 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(ds2) : DataGridView2.DataSource = ds2.Tables(0) : conn.Close() : Set_grid2()
- End Sub
- Private Sub Set_清單2()
- Set_DGV2載入前設定()
- SQL1 = "SELECT 訂單流水號, 附件數 FROM 訂單附件資料 WHERE 訂單流水號 LIKE N'" & TextBox13.Text & "' ORDER BY 附件數"
- Set_DGV2載入後設定()
- End Sub
- Private Sub Set_grid2()
- DataGridView2.Columns(0).FillWeight = 120 : DataGridView2.Columns(1).FillWeight = 45
- End Sub
- Private Sub Set_DGV3載入前設定()
- DataGridView3.DataSource = Nothing : ds3.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(ds3) : DataGridView3.DataSource = ds3.Tables(0) : conn.Close() : Set_grid4()
- End Sub
- Private Sub Set_清單3()
- Set_DGV3載入前設定()
- SQL1 = "SELECT 資料流水號, 年份季度, 客戶訂單號, 型體號碼, GOODBOX AS 型體名稱, APMA確認 AS 顏色, TVW AS 楦型, 訂單數量, 工廠回復交期 AS 工廠交期, 客戶交期 AS 交期開始, 客戶交期1 AS 交期結束,
- 單價, 總金額, 備註, 生產工廠, 訂單種類, BUYER, CFMSPEC, CFMSAMPLE, TRIAL1, TRIAL2, TRIAL3, TRIAL4, 包裝確認時間, 貼標時間, 裁斷時間, 針車時間, 成型時間, 驗貨時間, 實際離廠日,
- 訂單流水號, 明細建檔, LEATHER, LEA_Note, CXL, CXLTime, 出貨數量, PO_S_Date, Requested_XF, Confirm_XF, Revised_XF, Special_Packaging, Remarks, 出貨地, 楦頭號, 材質, 長期試穿,
- 面料, 副料, 中底, 鞋墊, 大底, 跟, 工廠進度表備註1, 七號模具, 工廠進度表備註2, 國標測試, 客戶包裝確認, 東莞業務備註, 驗貨報告圖片
- FROM 訂單控制表 WHERE 訂單流水號 LIKE N'" & TextBox13.Text & "' ORDER BY GOODBOX, APMA確認, TVW"
- Set_DGV3載入後設定()
- End Sub
- Private Sub Set_grid4()
- DataGridView3.Columns(0).FillWeight = 85 : DataGridView3.Columns(1).FillWeight = 70 : DataGridView3.Columns(2).FillWeight = 130 : DataGridView3.Columns(3).FillWeight = 120
- DataGridView3.Columns(4).FillWeight = 130 : DataGridView3.Columns(5).FillWeight = 80 : DataGridView3.Columns(6).FillWeight = 50 : DataGridView3.Columns(7).FillWeight = 80
- DataGridView3.Columns(8).FillWeight = 90 : DataGridView3.Columns(9).FillWeight = 90 : DataGridView3.Columns(10).FillWeight = 90
- DataGridView3.Columns(11).Visible = False : DataGridView3.Columns(12).Visible = False
- DataGridView3.Columns(13).FillWeight = 62 : DataGridView3.Columns(14).FillWeight = 80 : DataGridView3.Columns(15).FillWeight = 120 : DataGridView3.Columns(16).FillWeight = 130
- DataGridView3.Columns(17).Visible = False : DataGridView3.Columns(18).Visible = False : DataGridView3.Columns(19).Visible = False : DataGridView3.Columns(20).Visible = False
- DataGridView3.Columns(21).Visible = False : DataGridView3.Columns(22).Visible = False : DataGridView3.Columns(23).Visible = False : DataGridView3.Columns(24).Visible = False
- DataGridView3.Columns(25).Visible = False : DataGridView3.Columns(26).Visible = False : DataGridView3.Columns(27).Visible = False : DataGridView3.Columns(28).Visible = False
- DataGridView3.Columns(29).Visible = False : DataGridView3.Columns(30).Visible = False : DataGridView3.Columns(31).Visible = False : DataGridView3.Columns(32).Visible = False
- DataGridView3.Columns(33).Visible = False : DataGridView3.Columns(34).Visible = False : DataGridView3.Columns(35).Visible = False : DataGridView3.Columns(36).Visible = False
- DataGridView3.Columns(37).Visible = False : DataGridView3.Columns(38).Visible = False : DataGridView3.Columns(39).Visible = False : DataGridView3.Columns(40).Visible = False
- DataGridView3.Columns(41).Visible = False : DataGridView3.Columns(42).Visible = False : DataGridView3.Columns(43).Visible = False : DataGridView3.Columns(44).Visible = False
- DataGridView3.Columns(45).Visible = False : DataGridView3.Columns(46).Visible = False : DataGridView3.Columns(47).Visible = False : DataGridView3.Columns(48).Visible = False
- DataGridView3.Columns(49).Visible = False : DataGridView3.Columns(50).Visible = False : DataGridView3.Columns(51).Visible = False : DataGridView3.Columns(52).Visible = False
- DataGridView3.Columns(53).Visible = False : DataGridView3.Columns(54).Visible = False : DataGridView3.Columns(55).Visible = False : DataGridView3.Columns(56).Visible = False
- DataGridView3.Columns(57).Visible = False : DataGridView3.Columns(58).Visible = False : DataGridView3.Columns(59).Visible = False
-
- DataGridView3.Columns(7).DefaultCellStyle.Format = "#,##0"
- DataGridView3.Columns(7).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight
- DataGridView3.Columns(7).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleRight
- DataGridView3.EditMode = DataGridViewEditMode.EditOnEnter
- End Sub
- Private Sub Set_格式設定1()
- TextBox1.Enabled = False : TextBox3.Enabled = False : TextBox13.Enabled = False : TextBox14.Enabled = False : TextBox51.Enabled = False : TextBox7.Visible = False
- DateTimePicker1.Format = DateTimePickerFormat.Custom : DateTimePicker1.CustomFormat = " "
- DateTimePicker2.Format = DateTimePickerFormat.Custom : DateTimePicker2.CustomFormat = " "
- DateTimePicker3.Format = DateTimePickerFormat.Custom : DateTimePicker3.CustomFormat = " "
- DateTimePicker4.Format = DateTimePickerFormat.Custom : DateTimePicker4.CustomFormat = " "
- DateTimePicker5.Format = DateTimePickerFormat.Custom : DateTimePicker5.CustomFormat = " "
- DateTimePicker6.Format = DateTimePickerFormat.Custom : DateTimePicker6.CustomFormat = " "
- DateTimePicker7.Format = DateTimePickerFormat.Custom : DateTimePicker7.CustomFormat = " "
- TextBox8.Text = "" : TextBox9.Text = ""
- TextBox10.Text = "" : TextBox11.Text = "" : TextBox12.Text = ""
- End Sub
- Private Sub Set_自動彙總1()
- Dim 加總(20) As Double
- 加總(0) = 0 : 加總(1) = 0 : 加總(2) = 0 : 加總(3) = 0 : 加總(4) = 0 : 加總(5) = 0 : 加總(6) = 0 : 加總(7) = 0 : 加總(8) = 0
- 加總(9) = 0 : 加總(10) = 0 : 加總(11) = 0 : 加總(12) = 0 : 加總(13) = 0 : 加總(14) = 0 : 加總(15) = 0 : 加總(16) = 0 : 加總(17) = 0 : 加總(18) = 0 : 加總(19) = 0 : 加總(20) = 0
- For i As Integer = 0 To DataGridView1.Rows.Count - 1 : If DataGridView1.RowCount = 0 Then : TextBox56.Text = "0" : Else : 加總(19) += DataGridView1.Rows(i).Cells("4").Value : End If
- Next i : TextBox56.Text = Format(Val(加總(19)), "#,##0") : If TextBox56.Text = "0" Then : TextBox56.ForeColor = Color.Black : Else : TextBox56.ForeColor = Color.Red : End If
- For i As Integer = 0 To DataGridView1.Rows.Count - 1 : If DataGridView1.RowCount = 0 Then : TextBox57.Text = "0" : Else : 加總(20) += DataGridView1.Rows(i).Cells("4.5").Value : End If
- Next i : TextBox57.Text = Format(Val(加總(20)), "#,##0") : If TextBox57.Text = "0" Then : TextBox57.ForeColor = Color.Black : Else : TextBox57.ForeColor = Color.Red : End If
- For i As Integer = 0 To DataGridView1.Rows.Count - 1 : If DataGridView1.RowCount = 0 Then : TextBox15.Text = "0" : Else : 加總(0) += DataGridView1.Rows(i).Cells("5").Value : End If
- Next i : TextBox15.Text = Format(Val(加總(0)), "#,##0") : If TextBox15.Text = "0" Then : TextBox15.ForeColor = Color.Black : Else : TextBox15.ForeColor = Color.Red : End If
- For i As Integer = 0 To DataGridView1.Rows.Count - 1 : If DataGridView1.RowCount = 0 Then : TextBox16.Text = "0" : Else : 加總(1) += DataGridView1.Rows(i).Cells("5.5").Value : End If
- Next i : TextBox16.Text = Format(Val(加總(1)), "#,##0") : If TextBox16.Text = "0" Then : TextBox16.ForeColor = Color.Black : Else : TextBox16.ForeColor = Color.Red : End If
- For i As Integer = 0 To DataGridView1.Rows.Count - 1 : If DataGridView1.RowCount = 0 Then : TextBox17.Text = "0" : Else : 加總(2) += DataGridView1.Rows(i).Cells("6").Value : End If
- Next i : TextBox17.Text = Format(Val(加總(2)), "#,##0") : If TextBox17.Text = "0" Then : TextBox17.ForeColor = Color.Black : Else : TextBox17.ForeColor = Color.Red : End If
- For i As Integer = 0 To DataGridView1.Rows.Count - 1 : If DataGridView1.RowCount = 0 Then : TextBox18.Text = "0" : Else : 加總(3) += DataGridView1.Rows(i).Cells("6.5").Value : End If
- Next i : TextBox18.Text = Format(Val(加總(3)), "#,##0") : If TextBox18.Text = "0" Then : TextBox18.ForeColor = Color.Black : Else : TextBox18.ForeColor = Color.Red : End If
- For i As Integer = 0 To DataGridView1.Rows.Count - 1 : If DataGridView1.RowCount = 0 Then : TextBox19.Text = "0" : Else : 加總(4) += DataGridView1.Rows(i).Cells("7").Value : End If
- Next i : TextBox19.Text = Format(Val(加總(4)), "#,##0") : If TextBox19.Text = "0" Then : TextBox19.ForeColor = Color.Black : Else : TextBox19.ForeColor = Color.Red : End If
- For i As Integer = 0 To DataGridView1.Rows.Count - 1 : If DataGridView1.RowCount = 0 Then : TextBox20.Text = "0" : Else : 加總(5) += DataGridView1.Rows(i).Cells("7.5").Value : End If
- Next i : TextBox20.Text = Format(Val(加總(5)), "#,##0") : If TextBox20.Text = "0" Then : TextBox20.ForeColor = Color.Black : Else : TextBox20.ForeColor = Color.Red : End If
- For i As Integer = 0 To DataGridView1.Rows.Count - 1 : If DataGridView1.RowCount = 0 Then : TextBox21.Text = "0" : Else : 加總(6) += DataGridView1.Rows(i).Cells("8").Value : End If
- Next i : TextBox21.Text = Format(Val(加總(6)), "#,##0") : If TextBox21.Text = "0" Then : TextBox21.ForeColor = Color.Black : Else : TextBox21.ForeColor = Color.Red : End If
- For i As Integer = 0 To DataGridView1.Rows.Count - 1 : If DataGridView1.RowCount = 0 Then : TextBox22.Text = "0" : Else : 加總(7) += DataGridView1.Rows(i).Cells("8.5").Value : End If
- Next i : TextBox22.Text = Format(Val(加總(7)), "#,##0") : If TextBox22.Text = "0" Then : TextBox22.ForeColor = Color.Black : Else : TextBox22.ForeColor = Color.Red : End If
- For i As Integer = 0 To DataGridView1.Rows.Count - 1 : If DataGridView1.RowCount = 0 Then : TextBox23.Text = "0" : Else : 加總(8) += DataGridView1.Rows(i).Cells("9").Value : End If
- Next i : TextBox23.Text = Format(Val(加總(8)), "#,##0") : If TextBox23.Text = "0" Then : TextBox23.ForeColor = Color.Black : Else : TextBox23.ForeColor = Color.Red : End If
- For i As Integer = 0 To DataGridView1.Rows.Count - 1 : If DataGridView1.RowCount = 0 Then : TextBox24.Text = "0" : Else : 加總(9) += DataGridView1.Rows(i).Cells("9.5").Value : End If
- Next i : TextBox24.Text = Format(Val(加總(9)), "#,##0") : If TextBox24.Text = "0" Then : TextBox24.ForeColor = Color.Black : Else : TextBox24.ForeColor = Color.Red : End If
- For i As Integer = 0 To DataGridView1.Rows.Count - 1 : If DataGridView1.RowCount = 0 Then : TextBox25.Text = "0" : Else : 加總(10) += DataGridView1.Rows(i).Cells("10").Value : End If
- Next i : TextBox25.Text = Format(Val(加總(10)), "#,##0") : If TextBox25.Text = "0" Then : TextBox25.ForeColor = Color.Black : Else : TextBox25.ForeColor = Color.Red : End If
- For i As Integer = 0 To DataGridView1.Rows.Count - 1 : If DataGridView1.RowCount = 0 Then : TextBox26.Text = "0" : Else : 加總(11) += DataGridView1.Rows(i).Cells("10.5").Value : End If
- Next i : TextBox26.Text = Format(Val(加總(11)), "#,##0") : If TextBox26.Text = "0" Then : TextBox26.ForeColor = Color.Black : Else : TextBox26.ForeColor = Color.Red : End If
- For i As Integer = 0 To DataGridView1.Rows.Count - 1 : If DataGridView1.RowCount = 0 Then : TextBox27.Text = "0" : Else : 加總(12) += DataGridView1.Rows(i).Cells("11").Value : End If
- Next i : TextBox27.Text = Format(Val(加總(12)), "#,##0") : If TextBox27.Text = "0" Then : TextBox27.ForeColor = Color.Black : Else : TextBox27.ForeColor = Color.Red : End If
- For i As Integer = 0 To DataGridView1.Rows.Count - 1 : If DataGridView1.RowCount = 0 Then : TextBox53.Text = "0" : Else : 加總(17) += DataGridView1.Rows(i).Cells("11.5").Value : End If
- Next i : TextBox53.Text = Format(Val(加總(17)), "#,##0") : If TextBox53.Text = "0" Then : TextBox53.ForeColor = Color.Black : Else : TextBox53.ForeColor = Color.Red : End If
- For i As Integer = 0 To DataGridView1.Rows.Count - 1 : If DataGridView1.RowCount = 0 Then : TextBox28.Text = "0" : Else : 加總(13) += DataGridView1.Rows(i).Cells("12").Value : End If
- Next i : TextBox28.Text = Format(Val(加總(13)), "#,##0") : If TextBox28.Text = "0" Then : TextBox28.ForeColor = Color.Black : Else : TextBox28.ForeColor = Color.Red : End If
- For i As Integer = 0 To DataGridView1.Rows.Count - 1 : If DataGridView1.RowCount = 0 Then : TextBox54.Text = "0" : Else : 加總(18) += DataGridView1.Rows(i).Cells("12.5").Value : End If
- Next i : TextBox54.Text = Format(Val(加總(18)), "#,##0") : If TextBox54.Text = "0" Then : TextBox54.ForeColor = Color.Black : Else : TextBox54.ForeColor = Color.Red : End If
- For i As Integer = 0 To DataGridView1.Rows.Count - 1 : If DataGridView1.RowCount = 0 Then : TextBox29.Text = "0" : Else : 加總(14) += DataGridView1.Rows(i).Cells("13").Value : End If
- Next i : TextBox29.Text = Format(Val(加總(14)), "#,##0") : If TextBox29.Text = "0" Then : TextBox29.ForeColor = Color.Black : Else : TextBox29.ForeColor = Color.Red : End If
- For i As Integer = 0 To DataGridView1.Rows.Count - 1 : If DataGridView1.RowCount = 0 Then : TextBox30.Text = "0" : Else : 加總(15) += DataGridView1.Rows(i).Cells("14").Value : End If
- Next i : TextBox30.Text = Format(Val(加總(15)), "#,##0") : If TextBox30.Text = "0" Then : TextBox30.ForeColor = Color.Black : Else : TextBox30.ForeColor = Color.Red : End If
-
- 加總(16) = 加總(0) + 加總(1) + 加總(2) + 加總(3) + 加總(4) + 加總(5) + 加總(6) + 加總(7) + 加總(8) + 加總(9) + 加總(10) + 加總(11) + 加總(12) + 加總(13) + 加總(14) + 加總(15) + 加總(17) + 加總(18) +
- 加總(19) + 加總(20)
- TextBox31.Text = Format(Val(加總(16)), "#,##0")
- 加總(16) = 0
- If TextBox31.Text = "0" Then : TextBox31.ForeColor = Color.Black : Else : TextBox31.ForeColor = Color.Blue : End If
- End Sub
- Private Sub 下拉表單資料載入1()
- conn.Close()
- If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
- SQL1 = "SELECT 客戶簡稱 FROM 客戶控制表"
- cmd.CommandText = SQL1 : cmd.Connection = conn : dr = cmd.ExecuteReader : ComboBox1.Items.Clear()
- While (dr.Read()) : ComboBox1.Items.Add(dr("客戶簡稱")) : End While : conn.Close()
- If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
- SQL1 = "SELECT MODEOFDELIVERY FROM MODEOFDELIVERY"
- cmd.CommandText = SQL1 : cmd.Connection = conn : dr = cmd.ExecuteReader : ComboBox4.Items.Clear()
- While (dr.Read()) : ComboBox4.Items.Add(dr("MODEOFDELIVERY")) : End While : conn.Close()
- If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
- SQL1 = "SELECT DELIVERYTERMS FROM DELIVERYTERMS"
- cmd.CommandText = SQL1 : cmd.Connection = conn : dr = cmd.ExecuteReader : ComboBox5.Items.Clear()
- While (dr.Read()) : ComboBox5.Items.Add(dr("DELIVERYTERMS")) : End While : conn.Close()
- If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
- SQL1 = "SELECT FOB FROM 港口清單"
- cmd.CommandText = SQL1 : cmd.Connection = conn : dr = cmd.ExecuteReader : ComboBox6.Items.Clear()
- While (dr.Read()) : ComboBox6.Items.Add(dr("FOB")) : End While : conn.Close()
- If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
- SQL1 = "SELECT TOPORT FROM TOPORT ORDER BY TOPORT"
- cmd.CommandText = SQL1 : cmd.Connection = conn : dr = cmd.ExecuteReader : ComboBox7.Items.Clear()
- While (dr.Read()) : ComboBox7.Items.Add(dr("TOPORT")) : End While : conn.Close()
- If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
- SQL1 = "SELECT REMARK FROM DELIVERYADDRESS ORDER BY REMARK"
- cmd.CommandText = SQL1 : cmd.Connection = conn : dr = cmd.ExecuteReader : ComboBox8.Items.Clear()
- While (dr.Read()) : ComboBox8.Items.Add(dr("REMARK")) : End While : conn.Close()
- 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 : Set_格式設定1()
- Target1 = Target & AA(1) & "/"
- WebBrowser1.Url = New Uri(Target1)
-
- GroupBox1.Visible = False : DateTimePicker8.Visible = False
- If PA = "" Then : Else
- TextBox13.Text = PA
- 下拉表單資料載入1()
- 基本資料載入()
- If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
- SQL1 = "SELECT 訂單明細表抬頭.客戶訂單號, 訂單明細表抬頭.訂單流水號, 訂單明細表抬頭.ModeOfDelivery, 訂單明細表抬頭.DeliveryTerms, 訂單明細表抬頭.OrgShipDate, " &
- "訂單明細表抬頭.FromPort, 訂單明細表抬頭.ToPort, 訂單明細表抬頭.ShippingCarrier, 訂單明細表抬頭.VendorReference, 訂單明細表抬頭.ModifiedDate, 訂單明細表抬頭.CustomerName, " &
- "訂單明細表抬頭.ShipDate, 訂單明細表抬頭.SalesOrder, 訂單明細表抬頭.DeliveryAddress, 訂單明細表抬頭.下單日, 訂單明細表抬頭.交期, 訂單明細表抬頭.ETADate, 訂單明細表抬頭.CreatedDate, " &
- "訂單明細表抬頭.Brand, 訂單明細表抬頭.CustomerRequisition, DELIVERYADDRESS.REMARK FROM 訂單明細表抬頭 INNER JOIN DELIVERYADDRESS ON 訂單明細表抬頭.DeliveryAddress = " &
- "DELIVERYADDRESS.DELIVERYADDRESS WHERE (訂單明細表抬頭.客戶訂單號 LIKE '" & TextBox1.Text & "') AND (訂單明細表抬頭.訂單流水號 LIKE '" & TextBox13.Text & "')"
- cmd.Connection = conn : cmd.CommandText = SQL1 : dr = cmd.ExecuteReader
- If dr.Read() Then
- ComboBox4.Text = dr("ModeOfDelivery").ToString : ComboBox5.Text = dr("DeliveryTerms").ToString : ComboBox6.Text = dr("FromPort").ToString
- ComboBox7.Text = dr("ToPort").ToString : TextBox8.Text = dr("ShippingCarrier").ToString : TextBox9.Text = dr("VendorReference").ToString
- TextBox10.Text = dr("CustomerName").ToString : TextBox11.Text = dr("SalesOrder").ToString : TextBox12.Text = dr("DeliveryAddress").ToString
- ComboBox1.Text = dr("Brand").ToString : TextBox6.Text = dr("CustomerRequisition").ToString
- Date1 = dr("CreatedDate").ToString : Date2 = dr("OrgShipDate").ToString : Date3 = dr("ModifiedDate").ToString
- Date4 = dr("ShipDate").ToString : Date5 = dr("下單日").ToString : Date6 = dr("交期").ToString : Date7 = dr("ETADate").ToString
- If Date1 = " " Or Date1 = "" Then : Else : DateTimePicker1.Format = DateTimePickerFormat.Short : DateTimePicker1.Text = dr("CreatedDate").ToString : End If
- If Date2 = " " Or Date2 = "" Then : Else : DateTimePicker2.Format = DateTimePickerFormat.Short : DateTimePicker2.Text = dr("OrgShipDate").ToString : End If
- If Date3 = " " Or Date3 = "" Then : Else : DateTimePicker3.Format = DateTimePickerFormat.Short : DateTimePicker3.Text = dr("ModifiedDate").ToString : End If
- If Date4 = " " Or Date4 = "" Then : Else : DateTimePicker4.Format = DateTimePickerFormat.Short : DateTimePicker4.Text = dr("ShipDate").ToString : End If
- If Date5 = " " Or Date5 = "" Then : Else : DateTimePicker5.Format = DateTimePickerFormat.Short : DateTimePicker5.Text = dr("下單日").ToString : End If
- If Date6 = " " Or Date6 = "" Then : Else : DateTimePicker6.Format = DateTimePickerFormat.Short : DateTimePicker6.Text = dr("交期").ToString : End If
- If Date7 = " " Or Date7 = "" Then : Else : DateTimePicker7.Format = DateTimePickerFormat.Short : DateTimePicker7.Text = dr("ETADate").ToString : End If
- ComboBox8.Text = dr("REMARK").ToString
- End If
- conn.Close()
- Set_訂單清單() : Set_自動彙總1() : Set_grid() : Set_清單3() : Set_清單2()
- TextBox32.Text = DataGridView3.Rows(0).Cells("CFMSPEC").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'" & DataGridView3.Rows(0).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'" & DataGridView3.Rows(0).Cells("型體號碼").Value & "' AND 類別 LIKE N'設計圖'"
- cmd.Connection = conn : cmd.CommandText = SQL1 : dr = cmd.ExecuteReader
- While dr.Read() = True
- Dim unused As Byte() = New Byte(-1) {} : Dim bytes As Byte() = DirectCast(dr.Item("圖片"), Byte())
- Dim oStream As New MemoryStream(bytes) : PictureBox1.Image = Bitmap.FromStream(oStream)
- End While
- conn.Close()
- Else
- 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'" & DataGridView3.Rows(0).Cells("型體號碼").Value & "'"
- 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'" & DataGridView3.Rows(0).Cells("型體號碼").Value & "'"
- cmd.Connection = conn : cmd.CommandText = SQL1 : dr = cmd.ExecuteReader
- While dr.Read() = True
- Dim unused2 As Byte() = New Byte(-1) {} : Dim bytes As Byte() = DirectCast(dr.Item("圖片"), Byte())
- Dim oStream As New MemoryStream(bytes) : PictureBox1.Image = Bitmap.FromStream(oStream)
- End While
- conn.Close()
- Else
- PictureBox1.Image = Nothing : conn.Close()
- If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
- SQL1 = "SELECT 圖片 FROM 鞋樣素描圖控制表 WHERE 型體編號 LIKE N'" & DataGridView3.Rows(0).Cells("型體號碼").Value & "'"
- 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 圖片 FROM 鞋樣素描圖控制表 WHERE 型體編號 LIKE N'" & DataGridView3.Rows(0).Cells("型體號碼").Value & "'"
- cmd.Connection = conn : cmd.CommandText = SQL1 : dr = cmd.ExecuteReader
- While dr.Read() = True
- Dim unused1 As Byte() = New Byte(-1) {} : Dim bytes As Byte() = DirectCast(dr.Item("圖片"), Byte())
- Dim oStream As New MemoryStream(bytes) : PictureBox1.Image = Bitmap.FromStream(oStream)
- End While
- conn.Close()
- Else
- conn.Close()
- End If
- End If
- End If : PictureBox1.SizeMode = 4
- 列印用SQL1 = TextBox13.Text
- End If : PA = ""
- End Sub
- Private Sub DataGridView2_CellClick(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles DataGridView2.CellClick
- PictureBox2.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("訂單流水號").Value & "' AND 附件數 LIKE N'" & DataGridView2.Rows(e.RowIndex).Cells("附件數").Value & "'"
- cmd.Connection = conn : cmd.CommandText = SQL1 : dr = cmd.ExecuteReader
- While dr.Read() = True
- Dim unused As Byte() = New Byte(-1) {} : Dim bytes As Byte() = DirectCast(dr.Item("圖片"), Byte())
- Dim oStream As New MemoryStream(bytes) : PictureBox2.Image = Bitmap.FromStream(oStream)
- End While
- conn.Close()
- PictureBox2.SizeMode = 4
- End Sub
- Private Sub DataGridView3_CellClick(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles DataGridView3.CellClick
- If e.RowIndex = -1 Then : Else
- 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'" & DataGridView3.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'" & DataGridView3.Rows(e.RowIndex).Cells("型體號碼").Value & "' AND 類別 LIKE N'設計圖'"
- cmd.Connection = conn : cmd.CommandText = SQL1 : dr = cmd.ExecuteReader
- While dr.Read() = True
- Dim unused As Byte() = New Byte(-1) {} : Dim bytes As Byte() = DirectCast(dr.Item("圖片"), Byte())
- Dim oStream As New MemoryStream(bytes) : PictureBox1.Image = Bitmap.FromStream(oStream)
- End While
- conn.Close()
- Else
- 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'" & DataGridView3.Rows(e.RowIndex).Cells("型體號碼").Value & "'"
- 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'" & DataGridView3.Rows(e.RowIndex).Cells("型體號碼").Value & "'"
- cmd.Connection = conn : cmd.CommandText = SQL1 : dr = cmd.ExecuteReader
- While dr.Read() = True
- Dim unused1 As Byte() = New Byte(-1) {} : Dim bytes As Byte() = DirectCast(dr.Item("圖片"), Byte())
- Dim oStream As New MemoryStream(bytes) : PictureBox1.Image = Bitmap.FromStream(oStream)
- End While
- conn.Close()
- Else
- PictureBox1.Image = Nothing : conn.Close()
- If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
- SQL1 = "SELECT 圖片 FROM 鞋樣素描圖控制表 WHERE 型體編號 LIKE N'" & DataGridView3.Rows(e.RowIndex).Cells("型體號碼").Value & "'"
- 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 圖片 FROM 鞋樣素描圖控制表 WHERE 型體編號 LIKE N'" & DataGridView3.Rows(e.RowIndex).Cells("型體號碼").Value & "'"
- cmd.Connection = conn : cmd.CommandText = SQL1 : dr = cmd.ExecuteReader
- While dr.Read() = True
- Dim unused2 As Byte() = New Byte(-1) {} : Dim bytes As Byte() = DirectCast(dr.Item("圖片"), Byte())
- Dim oStream As New MemoryStream(bytes) : PictureBox1.Image = Bitmap.FromStream(oStream)
- End While
- conn.Close()
- Else
- conn.Close()
- End If
- End If
- End If : PictureBox1.SizeMode = 4
- End If
- End Sub
- Private Sub DataGridView1_CellContentClick(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles DataGridView1.CellEndEdit
- TextBox51.Text = "0"
- For i As Integer = 0 To DataGridView1.Rows.Count - 1
- DataGridView3.Rows(i).Cells("訂單數量").Value = DataGridView1.Rows(i).Cells("4").Value + DataGridView1.Rows(i).Cells("4.5").Value + DataGridView1.Rows(i).Cells("5").Value +
- DataGridView1.Rows(i).Cells("5.5").Value + DataGridView1.Rows(i).Cells("6").Value + DataGridView1.Rows(i).Cells("6.5").Value + DataGridView1.Rows(i).Cells("7").Value +
- DataGridView1.Rows(i).Cells("7.5").Value + DataGridView1.Rows(i).Cells("8").Value + DataGridView1.Rows(i).Cells("8.5").Value + DataGridView1.Rows(i).Cells("9").Value +
- DataGridView1.Rows(i).Cells("9.5").Value + DataGridView1.Rows(i).Cells("10").Value + DataGridView1.Rows(i).Cells("10.5").Value + DataGridView1.Rows(i).Cells("11").Value +
- DataGridView1.Rows(i).Cells("11.5").Value + DataGridView1.Rows(i).Cells("12").Value + DataGridView1.Rows(i).Cells("12.5").Value + DataGridView1.Rows(i).Cells("13").Value +
- DataGridView1.Rows(i).Cells("14").Value
- DataGridView1.Rows(i).Cells("TOTAL").Value = DataGridView3.Rows(i).Cells("訂單數量").Value
- Next i
- For i As Integer = 0 To DataGridView3.Rows.Count - 1
- TextBox51.Text = Val(TextBox51.Text) + DataGridView3.Rows(i).Cells("訂單數量").Value
- Next i
- TextBox51.Text = Format(Val(TextBox51.Text), "#,##0")
- Set_自動彙總1()
- End Sub
- Private Sub DataGridView3_CellEndEdit(ByVal sender As Object, ByVal e As DataGridViewCellEventArgs) Handles DataGridView3.CellEndEdit
- Dim EU(2) As String
- EU(0) = DataGridView3("交期開始", e.RowIndex).Value.ToString
- If EU(0) = "" Then
- Else
- DateTimePicker8.Text = EU(0)
- DataGridView3.Rows(e.RowIndex).Cells("交期開始").Value = Format(DateTimePicker8.Value, "yyyy/MM/dd")
- End If
- EU(1) = DataGridView3("交期結束", e.RowIndex).Value.ToString
- If EU(1) = "" Then
- Else
- DateTimePicker8.Text = EU(1)
- DataGridView3.Rows(e.RowIndex).Cells("交期結束").Value = Format(DateTimePicker8.Value, "yyyy/MM/dd")
- End If
- EU(2) = DataGridView3("工廠交期", e.RowIndex).Value.ToString
- If EU(2) = "" Then
- Else
- DateTimePicker8.Text = EU(2)
- DataGridView3.Rows(e.RowIndex).Cells("工廠交期").Value = Format(DateTimePicker8.Value, "yyyy/MM/dd")
- End If
- End Sub
- Private Sub ComboBox8_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox8.TextChanged
- conn.Close()
- If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
- SQL1 = "SELECT DELIVERYADDRESS FROM DELIVERYADDRESS WHERE REMARK LIKE '" & ComboBox8.Text & "'"
- cmd.Connection = conn : cmd.CommandText = SQL1 : dr = cmd.ExecuteReader
- If dr.Read() Then : TextBox12.Text = dr("DELIVERYADDRESS").ToString : End If : conn.Close()
- End Sub
- Private Sub Button30_Click(sender As Object, e As EventArgs) Handles Button30.Click
- Me.Close()
- 列印用SQL = ""
- End Sub
- Private Sub Button12_Click(sender As Object, e As EventArgs) Handles Button12.Click
- OD(0) = TextBox1.Text : OD(1) = DateTimePicker1.Text : OD(2) = ComboBox1.Text : OD(3) = TextBox2.Text : OD(4) = ComboBox4.Text
- OD(5) = ComboBox5.Text : OD(6) = TextBox5.Text
-
- OD(7) = DateTimePicker2.Text : OD(8) = ComboBox6.Text : OD(9) = ComboBox7.Text : OD(10) = TextBox8.Text : OD(11) = TextBox9.Text
-
- OD(12) = DateTimePicker3.Text : OD(13) = TextBox10.Text : OD(14) = DateTimePicker4.Text : OD(15) = TextBox11.Text
- OD(16) = DateTimePicker7.Text : OD(17) = TextBox12.Text
-
- OD(18) = TextBox13.Text : OD(19) = TextBox14.Text : OD(20) = DateTimePicker5.Text : OD(21) = DateTimePicker6.Text
- OD(40) = ComboBox8.Text
- OD(22) = TextBox15.Text : OD(23) = TextBox16.Text : OD(24) = TextBox17.Text : OD(25) = TextBox18.Text : OD(26) = TextBox19.Text
- OD(27) = TextBox20.Text : OD(28) = TextBox21.Text : OD(29) = TextBox22.Text : OD(30) = TextBox23.Text : OD(31) = TextBox24.Text
- OD(32) = TextBox25.Text : OD(33) = TextBox26.Text : OD(34) = TextBox27.Text : OD(35) = TextBox28.Text : OD(36) = TextBox29.Text
- OD(37) = TextBox30.Text : OD(38) = TextBox31.Text : OD(39) = TextBox6.Text : OD(41) = TextBox53.Text : OD(42) = TextBox54.Text
- OD(43) = TextBox56.Text : OD(44) = TextBox57.Text : OD(45) = TextBox32.Text
- 列印_訂單明細.Show()
- End Sub
- Private Sub Set_日期格式轉換()
- DTP(0) = DateTimePicker1.Text : DTP(1) = DateTimePicker2.Text : DTP(2) = DateTimePicker3.Text : DTP(3) = DateTimePicker4.Text : DTP(4) = DateTimePicker5.Text
- DTP(5) = DateTimePicker6.Text : DTP(6) = DateTimePicker7.Text
- If DTP(0) = " " Then : DTP(0) = "" : Else : DTP(0) = Format(DateTimePicker1.Value, "yyyy/MM/dd") : End If
- If DTP(1) = " " Then : DTP(1) = "" : Else : DTP(1) = Format(DateTimePicker2.Value, "yyyy/MM/dd") : End If
- If DTP(2) = " " Then : DTP(2) = "" : Else : DTP(2) = Format(DateTimePicker3.Value, "yyyy/MM/dd") : End If
- If DTP(3) = " " Then : DTP(3) = "" : Else : DTP(3) = Format(DateTimePicker4.Value, "yyyy/MM/dd") : End If
- If DTP(4) = " " Then : DTP(4) = "" : Else : DTP(4) = Format(DateTimePicker5.Value, "yyyy/MM/dd") : End If
- If DTP(5) = " " Then : DTP(5) = "" : Else : DTP(5) = Format(DateTimePicker6.Value, "yyyy/MM/dd") : End If
- If DTP(6) = " " Then : DTP(6) = "" : Else : DTP(6) = Format(DateTimePicker7.Value, "yyyy/MM/dd") : End If
- End Sub
- Private Sub Button8_Click(sender As Object, e As EventArgs) Handles Button8.Click
- Set_日期格式轉換()
- If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
- SQL1 = "UPDATE 訂單明細表抬頭 SET ModeOfDelivery = N'" & ComboBox4.Text & "', DeliveryTerms = N'" & ComboBox5.Text & "', FromPort = N'" & ComboBox6.Text & "', ToPort = N'" & ComboBox7.Text & "',
- 工廠 = N'" & TextBox14.Text & "', DeliveryAddress = N'" & TextBox12.Text & "', CustomerRequisition = N'" & TextBox6.Text & "', OrgShipDate = N'" & DTP(1) & "',
- ShippingCarrier = N'" & TextBox8.Text & "', VendorReference = N'" & TextBox9.Text & "', ModifiedDate = N'" & DTP(2) & "', ShipDate = N'" & DTP(3) & "',
- SalesOrder = N'" & TextBox11.Text & "', CustomerName = N'" & TextBox10.Text & "', 下單日 = N'" & DTP(4) & "', 交期 = N'" & DTP(5) & "', ETADate = N'" & DTP(6) & "',
- CreatedDate = N'" & DTP(0) & "', Brand = N'" & ComboBox1.Text & "'
- WHERE (訂單流水號 LIKE N'" & TextBox13.Text & "')"
- cmd.CommandText = SQL1 : cmd.ExecuteNonQuery() : conn.Close()
-
- For i As Integer = 0 To DataGridView3.Rows.Count - 1
- 資料數 = DataGridView3.Rows.Count : MyModule1.進度條()
- If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
- SQL1 = "UPDATE 訂單控制表 SET 訂單數量 = N'" & DataGridView3.Rows(i).Cells("訂單數量").Value & "', 客戶交期 = N'" & DataGridView3.Rows(i).Cells("交期開始").Value &
- "', 客戶交期1 = N'" & DataGridView3.Rows(i).Cells("交期結束").Value & "', 備註 = N'" & DataGridView3.Rows(i).Cells("備註").Value &
- "', 工廠回復交期 = N'" & DataGridView3.Rows(i).Cells("工廠交期").Value & "', BUYER = N'" & DataGridView3.Rows(i).Cells("BUYER").Value & "'
- WHERE (資料流水號 LIKE N'" & DataGridView3.Rows(i).Cells("資料流水號").Value & "')"
- cmd.CommandText = SQL1 : cmd.ExecuteNonQuery() : conn.Close()
- Next i : WINPROFIT_ERP_SYS.ToolStripProgressBar1.Value = 0 : 最終數 = 0
- For i As Integer = 0 To DataGridView1.Rows.Count - 1
- 資料數 = DataGridView1.Rows.Count : MyModule1.進度條()
- If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
- SQL1 = "UPDATE 訂單明細表 SET [4] = N'" & DataGridView1.Rows(i).Cells("4").Value & "', [4.5] = N'" & DataGridView1.Rows(i).Cells("4.5").Value &
- "', [5] = N'" & DataGridView1.Rows(i).Cells("5").Value & "', [5.5] = N'" & DataGridView1.Rows(i).Cells("5.5").Value &
- "', [6] = N'" & DataGridView1.Rows(i).Cells("6").Value & "', [6.5] = N'" & DataGridView1.Rows(i).Cells("6.5").Value &
- "', [7] = N'" & DataGridView1.Rows(i).Cells("7").Value & "', [7.5] = N'" & DataGridView1.Rows(i).Cells("7.5").Value &
- "', [8] = N'" & DataGridView1.Rows(i).Cells("8").Value & "', [8.5] = N'" & DataGridView1.Rows(i).Cells("8.5").Value &
- "', [9] = N'" & DataGridView1.Rows(i).Cells("9").Value & "', [9.5] = N'" & DataGridView1.Rows(i).Cells("9.5").Value &
- "', [10] = N'" & DataGridView1.Rows(i).Cells("10").Value & "', [10.5] = N'" & DataGridView1.Rows(i).Cells("10.5").Value &
- "', [11] = N'" & DataGridView1.Rows(i).Cells("11").Value & "', [11.5] = N'" & DataGridView1.Rows(i).Cells("11.5").Value &
- "', [12] = N'" & DataGridView1.Rows(i).Cells("12").Value & "', [12.5] = N'" & DataGridView1.Rows(i).Cells("12.5").Value &
- "', [13] = N'" & DataGridView1.Rows(i).Cells("13").Value & "', [14] = N'" & DataGridView1.Rows(i).Cells("14").Value & "'
- WHERE (資料流水號 LIKE N'" & DataGridView1.Rows(i).Cells("資料流水號").Value & "')"
- cmd.CommandText = SQL1 : cmd.ExecuteNonQuery() : conn.Close()
- Next i : WINPROFIT_ERP_SYS.ToolStripProgressBar1.Value = 0 : 最終數 = 0
- MsgBox("存檔完成。")
- End Sub
- Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click
- Dim NUM1 As Integer
- If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
- SQL1 = "SELECT 附件數 FROM 訂單附件資料 WHERE 訂單流水號 LIKE N'" & TextBox13.Text & "' ORDER BY 附件數 DESC"
- cmd.Connection = conn : cmd.CommandText = SQL1 : dr = cmd.ExecuteReader
- If dr.Read() Then : 新流水號3 = dr("附件數") : Else : 新流水號3 = "V00" : End If : conn.Close()
-
- NUM1 = Double.Parse(Strings.Right(新流水號3, 2)) + 1
- If NUM1 < 10 Then : 新流水號3 = "V" & "0" & NUM1
- ElseIf NUM1 > 9 Then : 新流水號3 = "V" & NUM1
- End If
- TextBox3.Text = 新流水號3
- GroupBox1.Visible = True
- If FolderBrowserDialog1.ShowDialog = DialogResult.OK Then
- WebBrowser2.Navigate(FolderBrowserDialog1.SelectedPath)
- End If
- End Sub
- Private Sub Button7_Click(sender As Object, e As EventArgs) Handles Button7.Click
- GroupBox1.Visible = False
- End Sub
- Private Sub Button14_Click(sender As Object, e As EventArgs) Handles Button14.Click
- If FolderBrowserDialog1.ShowDialog = DialogResult.OK Then
- WebBrowser2.Navigate(FolderBrowserDialog1.SelectedPath)
- End If
- End Sub
- Private Sub TextBox4_DragEnter(sender As Object, e As DragEventArgs) Handles TextBox4.DragEnter
- If e.Data.GetDataPresent(DataFormats.FileDrop) Then
- Dim files As String()
- Try
- files = CType(e.Data.GetData(DataFormats.FileDrop), String())
- TextBox4.Text = files(files.Length - 1)
- Catch ex As Exception
- MessageBox.Show(ex.Message)
- Return
- End Try
- End If
-
- Dim STR2 As Integer = 0
- TextBox7.Text = TextBox4.Text
- If TextBox4.Text = "" Then
- Else
- For i As Integer = 0 To 9999
- Dim STR1 As Integer = Strings.Len(TextBox7.Text)
- If Strings.Right((TextBox7.Text), 1) <> "\" Then
- STR1 -= 1 : STR2 += 1
- If STR1 = 0 Then
- TextBox7.Text = ""
- TextBox4.Text = ""
- i = 9999
- Else
- TextBox7.Text = Strings.Left((TextBox7.Text), STR1)
- End If
- Else
- TextBox7.Text = Strings.Right((TextBox4.Text), STR2)
- TextBox4.Text = TextBox7.Text
- i = 9999
- End If
- Next
- End If
- End Sub
- Private Sub TextBox4_DragDrop(ByVal sender As Object, ByVal e As DragEventArgs) Handles TextBox4.DragDrop
- Dim files As Array = e.Data.GetData(DataFormats.FileDrop)
- For Each file As String In files
- TextBox4.AppendText(file + Environment.NewLine)
- Next
- End Sub
- Private Sub Button9_Click(sender As Object, e As EventArgs) Handles Button9.Click
- If TextBox3.Text = "" Or TextBox4.Text = "" Then
- MsgBox("請注意圖片檔案已準備完畢")
- Else
- If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
- SQL1 = "INSERT INTO 訂單附件資料 (訂單流水號, 附件數, 圖片) SELECT N'" & TextBox13.Text & "',N'" & TextBox3.Text &
- "', BULKCOLUMN FROM OPENROWSET ( BULK '" & FTP實體位置 & AA(1) & "\" & TextBox4.Text & "', SINGLE_BLOB) AS EMPLOYEEPICTURE"
- cmd.Connection = conn : cmd.CommandText = SQL1 : cmd.ExecuteNonQuery() : conn.Close()
- '---FTP方式刪除檔案----------------------------------------------------------------------------------------------------------------------------------------------------------------------
- Dim frq As FtpWebRequest, frp As FtpWebResponse, fcr As NetworkCredential
- frq = CType(WebRequest.Create(New Uri(Target1 & TextBox4.Text)), FtpWebRequest)
- fcr = New NetworkCredential(FTP帳號, FTP密碼)
- frq.Credentials = fcr
- frq.Method = WebRequestMethods.Ftp.DeleteFile
- frq.UseBinary = True
- frp = CType(frq.GetResponse, FtpWebResponse)
- frp.Close()
- WebBrowser1.Refresh()
- '----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
- PictureBox2.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'" & TextBox13.Text & "' AND 附件數 LIKE N'" & TextBox3.Text & "'"
- cmd.Connection = conn : cmd.CommandText = SQL1 : dr = cmd.ExecuteReader
- While dr.Read() = True
- Dim unused As Byte() = New Byte(-1) {} : Dim bytes As Byte() = DirectCast(dr.Item("圖片"), Byte())
- Dim oStream As New MemoryStream(bytes) : PictureBox2.Image = Bitmap.FromStream(oStream)
- End While
- conn.Close() : PictureBox2.SizeMode = 4 : TextBox3.Text = "" : TextBox4.Text = "" : MsgBox("新增完成") : GroupBox1.Visible = False : Set_清單2()
- End If
- End Sub
- Private Sub PictureBox1_MouseUp(ByVal sender As Object, ByVal e As MouseEventArgs) Handles PictureBox2.MouseUp
- m_DeltaX = m_MousePosX - e.X
- m_DeltaY = m_MousePosY - e.Y
- m_Leftx -= m_DeltaX
- m_Lefty -= m_DeltaY
- Picturemove(sender, e)
- Me.Cursor = Cursors.Arrow
- End Sub
- '@#当鼠标按下时,将鼠标变成手形,并且记录下当前鼠标的位置
- Private Sub PictureBox1_MouseDown(ByVal sender As Object, ByVal e As MouseEventArgs) Handles PictureBox2.MouseDown
- Me.Cursor = Cursors.Hand
- m_MousePosX = e.X
- m_MousePosY = e.Y
- End Sub
- '@#根据偏移量计算出的图片位置,重画图片
- Private Sub Picturemove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs)
- Dim myBit As New Bitmap(PictureBox2.Image)
- Dim myPicGrh As Graphics = Me.PictureBox2.CreateGraphics
- myPicGrh.Clear(Me.PictureBox2.BackColor)
- myPicGrh.DrawImageUnscaled(myBit, m_Leftx - 152, m_Lefty)
- myBit.Dispose()
- myPicGrh.Dispose()
- End Sub
- Private Sub Button20_Click(sender As Object, e As EventArgs) Handles Button20.Click
- Dim image = PictureBox2.Image
- Dim g As Graphics = PictureBox2.CreateGraphics
- g.DrawImage(image, New Rectangle(0, 0, image.Width * 1.01, image.Height * 1.01))
- End Sub
- Private Sub Button11_Click(sender As Object, e As EventArgs) Handles Button11.Click
- PictureBox2.Refresh()
- End Sub
- Private Sub Button25_Click(sender As Object, e As EventArgs) Handles Button25.Click
- PictureBox2.Image.RotateFlip(RotateFlipType.Rotate90FlipNone) : PictureBox2.Refresh() : PictureBox2.SizeMode = 4
- End Sub
- Private Sub Button24_Click(sender As Object, e As EventArgs) Handles Button24.Click
- PictureBox2.Image.RotateFlip(RotateFlipType.Rotate270FlipNone) : PictureBox2.Refresh() : PictureBox2.SizeMode = 4
- End Sub
- Private Sub Button23_Click(sender As Object, e As EventArgs) Handles Button23.Click
- PictureBox2.Image.RotateFlip(RotateFlipType.Rotate180FlipY) : PictureBox2.Refresh() : PictureBox2.SizeMode = 4
- End Sub
- Private Sub Button21_Click(sender As Object, e As EventArgs) Handles Button21.Click
- PictureBox2.Image.RotateFlip(RotateFlipType.Rotate180FlipX) : PictureBox2.Refresh() : PictureBox2.SizeMode = 4
- End Sub
-
- Private Sub Button26_Click(sender As Object, e As EventArgs) Handles Button26.Click
- For i As Integer = 0 To DataGridView3.Rows.Count - 1
- DataGridView3.Rows(i).Cells("BUYER").Value = ComboBox1.Text
- Next
- MsgBox("注意還未存檔喔")
- End Sub
- End Class
|