123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501 |
- 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("驗收結果").FillWeight = 40
- 合約_dgv.Columns("驗收備註").Visible = False : 合約_dgv.Columns("工地驗收備註").Visible = False : 合約_dgv.Columns("驗收完成日期").Visible = False
- 合約_dgv.Columns("保固期限").Visible = False : 合約_dgv.Columns("工程名稱_中").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("驗收結果", i).Value) = True Then : 合約_dgv("驗收結果", i).Value = False : End If
- Next
- If 放大 = True Then
- 合約_dgv.Columns("工程名稱_中").Visible = True
- Else
- 合約_dgv.Columns("工程名稱_中").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).FillWeight = 30 : 報價明細表_dgv.Columns(5).FillWeight = 30
- 報價明細表_dgv.Columns(6).FillWeight = 80
- 報價明細表_dgv.Columns("合約").DefaultCellStyle.Format = "#,##0" : 報價明細表_dgv.Columns("合約").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight
- 報價明細表_dgv.Columns("實際").DefaultCellStyle.Format = "#,##0" : 報價明細表_dgv.Columns("實際").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight
- 報價明細表_dgv.Columns("差異").DefaultCellStyle.Format = "#,##0" : 報價明細表_dgv.Columns("差異").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight
- 報價明細表_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("實際").Value) = True Then : 報價明細表_dgv.Rows(i).Cells("實際").Value = 0 : End If
- If 已驗收_ch.Checked = False Then : 報價明細表_dgv.Rows(i).Cells("差異").Value = 0
- Else : 報價明細表_dgv.Rows(i).Cells("差異").Value = 報價明細表_dgv.Rows(i).Cells("實際").Value - 報價明細表_dgv.Rows(i).Cells("合約").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("合約").Value) Then : 報價明細表_dgv.Rows(i).Cells("合約").Style.ForeColor = Color.White : Else
- If 報價明細表_dgv.Rows(i).Cells("合約").Value = 0 Then : 報價明細表_dgv.Rows(i).Cells("合約").Style.ForeColor = Color.White
- Else : 報價明細表_dgv.Rows(i).Cells("合約").Style.ForeColor = Color.Black : End If : End If
- If IsDBNull(報價明細表_dgv.Rows(i).Cells("實際").Value) Then : 報價明細表_dgv.Rows(i).Cells("實際").Style.ForeColor = Color.White : Else
- If 報價明細表_dgv.Rows(i).Cells("實際").Value = 0 Then : 報價明細表_dgv.Rows(i).Cells("實際").Style.ForeColor = Color.White
- Else : 報價明細表_dgv.Rows(i).Cells("實際").Style.ForeColor = Color.Black : End If : End If
- If IsDBNull(報價明細表_dgv.Rows(i).Cells("差異").Value) Then : 報價明細表_dgv.Rows(i).Cells("差異").Style.ForeColor = Color.White : Else
- If 報價明細表_dgv.Rows(i).Cells("差異").Value = 0 Then : 報價明細表_dgv.Rows(i).Cells("差異").Style.ForeColor = Color.White
- ElseIf 報價明細表_dgv.Rows(i).Cells("差異").Value > 0 Then : 報價明細表_dgv.Rows(i).Cells("差異").Style.ForeColor = Color.Blue
- ElseIf 報價明細表_dgv.Rows(i).Cells("差異").Value < 0 Then : 報價明細表_dgv.Rows(i).Cells("差異").Style.ForeColor = Color.Red : 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 合約驗收單_Load(sender As Object, e As EventArgs) Handles MyBase.Load
- Me.MdiParent = GCM_ERP_SYS : Me.WindowState = 2 : Me.AutoScroll = True
- 甲方條件下拉清單讀取() : 執行主管下拉清單讀取() : Set_合約清單() : 合約驗收單_Siz()
- If 系統分區控制 = True Then : 驗收完成_bt.BackgroundImage = My.Resources.list_accept : 修改存檔_bt.Visible = True : 解鎖_bt.Visible = True
- ElseIf 系統分區控制 = False Then : 驗收完成_bt.BackgroundImage = My.Resources.SAVER : 修改存檔_bt.Visible = False : 解鎖_bt.Visible = False : End If
- If 系統分區控制 = True And CInt(登入人級別) <= 5 Then : 解鎖_bt.Enabled = True : Else : 解鎖_bt.Enabled = False : End If
- End Sub
- Private Sub 合約驗收單_Closed(sender As Object, e As EventArgs) Handles MyBase.Closed
-
- End Sub
- Private Sub 合約驗收單_Siz()
- MyModule1.清單字體大小調整()
- 合約_dgv.RowsDefaultCellStyle.Font = New System.Drawing.Font("微軟正黑體", GCM_ERP_SYS.字體_NUD.Value)
- 報價明細表_dgv.RowsDefaultCellStyle.Font = New System.Drawing.Font("微軟正黑體", GCM_ERP_SYS.字體_NUD.Value)
- End Sub
- Private Sub 登入閒置控制_MouseMove(sender As Object, e As EventArgs) Handles MyBase.MouseMove
- timeNow = 0 : GCM_ERP_SYS.Timer1.Enabled = False : GCM_ERP_SYS.Timer1.Enabled = True
- End Sub
- Private Sub 登入閒置控制_KeyPress(sender As Object, e As EventArgs) Handles MyBase.KeyPress
- timeNow = 0 : GCM_ERP_SYS.Timer1.Enabled = False : GCM_ERP_SYS.Timer1.Enabled = True
- 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("合約編號", e.RowIndex).Value.ToString
- 工程名稱_中_tb.Text = 合約_dgv("工程名稱_中", 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("驗收結果", 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("驗收結果", 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("驗收結果", 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("實際").Value) Then : 報價明細表_dgv.Rows(i).Cells("實際").Style.ForeColor = Color.White : Else
- If 報價明細表_dgv.Rows(i).Cells("實際").Value = 0 Then : 報價明細表_dgv.Rows(i).Cells("實際").Style.ForeColor = Color.White
- Else : 報價明細表_dgv.Rows(i).Cells("實際").Style.ForeColor = Color.Black : End If : End If
- If IsDBNull(報價明細表_dgv.Rows(i).Cells("差異").Value) Then : 報價明細表_dgv.Rows(i).Cells("差異").Style.ForeColor = Color.White : Else
- If 報價明細表_dgv.Rows(i).Cells("差異").Value = 0 Then : 報價明細表_dgv.Rows(i).Cells("差異").Style.ForeColor = Color.White
- ElseIf 報價明細表_dgv.Rows(i).Cells("差異").Value > 0 Then : 報價明細表_dgv.Rows(i).Cells("差異").Style.ForeColor = Color.Blue
- ElseIf 報價明細表_dgv.Rows(i).Cells("差異").Value < 0 Then : 報價明細表_dgv.Rows(i).Cells("差異").Style.ForeColor = Color.Red : End If : End If
- 報價明細表_dgv.Rows(i).Cells("差異").Value = 報價明細表_dgv.Rows(i).Cells("實際").Value - 報價明細表_dgv.Rows(i).Cells("合約").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_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 查詢_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 合約工期_nud_ValueChanged(sender As Object, e As EventArgs) Handles 合約工期_nud.ValueChanged
- 日期差異_nud.Value = 合約工期_nud.Value - 工程天數_nud.Value
- End Sub
- Private Sub 修改存檔_bt_Click(sender As Object, e As EventArgs) Handles 修改存檔_bt.Click
- If 報價明細表_dgv.Rows.Count < 1 Then
- If 系統語言 = "繁體中文" Then : MsgBox("系統中沒有報價單明細,無法存檔!!") : Else : MsgBox("There are no quotation details in the system and cannot be archived!!") : End If : Else
- PA = 合約編號_tb.Text : SQL_控制表_驗收確認()
- If dr.Read() Then
- Dim SS, SS1 As String
- If 系統語言 = "繁體中文" Then : SS = "驗收日期為 " : SS1 = " 是否正確??" : Else : SS = "Acceptance date is " : SS1 = " is it right or not??" : End If
- Dim aa As MsgBoxResult = MsgBox(SS & Strings.Format(驗收日期_dtp.Value, "yyyy/MM/dd") & SS1, MsgBoxStyle.OkCancel)
- If aa = MsgBoxResult.Ok Then : PA1 = Strings.Format(驗收日期_dtp.Value, "yyyy/MM/dd") : PA5 = 合約工期_nud.Value : SQL_控制表_驗收修改1()
- For i As Integer = 0 To 報價明細表_dgv.Rows.Count - 1
- PA9 = 報價明細表_dgv.Rows(i).Cells("流水號").Value.ToString : PA1 = 報價明細表_dgv.Rows(i).Cells("實際").Value.ToString
- PA2 = 報價明細表_dgv.Rows(i).Cells("REMARKS").Value.ToString
- SQL_合約報價明細表_驗收存檔()
- Next
- If 系統語言 = "繁體中文" Then : MsgBox("修改完成!!") : Else : MsgBox("Modification complete!!") : End If : PA = "" : Set_合約清單() : 存檔 = True
- End If
- End If
- End If
- End Sub
- Private Sub 驗收完成_bt_Click(sender As Object, e As EventArgs) Handles 驗收完成_bt.Click
- If 合約編號_tb.Text = "" Then
- If 系統語言 = "繁體中文" Then : MsgBox("請先選擇要完成驗收的合約!!") : Else : MsgBox("Please select the contract to complete the acceptance first!!") : End If : Else
- 系統分區控制 = True
- If 系統分區控制 = True Then
- If 存檔 = False Then
- If 系統語言 = "繁體中文" Then : MsgBox("該合約沒有開始驗收,所以無法完成驗收!!")
- Else : MsgBox("The contract has not started acceptance, so the acceptance cannot be completed!!") : End If : Else
- If 保固_cb.Text = "" Then
- If 系統語言 = "繁體中文" Then : MsgBox("沒有保固期限,無法存檔!!") : Else : MsgBox("No warranty period, no archive!!") : End If : Else
- If 驗收日期_dtp.Value > 驗收完成_dtp.Value Then
- If 系統語言 = "繁體中文" Then : MsgBox("驗收完成日不可能小於驗收開始日期!!")
- Else : MsgBox("The acceptance completion date cannot be less than the acceptance start date!!") : End If : Else
- Dim SS, SS1 As String
- If 系統語言 = "繁體中文" Then : SS = "驗收完成日期為 " : SS1 = " 是否正確??"
- Else : SS = "Acceptance completion date is " : SS1 = " is it right or not??" : End If
- Dim aa As MsgBoxResult = MsgBox(SS & Strings.Format(驗收完成_dtp.Value, "yyyy/MM/dd") & SS1, MsgBoxStyle.OkCancel)
- If aa = MsgBoxResult.Ok Then
- 修改存檔_bt.PerformClick()
- PA = 合約編號_tb.Text : PA1 = Strings.Format(驗收完成_dtp.Value, "yyyy/MM/dd") : PA2 = "1" : PA3 = 備註_tb.Text : PA4 = 保固_cb.Text
- PA5 = 合約工期_nud.Value
- SQL_控制表_驗收修改2() : PA = "" : 存檔 = False
- If 系統語言 = "繁體中文" Then : MsgBox("驗收回報完成!!") : Else : MsgBox("Acceptance return completed!!") : End If
- If 立約日期_dtp.Enabled = True Then : 解鎖_bt.PerformClick() : End If
- End If
- End If
- End If
- End If
- Else
- PA = 合約編號_tb.Text : PA3 = 備註_tb.Text : SQL_控制表_驗收修改3() : PA = ""
- If 系統語言 = "繁體中文" Then : MsgBox("備註存檔完成!!") : Else : MsgBox("Remarks Archive Complete!!") : End If
- End If
- End If : Set_合約清單()
- 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("工程名稱_中").Visible = False
- Else
- 合約_dgv.Size = New System.Drawing.Point(NX + 400, NY) : 放大 = True : 合約_dgv.Columns("工程名稱_中").Visible = True
- End If
- End Sub
- Private Sub 解鎖_bt_Click(sender As Object, e As EventArgs) Handles 解鎖_bt.Click
- If 合約編號_tb.Text = "" Then
- If 系統語言 = "繁體中文" Then : MsgBox("沒有資料!!") : Else : MsgBox("no information!!") : End If : Else
- If 立約日期_dtp.Enabled = 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 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
- If 系統語言 = "繁體中文" Then : MsgBox("系統中沒有報價單明細,無法列印驗收單!!")
- Else : MsgBox("There is no quotation details in the system, and the acceptance list cannot be printed!!") : End If : Else
- Dim 列印 As Boolean : PA = 合約編號_tb.Text : SQL_控制表_驗收確認()
- If dr.Read() Then
- If dr("驗收開始日期").ToString = "" Then
- Dim SS, SS1 As String
- If 系統語言 = "繁體中文" Then : SS = "驗收日期為 " : SS1 = " 是否正確??" : Else : SS = "Acceptance completion date is " : SS1 = " is it right or not??" : End If
- Dim aa As MsgBoxResult = MsgBox(SS & Strings.Format(驗收日期_dtp.Value, "yyyy/MM/dd") & SS1, MsgBoxStyle.OkCancel)
- If aa = MsgBoxResult.Ok Then : PA1 = Strings.Format(驗收日期_dtp.Value, "yyyy/MM/dd") : PA5 = 合約工期_nud.Value : SQL_控制表_驗收修改1()
- 列印 = True : Else : 列印 = False : End If
- Else : 列印 = True : End If
- End If
- If 列印 = True Then
- If 合約編號_tb.Text = "" Then : If 系統語言 = "繁體中文" Then : MsgBox("沒有選擇合約,無法列印!!") : Else : MsgBox("No contract selected, can't print!!") : End If : 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 A" : xlSheet.Cells(6, 5) = "實際" & vbCrLf & "Actual B" : xlSheet.Cells(6, 6) = "差異" & vbCrLf & "Difference C=B-A"
- 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("實際", i).Value.ToString) = 0 Then : Else : xlSheet.Cells(7 + i, 5) = 報價明細表_dgv("實際", i).Value.ToString : End If
- If CInt(報價明細表_dgv("差異", i).Value.ToString) = 0 Then : Else : xlSheet.Cells(7 + i, 6) = 報價明細表_dgv("差異", i).Value.ToString : End If
- If CInt(報價明細表_dgv("合約", i).Value.ToString) = 0 Then : Else : xlSheet.Cells(7 + i, 4) = 報價明細表_dgv("合約", 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 = ""
- xlApp.Cells.Select()
- xlApp.Application.WindowState = xlMinimized
- If 系統語言 = "繁體中文" Then : MsgBox("列印完成!!") : Else : MsgBox("Printing is complete!!") : End If : Set_合約清單()
- End If
- End If
- End If
- End Sub
- 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
- 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(0)
- 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(0)
- myExcel.Selection.ShapeRange.IncrementTop(0)
- End Sub
- Private Sub FF(ByVal myExcel As Application, ByVal xlSheet As Worksheet)
- 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 = "" : .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
- End Class
|