123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628 |
- Option Strict Off
- Imports Microsoft.Office.Interop.Excel.XlUnderlineStyle
- Imports Microsoft.Office.Interop.Excel.Constants
- Imports Microsoft.Office.Interop.Excel.XlBordersIndex
- Imports Microsoft.Office.Interop.Excel.XlLineStyle
- Imports Microsoft.Office.Interop.Excel.XlBorderWeight
- Imports Microsoft.Office.Interop.Excel.XlThemeFont
- Imports Microsoft.Office.Interop.Excel.XlThemeColor
- Imports Microsoft.Office.Interop.Excel.XlWindowState
- Imports Microsoft.Office.Interop.Excel
- Public Class 工程材料表
- ReadOnly ds1, ds6, ds14 As New DataSet
- Dim 物料規格 As String
- Dim 啟動運算, 放大 As Boolean
- Dim NB1 As Integer
- Dim xlApp As Application : Dim xlBook As Workbook : Dim xlSheet As Worksheet
- Dim 存檔 As Boolean
- Private Sub Set_合約清單()
- 合約_dgv.DataSource = Nothing : ds6.Clear()
- 合約_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
- 合約_dgv.ColumnHeadersHeight = 25 : 合約_dgv.AllowUserToAddRows = False
- PA46 = 合約編號1_cb.Text : PA47 = 工程期1_ch.Text : PA45 = 工程執行主管_cb.Text
- SQL_合約清單_驗收用()
- da.Fill(ds6) : 合約_dgv.DataSource = ds6.Tables(0) : conn.Close()
- 合約_dgv.Columns(0).FillWeight = 160 : 合約_dgv.Columns(1).Visible = False : 合約_dgv.Columns(2).Visible = False : 合約_dgv.Columns(3).Visible = False
- 合約_dgv.Columns(4).Visible = False : 合約_dgv.Columns(5).Visible = False : 合約_dgv.Columns(6).Visible = False : 合約_dgv.Columns(7).Visible = False
- 合約_dgv.Columns(8).Visible = False : 合約_dgv.Columns(9).Visible = False : 合約_dgv.Columns(10).Visible = False : 合約_dgv.Columns(11).Visible = False
- 合約_dgv.Columns(12).Visible = False : 合約_dgv.Columns(13).Visible = False : 合約_dgv.Columns(14).Visible = False : 合約_dgv.Columns(15).Visible = False
- 合約_dgv.Columns(16).Visible = False : 合約_dgv.Columns(17).Visible = False : 合約_dgv.Columns(18).Visible = False : 合約_dgv.Columns(19).Visible = False
- 合約_dgv.Columns(20).Visible = False : 合約_dgv.Columns(21).Visible = False : 合約_dgv.Columns(22).Visible = False : 合約_dgv.Columns(23).Visible = False
- 合約_dgv.Columns(24).Visible = False : 合約_dgv.Columns(25).Visible = False : 合約_dgv.Columns(26).Visible = False : 合約_dgv.Columns(27).Visible = False
- 合約_dgv.Columns(28).Visible = False : 合約_dgv.Columns(29).FillWeight = 50 : 合約_dgv.Columns(31).Visible = False : 合約_dgv.Columns(表頭(5)).FillWeight = 40
- 合約_dgv.Columns("驗收備註").Visible = False : 合約_dgv.Columns("工地驗收備註").Visible = False : 合約_dgv.Columns("驗收完成日期").Visible = False
- 合約_dgv.Columns("保固期限").Visible = False : 合約_dgv.Columns(表頭(2)).FillWeight = 300
- 合約_dgv.Columns(29).DefaultCellStyle.Format = "#,##0" : 合約_dgv.Columns(29).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
- For i As Integer = 0 To 合約_dgv.Rows.Count - 1
- If IsDBNull(合約_dgv(表頭(5), i).Value) = True Then : 合約_dgv(表頭(5), i).Value = False : End If
- Next
- If 放大 = True Then
- 合約_dgv.Columns(表頭(2)).Visible = True
- Else
- 合約_dgv.Columns(表頭(2)).Visible = False
- End If
- End Sub
- Private Sub Set_合約報價明細表()
- 報價明細表_dgv.DataSource = Nothing : ds14.Clear()
- 報價明細表_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
- 報價明細表_dgv.ColumnHeadersHeight = 40 : 報價明細表_dgv.AllowUserToAddRows = False : 報價明細表_dgv.RowTemplate.Height = 25
- 報價明細表_dgv.RowsDefaultCellStyle.WrapMode = DataGridViewTriState.False
-
- SQL_合約驗收明細表()
- da.Fill(ds14) : 報價明細表_dgv.DataSource = ds14.Tables(0) : conn.Close()
- 報價明細表_dgv.Columns(0).FillWeight = 25 : 報價明細表_dgv.Columns(1).FillWeight = 270 : 報價明細表_dgv.Columns(2).FillWeight = 30
- 報價明細表_dgv.Columns(3).FillWeight = 30 : 報價明細表_dgv.Columns(4).Visible = False : 報價明細表_dgv.Columns(5).Visible = False
- 報價明細表_dgv.Columns(6).Visible = False
- 報價明細表_dgv.Columns(表頭(6)).DefaultCellStyle.Format = "#,##0" : 報價明細表_dgv.Columns(表頭(6)).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
- 報價明細表_dgv.Columns(表頭(7)).DefaultCellStyle.Format = "#,##0" : 報價明細表_dgv.Columns(表頭(7)).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
- 報價明細表_dgv.Columns(表頭(8)).DefaultCellStyle.Format = "#,##0" : 報價明細表_dgv.Columns(表頭(8)).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
- 報價明細表_dgv.Columns("UNIT").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
- 報價明細表_dgv.Columns(0).ReadOnly = True : 報價明細表_dgv.Columns(1).ReadOnly = True : 報價明細表_dgv.Columns(2).ReadOnly = True
- 報價明細表_dgv.Columns(3).ReadOnly = True : 報價明細表_dgv.Columns(5).ReadOnly = True
- 報價明細表_dgv.EditMode = DataGridViewEditMode.EditOnEnter
- For I As Integer = 7 To 47 : 報價明細表_dgv.Columns(I).Visible = False : Next
- For i As Integer = 0 To 報價明細表_dgv.Rows.Count - 1
- If IsDBNull(報價明細表_dgv.Rows(i).Cells(表頭(7)).Value) = True Then : 報價明細表_dgv.Rows(i).Cells(表頭(7)).Value = 0 : End If
- If 已驗收_ch.Checked = False Then : 報價明細表_dgv.Rows(i).Cells(表頭(8)).Value = 0
- Else : 報價明細表_dgv.Rows(i).Cells(表頭(8)).Value = 報價明細表_dgv.Rows(i).Cells(表頭(7)).Value - 報價明細表_dgv.Rows(i).Cells(表頭(6)).Value : End If
- If 報價明細表_dgv.Rows(i).Cells("料號").Value.ToString = "" Then
- 報價明細表_dgv.Rows(i).Cells("D1").Value = False : 報價明細表_dgv.Rows(i).Cells("D2").Value = False : 報價明細表_dgv.Rows(i).Cells("D3").Value = False
- 報價明細表_dgv.Rows(i).Cells("D4").Value = False : 報價明細表_dgv.Rows(i).Cells("D5").Value = False : 報價明細表_dgv.Rows(i).Cells("D6").Value = False
- 報價明細表_dgv.Rows(i).Cells("D7").Value = False : 報價明細表_dgv.Rows(i).Cells("D8").Value = False
- End If
- If 報價明細表_dgv.Rows(i).Cells("料號").Value.ToString <> "" Then
- If 報價明細表_dgv.Rows(i).Cells("預設").Value = True Then
- 報價明細表_dgv.Rows(i).Cells("D1").Value = 報價明細表_dgv.Rows(i).Cells("S1").Value : 報價明細表_dgv.Rows(i).Cells("D2").Value = 報價明細表_dgv.Rows(i).Cells("S2").Value
- 報價明細表_dgv.Rows(i).Cells("D3").Value = 報價明細表_dgv.Rows(i).Cells("S3").Value : 報價明細表_dgv.Rows(i).Cells("D4").Value = 報價明細表_dgv.Rows(i).Cells("S4").Value
- 報價明細表_dgv.Rows(i).Cells("D5").Value = 報價明細表_dgv.Rows(i).Cells("S5").Value : 報價明細表_dgv.Rows(i).Cells("D6").Value = 報價明細表_dgv.Rows(i).Cells("S6").Value
- 報價明細表_dgv.Rows(i).Cells("D7").Value = 報價明細表_dgv.Rows(i).Cells("S7").Value : 報價明細表_dgv.Rows(i).Cells("D8").Value = 報價明細表_dgv.Rows(i).Cells("S8").Value
- End If
- Dim ZA1, ZA2, ZA3, ZA4, ZA5, ZA6, ZA7, ZA8 As String : 物料規格 = ""
- If 詳細資料2_ch.Checked = True Then
- If 報價明細表_dgv.Rows(i).Cells("A1").Value.ToString <> "" Then : If 報價明細表_dgv.Rows(i).Cells("D1").Value = True Then
- ZA1 = 報價明細表_dgv.Rows(i).Cells("AA1").Value.ToString & "=" & 報價明細表_dgv.Rows(i).Cells("A1").Value.ToString : 物料規格 = ZA1 : End If : End If
- If 報價明細表_dgv.Rows(i).Cells("A2").Value.ToString <> "" Then : If 報價明細表_dgv.Rows(i).Cells("D2").Value = True Then
- ZA2 = 報價明細表_dgv.Rows(i).Cells("AA2").Value.ToString & "=" & 報價明細表_dgv.Rows(i).Cells("A2").Value : If 物料規格 = "" Then
- 物料規格 = ZA2 : Else : 物料規格 = 物料規格 + "、" + ZA2 : End If : End If : End If
- If 報價明細表_dgv.Rows(i).Cells("A3").Value.ToString <> "" Then : If 報價明細表_dgv.Rows(i).Cells("D3").Value = True Then
- ZA3 = 報價明細表_dgv.Rows(i).Cells("AA3").Value.ToString & "=" & 報價明細表_dgv.Rows(i).Cells("A3").Value : If 物料規格 = "" Then
- 物料規格 = ZA3 : Else : 物料規格 = 物料規格 + "、" + ZA3 : End If : End If : End If
- If 報價明細表_dgv.Rows(i).Cells("A4").Value.ToString <> "" Then : If 報價明細表_dgv.Rows(i).Cells("D4").Value = True Then
- ZA4 = 報價明細表_dgv.Rows(i).Cells("AA4").Value.ToString & "=" & 報價明細表_dgv.Rows(i).Cells("A4").Value : If 物料規格 = "" Then
- 物料規格 = ZA4 : Else : 物料規格 = 物料規格 + "、" + ZA4 : End If : End If : End If
- If 報價明細表_dgv.Rows(i).Cells("A5").Value.ToString <> "" Then : If 報價明細表_dgv.Rows(i).Cells("D5").Value = True Then
- ZA5 = 報價明細表_dgv.Rows(i).Cells("AA5").Value.ToString & "=" & 報價明細表_dgv.Rows(i).Cells("A5").Value : If 物料規格 = "" Then
- 物料規格 = ZA5 : Else : 物料規格 = 物料規格 + "、" + ZA5 : End If : End If : End If
- If 報價明細表_dgv.Rows(i).Cells("A6").Value.ToString <> "" Then : If 報價明細表_dgv.Rows(i).Cells("D6").Value = True Then
- ZA6 = 報價明細表_dgv.Rows(i).Cells("AA6").Value.ToString & "=" & 報價明細表_dgv.Rows(i).Cells("A6").Value : If 物料規格 = "" Then
- 物料規格 = ZA6 : Else : 物料規格 = 物料規格 + "、" + ZA6 : End If : End If : End If
- If 報價明細表_dgv.Rows(i).Cells("A7").Value.ToString <> "" Then : If 報價明細表_dgv.Rows(i).Cells("D7").Value = True Then
- ZA7 = 報價明細表_dgv.Rows(i).Cells("AA7").Value.ToString & "=" & 報價明細表_dgv.Rows(i).Cells("A7").Value : If 物料規格 = "" Then
- 物料規格 = ZA7 : Else : 物料規格 = 物料規格 + "、" + ZA7 : End If : End If : End If
- If 報價明細表_dgv.Rows(i).Cells("A8").Value.ToString <> "" Then : If 報價明細表_dgv.Rows(i).Cells("D8").Value = True Then
- ZA8 = 報價明細表_dgv.Rows(i).Cells("AA8").Value.ToString & "=" & 報價明細表_dgv.Rows(i).Cells("A8").Value : If 物料規格 = "" Then
- 物料規格 = ZA8 : Else : 物料規格 = 物料規格 + "、" + ZA8 : End If : End If : End If
- Else
- If 報價明細表_dgv.Rows(i).Cells("A1").Value.ToString <> "" Then : If 報價明細表_dgv.Rows(i).Cells("D1").Value = True Then
- ZA1 = 報價明細表_dgv.Rows(i).Cells("A1").Value.ToString : 物料規格 = ZA1 : End If : End If
- If 報價明細表_dgv.Rows(i).Cells("A2").Value.ToString <> "" Then : If 報價明細表_dgv.Rows(i).Cells("D2").Value = True Then
- ZA2 = 報價明細表_dgv.Rows(i).Cells("A2").Value : If 物料規格 = "" Then : 物料規格 = ZA2 : Else : 物料規格 = 物料規格 + "、" + ZA2 : End If : End If : End If
- If 報價明細表_dgv.Rows(i).Cells("A3").Value.ToString <> "" Then : If 報價明細表_dgv.Rows(i).Cells("D3").Value = True Then
- ZA3 = 報價明細表_dgv.Rows(i).Cells("A3").Value : If 物料規格 = "" Then : 物料規格 = ZA3 : Else : 物料規格 = 物料規格 + "、" + ZA3 : End If : End If : End If
- If 報價明細表_dgv.Rows(i).Cells("A4").Value.ToString <> "" Then : If 報價明細表_dgv.Rows(i).Cells("D4").Value = True Then
- ZA4 = 報價明細表_dgv.Rows(i).Cells("A4").Value : If 物料規格 = "" Then : 物料規格 = ZA4 : Else : 物料規格 = 物料規格 + "、" + ZA4 : End If : End If : End If
- If 報價明細表_dgv.Rows(i).Cells("A5").Value.ToString <> "" Then : If 報價明細表_dgv.Rows(i).Cells("D5").Value = True Then
- ZA5 = 報價明細表_dgv.Rows(i).Cells("A5").Value : If 物料規格 = "" Then : 物料規格 = ZA5 : Else : 物料規格 = 物料規格 + "、" + ZA5 : End If : End If : End If
- If 報價明細表_dgv.Rows(i).Cells("A6").Value.ToString <> "" Then : If 報價明細表_dgv.Rows(i).Cells("D6").Value = True Then
- ZA6 = 報價明細表_dgv.Rows(i).Cells("A6").Value : If 物料規格 = "" Then : 物料規格 = ZA6 : Else : 物料規格 = 物料規格 + "、" + ZA6 : End If : End If : End If
- If 報價明細表_dgv.Rows(i).Cells("A7").Value.ToString <> "" Then : If 報價明細表_dgv.Rows(i).Cells("D7").Value = True Then
- ZA7 = 報價明細表_dgv.Rows(i).Cells("A7").Value : If 物料規格 = "" Then : 物料規格 = ZA7 : Else : 物料規格 = 物料規格 + "、" + ZA7 : End If : End If : End If
- If 報價明細表_dgv.Rows(i).Cells("A8").Value.ToString <> "" Then : If 報價明細表_dgv.Rows(i).Cells("D8").Value = True Then
- ZA8 = 報價明細表_dgv.Rows(i).Cells("A8").Value : If 物料規格 = "" Then : 物料規格 = ZA8 : Else : 物料規格 = 物料規格 + "、" + ZA8 : End If : End If : End If
- End If
- If 報價明細表_dgv.Rows(i).Cells("料號").Value.ToString <> "" Then
- 報價明細表_dgv.Rows(i).Cells("DESCRIPTION").Value = 報價明細表_dgv.Rows(i).Cells("品名").Value.ToString & " " & 物料規格
- End If
- End If : 報價明細表_dgv.Rows(i).Cells("預設").Value = False
-
- '------------數字為0隱藏-----------------------------------------------------------------------------------------------
- If IsDBNull(報價明細表_dgv.Rows(i).Cells(表頭(6)).Value) Then
- 報價明細表_dgv.Rows(i).Cells(表頭(6)).Style.ForeColor = 報價明細表_dgv.Rows(i).Cells(表頭(6)).Style.BackColor
- Else
- If 報價明細表_dgv.Rows(i).Cells(表頭(6)).Value = 0 Then
- 報價明細表_dgv.Rows(i).Cells(表頭(6)).Style.ForeColor = 報價明細表_dgv.Rows(i).Cells(表頭(6)).Style.BackColor
- Else
- If 深色風格 = False Then
- 報價明細表_dgv.Rows(i).Cells(表頭(6)).Style.ForeColor = Color.Black
- Else
- 報價明細表_dgv.Rows(i).Cells(表頭(6)).Style.ForeColor = Color.White
- End If
- End If
- End If
- If IsDBNull(報價明細表_dgv.Rows(i).Cells(表頭(7)).Value) Then
- 報價明細表_dgv.Rows(i).Cells(表頭(7)).Style.ForeColor = 報價明細表_dgv.Rows(i).Cells(表頭(7)).Style.BackColor
- Else
- If 報價明細表_dgv.Rows(i).Cells(表頭(7)).Value = 0 Then
- 報價明細表_dgv.Rows(i).Cells(表頭(7)).Style.ForeColor = 報價明細表_dgv.Rows(i).Cells(表頭(7)).Style.BackColor
- Else
- If 深色風格 = False Then
- 報價明細表_dgv.Rows(i).Cells(表頭(7)).Style.ForeColor = Color.Black
- Else
- 報價明細表_dgv.Rows(i).Cells(表頭(7)).Style.ForeColor = Color.White
- End If
- End If
- End If
- If IsDBNull(報價明細表_dgv.Rows(i).Cells(表頭(8)).Value) Then
- 報價明細表_dgv.Rows(i).Cells(表頭(8)).Style.ForeColor = 報價明細表_dgv.Rows(i).Cells(表頭(8)).Style.BackColor
- Else
- If 深色風格 = False Then
- If 報價明細表_dgv.Rows(i).Cells(表頭(8)).Value = 0 Then
- 報價明細表_dgv.Rows(i).Cells(表頭(8)).Style.ForeColor = 報價明細表_dgv.Rows(i).Cells(表頭(8)).Style.BackColor
- ElseIf 報價明細表_dgv.Rows(i).Cells(表頭(8)).Value > 0 Then
- 報價明細表_dgv.Rows(i).Cells(表頭(8)).Style.ForeColor = Color.Blue
- ElseIf 報價明細表_dgv.Rows(i).Cells(表頭(8)).Value < 0 Then
- 報價明細表_dgv.Rows(i).Cells(表頭(8)).Style.ForeColor = Color.Red
- End If
- Else
- If 報價明細表_dgv.Rows(i).Cells(表頭(8)).Value = 0 Then
- 報價明細表_dgv.Rows(i).Cells(表頭(8)).Style.ForeColor = 報價明細表_dgv.Rows(i).Cells(表頭(8)).Style.BackColor
- ElseIf 報價明細表_dgv.Rows(i).Cells(表頭(8)).Value > 0 Then
- 報價明細表_dgv.Rows(i).Cells(表頭(8)).Style.ForeColor = Color.LightBlue
- ElseIf 報價明細表_dgv.Rows(i).Cells(表頭(8)).Value < 0 Then
- 報價明細表_dgv.Rows(i).Cells(表頭(8)).Style.ForeColor = Color.LightPink
- End If
- End If
- End If
- Next
- End Sub
- Private Sub 甲方條件下拉清單讀取()
- SQL合約條件讀取() : 合約編號1_cb.Items.Clear() : 合約編號1_cb.Items.Add("") : While (dr.Read()) : 合約編號1_cb.Items.Add(dr("約號甲方")) : End While : conn.Close()
- End Sub
- Private Sub 執行主管下拉清單讀取()
- SQL執行主管下拉() : 工程執行主管_cb.Items.Clear() : 工程執行主管_cb.Items.Add("") : While (dr.Read()) : 工程執行主管_cb.Items.Add(dr("姓名")) : End While : conn.Close()
- End Sub
- Private Sub 語言轉換讀取()
- If 系統語言 = "繁體中文" Then : 語言 = "CH" : ElseIf 系統語言 = "English" Then : 語言 = "EN" : ElseIf 系統語言 = "Indonesian" Then : 語言 = "IN" : End If
- Me.Text = 系統語言字典("H001-105-" & 語言) : Label7.Text = 系統語言字典("H104-106-" & 語言) : Label11.Text = 系統語言字典("H110-118-" & 語言)
- 工程執行主管_lb.Text = 系統語言字典("H101-109-" & 語言) : Label2.Text = 系統語言字典("G000-156-" & 語言) : Label372.Text = 系統語言字典("H112-100-" & 語言)
- Label375.Text = 系統語言字典("G000-215-" & 語言) : Label378.Text = 系統語言字典("G000-216-" & 語言) : Label8.Text = 系統語言字典("H902-117-" & 語言)
- 已驗收_ch.Text = 系統語言字典("H904-111-" & 語言) : Label1.Text = 系統語言字典("G000-157-" & 語言) : Label414.Text = 系統語言字典("H109-100-" & 語言)
- Label5.Text = 系統語言字典("H110-100-" & 語言) : Label4.Text = 系統語言字典("H110-122-" & 語言) : Label3.Text = 系統語言字典("H110-120-" & 語言)
- Label6.Text = 系統語言字典("H110-124-" & 語言) : Label9.Text = 系統語言字典("H110-123-" & 語言) : Label12.Text = 系統語言字典("H110-125-" & 語言)
- 表頭(1) = 系統語言字典("H501-152-" & 語言) : 表頭(2) = 系統語言字典("H112-118-" & 語言) : 表頭(3) = 系統語言字典("H110-122-" & 語言)
- 表頭(4) = 系統語言字典("G000-157-" & 語言) : 表頭(5) = 系統語言字典("H110-129-" & 語言) : 表頭(6) = 系統語言字典("H506-167-" & 語言)
- 表頭(7) = 系統語言字典("H109-105-" & 語言) : 表頭(8) = 系統語言字典("H109-106-" & 語言) : 詳細資料2_ch.Text = 系統語言字典("H211-100-" & 語言)
- End Sub
- Private Sub 工程材料表_Load(sender As Object, e As EventArgs) Handles MyBase.Load
- Me.MdiParent = HX_PGS_ERP_SYS : Me.WindowState = 2 : Me.AutoScroll = True
- 風格() : H(407) = True : 介面 = "H407" : 語言轉換讀取() : 顯示說明(999, False)
-
- 甲方條件下拉清單讀取() : 執行主管下拉清單讀取() : Set_合約清單() : 工程材料表_Siz() : Panel1.SendToBack()
- End Sub
- Private Sub 合約驗收單_Closed(sender As Object, e As EventArgs) Handles MyBase.Closed
- MyMod.虛擬桌面開啟()
- End Sub
- Private Sub 工程材料表_Siz()
- MyMod.清單字體大小調整()
- 合約_dgv.RowsDefaultCellStyle.Font = New System.Drawing.Font("微軟正黑體", HX_PGS_ERP_SYS.字體_NUD.Value)
- 報價明細表_dgv.RowsDefaultCellStyle.Font = New System.Drawing.Font("微軟正黑體", HX_PGS_ERP_SYS.字體_NUD.Value)
- End Sub
- Private Sub 登入閒置控制_MouseMove(sender As Object, e As EventArgs) Handles MyBase.MouseMove
- timeNow = 0 : HX_PGS_ERP_SYS.Timer1.Enabled = False : HX_PGS_ERP_SYS.Timer1.Enabled = True
- End Sub
- Private Sub 登入閒置控制_KeyPress(sender As Object, e As EventArgs) Handles MyBase.KeyPress
- timeNow = 0 : HX_PGS_ERP_SYS.Timer1.Enabled = False : HX_PGS_ERP_SYS.Timer1.Enabled = True
- End Sub
- Private Sub 語轉扭_bt_Click(sender As Object, e As EventArgs) Handles 語轉扭_bt.Click
- 介面 = "H407" : 語言轉換讀取() : Set_合約清單() : Set_合約報價明細表()
- End Sub
- Private Sub 合約_dgv_CellClick(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles 合約_dgv.CellClick
- If e.RowIndex = -1 Then : Else
- If 放大 = True Then : 縮放2_bt.PerformClick() : End If
- 客戶名稱_tb.Text = 合約_dgv("客戶名稱", e.RowIndex).Value.ToString : 合約編號_tb.Text = 合約_dgv(表頭(1), e.RowIndex).Value.ToString
- 工程名稱_中_tb.Text = 合約_dgv(表頭(2), e.RowIndex).Value.ToString : 工程名稱_英_tb.Text = 合約_dgv("工程名稱_英", e.RowIndex).Value.ToString
- 立約日期_dtp.Value = 合約_dgv("立約日期", e.RowIndex).Value.ToString : 合約工期_nud.Value = 合約_dgv("工期", e.RowIndex).Value.ToString
- 已驗收_ch.Checked = 合約_dgv(表頭(5), e.RowIndex).Value : 保固_cb.Text = 合約_dgv("保固期限", e.RowIndex).Value.ToString
- If 系統分區控制 = True Then : 備註_tb.Text = 合約_dgv("驗收備註", e.RowIndex).Value.ToString
- Else : 備註_tb.Text = 合約_dgv("工地驗收備註", e.RowIndex).Value.ToString : End If
-
- If 合約_dgv("驗收開始日期", e.RowIndex).Value.ToString = "" Then : 驗收日期_dtp.Value = Today() : 存檔 = False
- Else : 驗收日期_dtp.Value = 合約_dgv("驗收開始日期", e.RowIndex).Value.ToString : 存檔 = True : End If
- If 合約_dgv("驗收完成日期", e.RowIndex).Value.ToString = "" Then : 驗收完成_dtp.Value = Today() : Else
- 驗收完成_dtp.Value = 合約_dgv("驗收完成日期", e.RowIndex).Value.ToString
- End If
-
- 工程天數_nud.Value = DateDiff("d", 立約日期_dtp.Value, 驗收日期_dtp.Value) : 日期差異_nud.Value = 合約工期_nud.Value - 工程天數_nud.Value
- 啟動運算 = False : PA = 合約編號_tb.Text : Set_合約報價明細表() : 啟動運算 = True
-
- If IsDBNull(合約_dgv(表頭(5), e.RowIndex).Value) = True Then
- 立約日期_dtp.Enabled = True : 驗收日期_dtp.Enabled = True : 驗收完成_dtp.Enabled = True : 合約工期_nud.Enabled = True
- 工程天數_nud.Enabled = True : 日期差異_nud.Enabled = True : 保固_cb.Enabled = True
- Else
- If 合約_dgv(表頭(5), e.RowIndex).Value = True Then
- 立約日期_dtp.Enabled = False : 驗收日期_dtp.Enabled = False : 驗收完成_dtp.Enabled = False : 合約工期_nud.Enabled = False
- 工程天數_nud.Enabled = False : 日期差異_nud.Enabled = False : 保固_cb.Enabled = False
- Else
- 立約日期_dtp.Enabled = True : 驗收日期_dtp.Enabled = True : 驗收完成_dtp.Enabled = True : 合約工期_nud.Enabled = True
- 工程天數_nud.Enabled = True : 日期差異_nud.Enabled = True : 保固_cb.Enabled = True
- End If
- End If
- End If
- End Sub
- Private Sub 報價明細表_dgv_CellContentCl(sender As Object, e As DataGridViewCellEventArgs) Handles 報價明細表_dgv.CellEndEdit
- If 啟動運算 = True Then
- For i As Integer = 0 To 報價明細表_dgv.Rows.Count - 1
- If IsDBNull(報價明細表_dgv.Rows(i).Cells(表頭(7)).Value) Then
- 報價明細表_dgv.Rows(i).Cells(表頭(7)).Style.ForeColor = 報價明細表_dgv.Rows(i).Cells(表頭(7)).Style.BackColor
- Else
- If 報價明細表_dgv.Rows(i).Cells(表頭(7)).Value = 0 Then
- 報價明細表_dgv.Rows(i).Cells(表頭(7)).Style.ForeColor = 報價明細表_dgv.Rows(i).Cells(表頭(7)).Style.BackColor
- Else
- If 深色風格 = False Then
- 報價明細表_dgv.Rows(i).Cells(表頭(7)).Style.ForeColor = Color.Black
- Else
- 報價明細表_dgv.Rows(i).Cells(表頭(7)).Style.ForeColor = Color.White
- End If
- End If
- End If
- If IsDBNull(報價明細表_dgv.Rows(i).Cells(表頭(8)).Value) Then
- 報價明細表_dgv.Rows(i).Cells(表頭(8)).Style.ForeColor = 報價明細表_dgv.Rows(i).Cells(表頭(8)).Style.BackColor
- Else
- If 深色風格 = False Then
- If 報價明細表_dgv.Rows(i).Cells(表頭(8)).Value = 0 Then : 報價明細表_dgv.Rows(i).Cells(表頭(8)).Style.ForeColor = 報價明細表_dgv.Rows(i).Cells(表頭(8)).Style.BackColor
- ElseIf 報價明細表_dgv.Rows(i).Cells(表頭(8)).Value > 0 Then
- 報價明細表_dgv.Rows(i).Cells(表頭(8)).Style.ForeColor = Color.Blue
- ElseIf 報價明細表_dgv.Rows(i).Cells(表頭(8)).Value < 0 Then
- 報價明細表_dgv.Rows(i).Cells(表頭(8)).Style.ForeColor = Color.Red
- End If
- Else
- If 報價明細表_dgv.Rows(i).Cells(表頭(8)).Value = 0 Then
- 報價明細表_dgv.Rows(i).Cells(表頭(8)).Style.ForeColor = 報價明細表_dgv.Rows(i).Cells(表頭(8)).Style.BackColor
- ElseIf 報價明細表_dgv.Rows(i).Cells(表頭(8)).Value > 0 Then
- 報價明細表_dgv.Rows(i).Cells(表頭(8)).Style.ForeColor = Color.LightBlue
- ElseIf 報價明細表_dgv.Rows(i).Cells(表頭(8)).Value < 0 Then
- 報價明細表_dgv.Rows(i).Cells(表頭(8)).Style.ForeColor = Color.LightPink
- End If
- End If
- End If
- 報價明細表_dgv.Rows(i).Cells(表頭(8)).Value = 報價明細表_dgv.Rows(i).Cells(表頭(7)).Value - 報價明細表_dgv.Rows(i).Cells(表頭(6)).Value
- Next
- End If
- End Sub
- Private Sub 合約編號1_cb_SelectedIndexChanged(sender As Object, e As EventArgs) Handles 合約編號1_cb.SelectedIndexChanged
- PA = 關鍵字搜尋_tb.Text : Set_合約清單()
- End Sub
- Private Sub 合約編號1_cb_Click(sender As Object, e As EventArgs) Handles 合約編號1_cb.Click
- CB選擇清單(合約編號1_cb)
- End Sub
- Private Sub 工程期1_ch_SelectedIndexChanged(sender As Object, e As EventArgs) Handles 工程期1_ch.SelectedIndexChanged
- PA = 關鍵字搜尋_tb.Text : Set_合約清單()
- End Sub
- Private Sub 工程執行主管_cb_SelectedIndexChanged(sender As Object, e As EventArgs) Handles 工程執行主管_cb.SelectedIndexChanged
- PA = 關鍵字搜尋_tb.Text : Set_合約清單()
- End Sub
- Private Sub 工程執行主管_cb_Click(sender As Object, e As EventArgs) Handles 工程執行主管_cb.Click
- CB選擇清單(工程執行主管_cb)
- End Sub
- Private Sub 保固_cb_Click(sender As Object, e As EventArgs) Handles 保固_cb.Click
- CB選擇清單(保固_cb)
- End Sub
- Private Sub 查詢_bt_Click(sender As Object, e As EventArgs) Handles 查詢_bt.Click
- PA = 關鍵字搜尋_tb.Text : Set_合約清單()
- End Sub
- Private Sub 立約日期_dtp_ValueChanged(sender As Object, e As EventArgs) Handles 立約日期_dtp.ValueChanged
- 工程天數_nud.Value = DateDiff("d", 立約日期_dtp.Value, 驗收日期_dtp.Value) : 日期差異_nud.Value = 合約工期_nud.Value - 工程天數_nud.Value
- End Sub
- Private Sub 驗收日期_dtp_ValueChanged(sender As Object, e As EventArgs) Handles 驗收日期_dtp.ValueChanged
- 工程天數_nud.Value = DateDiff("d", 立約日期_dtp.Value, 驗收日期_dtp.Value) : 日期差異_nud.Value = 合約工期_nud.Value - 工程天數_nud.Value
- End Sub
- Private Sub 縮放2_bt_Click(sender As Object, e As EventArgs) Handles 縮放2_bt.Click
- Dim NX, NY As Integer : NX = 合約_dgv.Size.Width : NY = 合約_dgv.Size.Height
- If 放大 = True Then
- 合約_dgv.Size = New System.Drawing.Point(NX - 400, NY) : 放大 = False : 合約_dgv.Columns(表頭(2)).Visible = False
- Else
- 合約_dgv.Size = New System.Drawing.Point(NX + 400, NY) : 放大 = True : 合約_dgv.Columns(表頭(2)).Visible = True
- End If
- End Sub
- Private Sub 詳細資料2_ch_CheckedChanged(sender As Object, e As EventArgs) Handles 詳細資料2_ch.Click
- If 詳細資料2_ch.Checked = True Then : 詳細資料2_ch.Checked = True : Else : 詳細資料2_ch.Checked = False : End If : Set_合約報價明細表()
- End Sub
- Private Sub 列印_bt_Click(sender As Object, e As EventArgs) Handles 列印_bt.Click
- If 報價明細表_dgv.Rows.Count < 1 Then : MGB(系統語言字典("H109-104-" & 語言), 1) : Else
- If 合約編號_tb.Text = "" Then : MGB(系統語言字典("H104-112-" & 語言), 1) : Else
- xlApp = CType(CreateObject("Excel.Application"), Application)
- xlApp.Visible = True
- xlApp.DisplayAlerts = True
- xlApp.Application.WindowState = xlMaximized
- xlBook = xlApp.Workbooks.Add
- '----------------------------------------------------------------------------------------------------------------------
- xlSheet = NewMethod(xlBook) : xlApp.Sheets(1).Select : xlApp.Sheets(1).Name = "工程材料單"
- xlBook.Activate() : xlSheet.Activate()
-
- xlSheet.Cells(2, 1) = "工程材料單"
- xlSheet.Cells(3, 1) = "業主名稱 :" & 客戶名稱_tb.Text : xlSheet.Cells(3, 6) = "NO. " & 合約編號_tb.Text
- xlSheet.Cells(4, 1) = "工程項目 : " & 工程名稱_中_tb.Text & " " & 工程名稱_英_tb.Text : xlSheet.Cells(4, 6) = Strings.Format(驗收日期_dtp.Value, "yyyy/MM/dd")
-
- xlSheet.Cells(5, 1) = "ITEM" : xlSheet.Cells(5, 2) = "DESCRIPTION" : xlSheet.Cells(5, 3) = "UNIT" : xlSheet.Cells(5, 4) = "Q'TY" : xlSheet.Cells(5, 7) = "UNIT"
- xlSheet.Cells(6, 4) = "合約" & vbCrLf & "Contract" : xlSheet.Cells(6, 5) = "已備料" & vbCrLf & "Siap" : xlSheet.Cells(6, 6) = "需採購" & vbCrLf & "Perlu Membeli"
- For i As Integer = 0 To 報價明細表_dgv.Rows.Count - 1
- xlSheet.Cells(7 + i, 1) = 報價明細表_dgv("ITEM", i).Value.ToString : xlSheet.Cells(7 + i, 2) = 報價明細表_dgv("DESCRIPTION", i).Value.ToString
- xlSheet.Cells(7 + i, 3) = 報價明細表_dgv("UNIT", i).Value.ToString : xlSheet.Cells(7 + i, 7) = 報價明細表_dgv("REMARKS", i).Value.ToString
- If CInt(報價明細表_dgv(表頭(7), i).Value.ToString) = 0 Then : Else : xlSheet.Cells(7 + i, 5) = 報價明細表_dgv(表頭(7), i).Value.ToString : End If
- If CInt(報價明細表_dgv(表頭(8), i).Value.ToString) = 0 Then : Else : xlSheet.Cells(7 + i, 6) = 報價明細表_dgv(表頭(8), i).Value.ToString : End If
- If CInt(報價明細表_dgv(表頭(6), i).Value.ToString) = 0 Then : Else : xlSheet.Cells(7 + i, 4) = 報價明細表_dgv(表頭(6), i).Value.ToString : End If
- NB1 = i
- Next
- xlSheet.Cells(7 + NB1 + 2, 2) = " 甲方代表簽字" : xlSheet.Cells(7 + NB1 + 2, 5) = "承包商簽字"
- xlSheet.Cells(7 + NB1 + 3, 2) = "Representatives of Party A :" : xlSheet.Cells(7 + NB1 + 3, 5) = "Contracting company signing:"
- AA(xlApp, xlSheet)
- If Strings.Left(合約編號_tb.Text, 2) = "HX" Then : CC(xlApp, xlSheet) : Else : DD(xlApp, xlSheet) : End If : FF(xlApp, xlSheet)
-
- xlApp.Sheets(2).Delete : xlSheet.PageSetup.PrintArea = ""
- '-------------轉換成PDF---------------------------------------------------------------------
- Dim SERT As String = Environment.GetFolderPath(Environment.SpecialFolder.Desktop)
- xlBook.Sheets(1).ExportAsFixedFormat(XlFixedFormatType.xlTypePDF, SERT & "\" & 合約編號_tb.Text & "工程材料單.pdf", XlFixedFormatQuality.xlQualityStandard, True)
- '-------------關閉EXCEL---------------------------------------------------------------------
- xlApp.Cells.Select() : xlApp.Application.WindowState = xlMinimized
- xlBook.Close(False)
- Runtime.InteropServices.Marshal.ReleaseComObject(xlSheet)
- Runtime.InteropServices.Marshal.ReleaseComObject(xlBook)
- Runtime.InteropServices.Marshal.ReleaseComObject(xlApp)
- xlApp.Quit() : xlSheet = Nothing : xlBook = Nothing : xlApp = Nothing : GC.Collect()
- '-------------開啟PDF---------------------------------------------------------------------
- Dim pdfFilePath As String = SERT & "\" & 合約編號_tb.Text & "工程材料單.pdf"
- If IsChromeInstalled() Then
- Try
- Dim chromeProcess As New Process()
- chromeProcess.StartInfo.FileName = "chrome"
- chromeProcess.StartInfo.Arguments = """" & pdfFilePath & """"
- chromeProcess.Start()
- Catch ex As Exception
- End Try
- Else
- Try
- System.Diagnostics.Process.Start("""" & pdfFilePath & """")
- Catch ex As Exception
- End Try
- End If
- MGB(系統語言字典("H508-121-" & 語言), 1) : Set_合約清單()
- End If
- End If
- End Sub
- ' 檢查系統是否已安裝 Google Chrome
- Private Function IsChromeInstalled() As Boolean
- Dim key As Microsoft.Win32.RegistryKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall")
- If key IsNot Nothing Then
- For Each subkeyName As String In key.GetSubKeyNames()
- Dim subkey As Microsoft.Win32.RegistryKey = key.OpenSubKey(subkeyName)
- Dim displayName As Object = subkey.GetValue("DisplayName")
-
- If displayName IsNot Nothing AndAlso displayName.ToString().Contains("Google Chrome") Then
- Return True
- End If
- Next
- End If
- Return False
- End Function
- Private Shared Function NewMethod(xlBook As Workbook) As Worksheet
- Return CType(xlBook.Worksheets.Add, Worksheet)
- End Function
- Private Sub AA(ByVal myExcel As Application, ByVal xlSheet As Worksheet)
- xlSheet.Cells.Select()
- With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 10 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False
- .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
- xlSheet.Rows("1:1").Select : myExcel.Selection.RowHeight = 95
- xlSheet.Rows("2:2").Select
- With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 18 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False
- .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
- xlSheet.Rows("3:4").Select
- With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 12 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False
- .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
- xlSheet.Columns("A:A").Select : myExcel.Selection.ColumnWidth = 6 : xlSheet.Columns("D:F").Select : myExcel.Selection.ColumnWidth = 10
- xlSheet.Columns("G:G").Select : myExcel.Selection.ColumnWidth = 20 : xlSheet.Columns("C:C").Select : myExcel.Selection.ColumnWidth = 6
- xlSheet.Columns("B:B").Select : myExcel.Selection.ColumnWidth = 75
- xlSheet.Range("A2:G2").Select()
- With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
- .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
- xlSheet.Range("A3:E3").Select()
- With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
- .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
- With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
- .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
- xlSheet.Range("A4:E4").Select()
- With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
- .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
- With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
- .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
- xlSheet.Range("F3:G3").Select()
- With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
- .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
- With myExcel.Selection : .HorizontalAlignment = xlRight : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
- .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
- xlSheet.Range("F4:G4").Select()
- With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
- .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
- With myExcel.Selection : .HorizontalAlignment = xlRight : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
- .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
- xlSheet.Range("A5:A6").Select()
- With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
- .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
- xlSheet.Range("B5:B6").Select()
- With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
- .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
- xlSheet.Range("C5:C6").Select()
- With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
- .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
- xlSheet.Range("D5:F5").Select()
- With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
- .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
- xlSheet.Range("G5:G6").Select()
- With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
- .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
- xlSheet.Range("D6:F6").Select()
- With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
- .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
- xlSheet.Range("B7:B" & 7 + NB1 + 1).Select()
- With myExcel.Selection : .HorizontalAlignment = xlGeneral : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
- .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
-
- xlSheet.Rows("7:" & 7 + NB1 + 1).Select : myExcel.Selection.RowHeight = 25
- xlSheet.Range("A5:G" & 7 + NB1 + 1).Select()
- myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
- With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
- With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
- With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
- With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
- With myExcel.Selection.Borders(xlInsideVertical) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
- With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
- myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
- With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
- With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
- With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
- With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
- With myExcel.Selection.Borders(xlInsideVertical) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
- With myExcel.Selection.Borders(xlInsideHorizontal) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
- myExcel.ActiveWindow.DisplayGridlines = False
-
- xlSheet.Range("E" & 7 + NB1 + 2 & ":G" & 7 + NB1 + 2).Select()
- With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
- .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
- xlSheet.Range("E" & 7 + NB1 + 3 & ":G" & 7 + NB1 + 3).Select()
- With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
- .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
- xlSheet.Rows(7 + NB1 + 4 & ":" & 7 + NB1 + 4).Select : myExcel.Selection.RowHeight = 70
- xlSheet.Range("A" & 7 + NB1 + 2 & ":G" & 7 + NB1 + 4).Select()
- myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
- With myExcel.Selection.Borders(xlEdgeLeft) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
- With myExcel.Selection.Borders(xlEdgeTop) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
- With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
- With myExcel.Selection.Borders(xlEdgeRight) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlMedium : End With
- myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
- xlSheet.Range("A7:A" & 7 + NB1 + 1).Select()
- With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
- .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
- xlSheet.Range("C7:D" & 7 + NB1 + 1).Select()
- With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
- .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
- xlSheet.Range("G7:G" & 7 + NB1 + 1).Select()
- With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = False : .Orientation = 0 : .AddIndent = False
- .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With
-
- xlSheet.Range("A3:E4").Select()
- With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
- .ShrinkToFit = False : .ReadingOrder = xlContext : End With
-
- xlSheet.Range("B7:B" & 7 + NB1 + 1).Select()
- With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
- .ShrinkToFit = False : .ReadingOrder = xlContext : End With
-
- Dim 攔寬 As Single
- xlSheet.Rows("3:3").Select : xlSheet.Rows("3:3").EntireRow.AutoFit
- 攔寬 = xlSheet.Rows("3:3").RowHeight
- xlSheet.Rows("3:3").Select : myExcel.Selection.RowHeight = 攔寬 + 20
- xlSheet.Rows("4:4").Select : xlSheet.Rows("4:4").EntireRow.AutoFit
- 攔寬 = xlSheet.Rows("4:4").RowHeight
- xlSheet.Rows("4:4").Select : myExcel.Selection.RowHeight = 攔寬 + 20
-
- xlSheet.Rows("7:" & 7 + NB1 + 1).Select : xlSheet.Rows("7:" & 7 + NB1 + 1).EntireRow.AutoFit
- For i As Integer = 7 To 7 + NB1 + 1
- xlSheet.Rows(i & ":" & i).Select
- 攔寬 = xlSheet.Rows(i & ":" & i).RowHeight
- xlSheet.Rows(i & ":" & i).Select : myExcel.Selection.RowHeight = 攔寬 + 20
- Next
- End Sub
- Private Sub CC(ByVal myExcel As Application, ByVal xlSheet As Worksheet)
- Clipboard.SetDataObject(PictureBox1.Image)
- xlSheet.Range("A1").Select()
- myExcel.ActiveSheet.Pictures.Paste.Select
- myExcel.Selection.ShapeRange.Height = 93
- myExcel.Selection.ShapeRange.IncrementLeft(50)
- myExcel.Selection.ShapeRange.IncrementTop(0)
- End Sub
- Private Sub DD(ByVal myExcel As Application, ByVal xlSheet As Worksheet)
- Clipboard.SetDataObject(PictureBox2.Image)
- xlSheet.Range("A1").Select()
- myExcel.ActiveSheet.Pictures.Paste.Select
- myExcel.Selection.ShapeRange.Height = 93
- myExcel.Selection.ShapeRange.IncrementLeft(50)
- myExcel.Selection.ShapeRange.IncrementTop(0)
- End Sub
- Private Sub FF(ByVal myExcel As Application, ByVal xlSheet As Worksheet)
- If Strings.Left(合約編號_tb.Text, 2) = "HX" Then
- myExcel.ActiveSheet.PageSetup.CenterHeaderPicture.Filename =
- Str01 & "\HXBWLOG.png"
- Else
- myExcel.ActiveSheet.PageSetup.CenterHeaderPicture.Filename =
- Str01 & "\PGSBWLOG.png"
- End If
- myExcel.Application.PrintCommunication = False : With myExcel.ActiveSheet.PageSetup : .PrintTitleRows = "$1:$6" : .PrintTitleColumns = "" : End With
- myExcel.Application.PrintCommunication = True : myExcel.ActiveSheet.PageSetup.PrintArea = "" : myExcel.Application.PrintCommunication = False
- With myExcel.ActiveSheet.PageSetup : .LeftHeader = ""
- .CenterHeader = "" & Chr(10) & "" & Chr(10) & "" & Chr(10) & "" & Chr(10) & "" & Chr(10) & "" & Chr(10) & "" & Chr(10) & "" & Chr(10) & "&G"
- .RightHeader = "" : .LeftFooter = "" : .CenterFooter = "第 &P 頁,共 &N 頁" : .RightFooter = ""
- .LeftMargin = myExcel.Application.InchesToPoints(0.236220472440945) : .RightMargin = myExcel.Application.InchesToPoints(0.236220472440945)
- .TopMargin = myExcel.Application.InchesToPoints(0.748031496062992) : .BottomMargin = myExcel.Application.InchesToPoints(0.748031496062992)
- .HeaderMargin = myExcel.Application.InchesToPoints(0.31496062992126) : .FooterMargin = myExcel.Application.InchesToPoints(0.31496062992126)
- .PrintHeadings = False : .PrintGridlines = False : .CenterHorizontally = True : .CenterVertically = False : .Draft = False
- .FirstPageNumber = xlAutomatic : .BlackAndWhite = False : .Zoom = False : .FitToPagesWide = 1 : .FitToPagesTall = False : .OddAndEvenPagesHeaderFooter = False
- .DifferentFirstPageHeaderFooter = False : .ScaleWithDocHeaderFooter = True : .AlignMarginsHeaderFooter = True
- .EvenPage.LeftHeader.Text = "" : .EvenPage.CenterHeader.Text = "" : .EvenPage.RightHeader.Text = "" : .EvenPage.LeftFooter.Text = ""
- .EvenPage.CenterFooter.Text = "" : .EvenPage.RightFooter.Text = "" : .FirstPage.LeftHeader.Text = "" : .FirstPage.CenterHeader.Text = ""
- .FirstPage.RightHeader.Text = "" : .FirstPage.LeftFooter.Text = "" : .FirstPage.CenterFooter.Text = "" : .FirstPage.RightFooter.Text = ""
- End With : myExcel.Application.PrintCommunication = True
- End Sub
- Private Sub 風格()
- If 深色風格 = False Then
- Me.BackColor = SystemColors.Control
-
- 工程執行主管_lb.ForeColor = Color.FromArgb(192, 0, 0) : Label372.ForeColor = Color.FromArgb(192, 0, 0) : Label375.ForeColor = Color.FromArgb(192, 0, 0)
- Label378.ForeColor = Color.FromArgb(192, 0, 0)
- Label1.ForeColor = Color.Green : Label414.ForeColor = Color.Green : Label3.ForeColor = Color.Green : Label4.ForeColor = Color.Green
- Label6.ForeColor = Color.Green : 已驗收_ch.ForeColor = Color.Green
- Label5.ForeColor = Color.Blue : Label8.ForeColor = Color.Blue : Label9.ForeColor = Color.Blue : Label12.ForeColor = Color.Blue
- Label2.ForeColor = Color.Black : Label7.ForeColor = Color.Black : Label11.ForeColor = Color.Black : 詳細資料2_ch.ForeColor = Color.Black
-
- 合約編號1_cb.BackColor = Color.White : 合約編號1_cb.ForeColor = Color.Blue : 工程執行主管_cb.BackColor = Color.White : 工程執行主管_cb.ForeColor = Color.Blue
- 保固_cb.BackColor = Color.White : 保固_cb.ForeColor = Color.Blue
- 關鍵字搜尋_tb.BackColor = Color.White : 關鍵字搜尋_tb.ForeColor = Color.Black : 合約編號_tb.BackColor = Color.White : 合約編號_tb.ForeColor = Color.Black
- 客戶名稱_tb.BackColor = Color.White : 客戶名稱_tb.ForeColor = Color.Black : 工程名稱_中_tb.BackColor = Color.White : 工程名稱_中_tb.ForeColor = Color.Black
- 工程名稱_英_tb.BackColor = Color.White : 工程名稱_英_tb.ForeColor = Color.Black : 備註_tb.BackColor = Color.White : 備註_tb.ForeColor = Color.Black
-
- 語轉扭_bt.BackColor = Color.White : 語轉扭_bt.ForeColor = Color.Black : 查詢_bt.BackColor = Color.White : 查詢_bt.ForeColor = Color.Black
- 縮放2_bt.BackColor = Color.White : 縮放2_bt.ForeColor = Color.Black : 列印_bt.BackColor = Color.White : 列印_bt.ForeColor = Color.Black
-
- 合約_dgv.EnableHeadersVisualStyles = True : 合約_dgv.BackgroundColor = Color.White : 合約_dgv.ColumnHeadersDefaultCellStyle.ForeColor = Color.Black
- 合約_dgv.AlternatingRowsDefaultCellStyle.BackColor = Color.LightPink
- 合約_dgv.DefaultCellStyle.BackColor = Color.White : 合約_dgv.DefaultCellStyle.ForeColor = Color.Black
- 報價明細表_dgv.EnableHeadersVisualStyles = True : 報價明細表_dgv.BackgroundColor = Color.White : 報價明細表_dgv.ColumnHeadersDefaultCellStyle.ForeColor = Color.Black
- 報價明細表_dgv.AlternatingRowsDefaultCellStyle.BackColor = Color.LightPink
- 報價明細表_dgv.DefaultCellStyle.BackColor = Color.White : 報價明細表_dgv.DefaultCellStyle.ForeColor = Color.Black
- Else
- Me.BackColor = Color.Black
-
- 工程執行主管_lb.ForeColor = Color.LightPink : Label372.ForeColor = Color.LightPink : Label375.ForeColor = Color.LightPink
- Label378.ForeColor = Color.LightPink
- Label1.ForeColor = Color.LightGreen : Label414.ForeColor = Color.LightGreen : Label3.ForeColor = Color.LightGreen : Label4.ForeColor = Color.LightGreen
- Label6.ForeColor = Color.LightGreen : 已驗收_ch.ForeColor = Color.LightGreen
- Label5.ForeColor = Color.LightBlue : Label8.ForeColor = Color.LightBlue : Label9.ForeColor = Color.LightBlue : Label12.ForeColor = Color.LightBlue
- Label2.ForeColor = Color.White : Label7.ForeColor = Color.White : Label11.ForeColor = Color.White : 詳細資料2_ch.ForeColor = Color.White
- Label2.BackColor = Color.Black : Label11.BackColor = Color.Black
-
- 合約編號1_cb.BackColor = Color.DimGray : 合約編號1_cb.ForeColor = Color.LightBlue : 工程執行主管_cb.BackColor = Color.DimGray : 工程執行主管_cb.ForeColor = Color.LightBlue
- 保固_cb.BackColor = Color.DimGray : 保固_cb.ForeColor = Color.LightBlue
- 關鍵字搜尋_tb.BackColor = Color.DimGray : 關鍵字搜尋_tb.ForeColor = Color.White : 合約編號_tb.BackColor = Color.DimGray : 合約編號_tb.ForeColor = Color.White
- 客戶名稱_tb.BackColor = Color.DimGray : 客戶名稱_tb.ForeColor = Color.White : 工程名稱_中_tb.BackColor = Color.DimGray : 工程名稱_中_tb.ForeColor = Color.White
- 工程名稱_英_tb.BackColor = Color.DimGray : 工程名稱_英_tb.ForeColor = Color.White : 備註_tb.BackColor = Color.DimGray : 備註_tb.ForeColor = Color.White
-
- 語轉扭_bt.BackColor = Color.DimGray : 語轉扭_bt.ForeColor = Color.White : 查詢_bt.BackColor = Color.DimGray : 查詢_bt.ForeColor = Color.White
- 縮放2_bt.BackColor = Color.DimGray : 縮放2_bt.ForeColor = Color.White : 列印_bt.BackColor = Color.DimGray : 列印_bt.ForeColor = Color.White
-
- 合約_dgv.EnableHeadersVisualStyles = False : 合約_dgv.BackgroundColor = Color.DimGray : 合約_dgv.ColumnHeadersDefaultCellStyle.ForeColor = Color.White
- 合約_dgv.ColumnHeadersDefaultCellStyle.BackColor = Color.Black : 合約_dgv.AlternatingRowsDefaultCellStyle.BackColor = Color.DimGray
- 合約_dgv.DefaultCellStyle.BackColor = Color.Black : 合約_dgv.DefaultCellStyle.ForeColor = Color.White
- 報價明細表_dgv.EnableHeadersVisualStyles = False : 報價明細表_dgv.BackgroundColor = Color.DimGray : 報價明細表_dgv.ColumnHeadersDefaultCellStyle.ForeColor = Color.White
- 報價明細表_dgv.ColumnHeadersDefaultCellStyle.BackColor = Color.Black : 報價明細表_dgv.AlternatingRowsDefaultCellStyle.BackColor = Color.DimGray
- 報價明細表_dgv.DefaultCellStyle.BackColor = Color.Black : 報價明細表_dgv.DefaultCellStyle.ForeColor = Color.White
- End If
- End Sub
- End Class
|