123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455 |
- 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 ds8 As New DataSet
- Dim 放大 As Boolean
- Dim ESTR As String
- Dim EDR As Integer = 0
- Dim xlApp As Application : Dim xlBook As Workbook : Dim xlSheet As Worksheet
- ReadOnly 對話框(7) As String
- Private Sub Set_合約清單()
- Dim ds6 As New DataSet
- 合約_dgv.DataSource = Nothing : ds6.Clear()
- 合約_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
- 合約_dgv.ColumnHeadersHeight = 25 : 合約_dgv.AllowUserToAddRows = False
- PA46 = 合約編號1_cb.Text : PA47 = 工程期1_ch.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).FillWeight = 100 : 合約_dgv.Columns(25).Visible = False : 合約_dgv.Columns(26).Visible = False : 合約_dgv.Columns(27).Visible = False
- 合約_dgv.Columns(28).Visible = False : 合約_dgv.Columns("工程").FillWeight = 300 : 合約_dgv.Columns("Project").FillWeight = 300
- If 系統語言 = "繁體中文" Then
- If 放大 = True Then : 合約_dgv.Columns("工程").Visible = True : Else : 合約_dgv.Columns("工程").Visible = False : End If
- Else
- If 放大 = True Then : 合約_dgv.Columns("Project").Visible = True : Else : 合約_dgv.Columns("Project").Visible = False : End If
- End If
- End Sub
- Private Sub Set_附錄清單()
- Dim ds1 As New DataSet
- 合約附錄_dgv.DataSource = Nothing : ds1.Clear()
- 合約附錄_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
- 合約附錄_dgv.ColumnHeadersHeight = 25 : 合約附錄_dgv.AllowUserToAddRows = False
- SQL_附錄合約_清單查詢()
- da.Fill(ds1) : 合約附錄_dgv.DataSource = ds1.Tables(0) : conn.Close()
- 合約附錄_dgv.Columns(0).Visible = False : 合約附錄_dgv.Columns(1).FillWeight = 160 : 合約附錄_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).FillWeight = 70
- 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 Set_語言()
- 語言_dgv.DataSource = Nothing : ds8.Clear()
- 語言_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
- 語言_dgv.ColumnHeadersHeight = 25
- 語言_dgv.AllowUserToAddRows = False
- SQL_系統語言導入()
- da.Fill(ds8) : 語言_dgv.DataSource = ds8.Tables(0) : conn.Close()
- End Sub
- Private Sub 語言轉換讀取()
- Set_語言() : conn.Close()
- For i As Integer = 0 To 語言_dgv.Rows.Count - 1
- If 語言_dgv("控件", i).Value.ToString = "附錄合約" Then : Me.Text = 語言_dgv("內容", i).Value.ToString : End If
- If 語言_dgv("控件", i).Value.ToString = "甲方_lb" Then : 甲方_lb.Text = 語言_dgv("內容", i).Value.ToString : End If
- If 語言_dgv("控件", i).Value.ToString = "搜尋_lb" Then : 搜尋_lb.Text = 語言_dgv("內容", i).Value.ToString : End If
- If 語言_dgv("控件", i).Value.ToString = "不列印金額_ch" Then : 不列印金額_ch.Text = 語言_dgv("內容", i).Value.ToString : End If
- If 語言_dgv("控件", i).Value.ToString = "附錄編號_lb" Then : 附錄編號_lb.Text = 語言_dgv("內容", i).Value.ToString : End If
- If 語言_dgv("控件", i).Value.ToString = "合約編號_lb" Then : 合約編號_lb.Text = 語言_dgv("內容", i).Value.ToString : End If
- If 語言_dgv("控件", i).Value.ToString = "立約日期_lb" Then : 立約日期_lb.Text = 語言_dgv("內容", i).Value.ToString : End If
- If 語言_dgv("控件", i).Value.ToString = "工程名稱_中_lb" Then : 工程名稱_中_lb.Text = 語言_dgv("內容", i).Value.ToString : End If
- If 語言_dgv("控件", i).Value.ToString = "工程名稱_英_lb" Then : 工程名稱_英_lb.Text = 語言_dgv("內容", i).Value.ToString : End If
- If 語言_dgv("控件", i).Value.ToString = "客戶名稱_lb" Then : 客戶名稱_lb.Text = 語言_dgv("內容", i).Value.ToString : End If
- If 語言_dgv("控件", i).Value.ToString = "合約附錄停用_ch" Then : 合約附錄停用_ch.Text = 語言_dgv("內容", i).Value.ToString : End If
- If 語言_dgv("控件", i).Value.ToString = "原合约金额_lb" Then : 原合约金额_lb.Text = 語言_dgv("內容", i).Value.ToString : End If
- If 語言_dgv("控件", i).Value.ToString = "追加减_lb" Then : 追加减_lb.Text = 語言_dgv("內容", i).Value.ToString : End If
- If 語言_dgv("控件", i).Value.ToString = "總金額_lb" Then : 總金額_lb.Text = 語言_dgv("內容", i).Value.ToString : End If
- If 語言_dgv("控件", i).Value.ToString = "其他內容_lb" Then : 其他內容_lb.Text = 語言_dgv("內容", i).Value.ToString : End If
- If 語言_dgv("控件", i).Value.ToString = "dgv_合約號" Then : 表頭(134) = 語言_dgv("內容", i).Value.ToString : End If
- If 語言_dgv("控件", i).Value.ToString = "dgv_立約日期" Then : 表頭(116) = 語言_dgv("內容", i).Value.ToString : End If
- If 語言_dgv("控件", i).Value.ToString = "dgv_附錄編號" Then : 表頭(99) = 語言_dgv("內容", i).Value.ToString : End If
- If 語言_dgv("控件", i).Value.ToString = "dgv_保固到期" Then : 表頭(179) = 語言_dgv("內容", i).Value.ToString : End If
- If 語言_dgv("控件", i).Value.ToString = "對話框1" Then : 對話框(0) = 語言_dgv("內容", i).Value.ToString : End If
- If 語言_dgv("控件", i).Value.ToString = "對話框2" Then : 對話框(1) = 語言_dgv("內容", i).Value.ToString : End If
- If 語言_dgv("控件", i).Value.ToString = "對話框3" Then : 對話框(2) = 語言_dgv("內容", i).Value.ToString : End If
- If 語言_dgv("控件", i).Value.ToString = "對話框4" Then : 對話框(3) = 語言_dgv("內容", i).Value.ToString : End If
- If 語言_dgv("控件", i).Value.ToString = "對話框5" Then : 對話框(4) = 語言_dgv("內容", i).Value.ToString : End If
- If 語言_dgv("控件", i).Value.ToString = "對話框6" Then : 對話框(5) = 語言_dgv("內容", i).Value.ToString : End If
- If 語言_dgv("控件", i).Value.ToString = "對話框7" Then : 對話框(6) = 語言_dgv("內容", i).Value.ToString : End If
- If 語言_dgv("控件", i).Value.ToString = "對話框8" Then : 對話框(7) = 語言_dgv("內容", i).Value.ToString : End If
- Next
- End Sub
- Private Sub 附錄合約_Load(sender As Object, e As EventArgs) Handles MyBase.Load
- H(104) = True : 介面 = "H104" : 語言轉換讀取()
- 甲方條件下拉清單讀取() : Set_合約清單() : Set_附錄清單() : 合約報價單_Siz()
- 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 附錄合約_Closed(sender As Object, e As EventArgs) Handles MyBase.Closed
- H(104) = False
- End Sub
- Private Sub 語轉扭_bt_Click(sender As Object, e As EventArgs) Handles 語轉扭_bt.Click
- 介面 = "H104" : 語言轉換讀取() : Set_合約清單() : Set_附錄清單()
- 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
- 客戶名稱_tb.Text = 合約_dgv("客戶名稱", e.RowIndex).Value.ToString : 合約編號_tb.Text = 合約_dgv(表頭(134), e.RowIndex).Value.ToString
- 工程名稱_中_tb.Text = 合約_dgv("工程", e.RowIndex).Value.ToString : 工程名稱_英_tb.Text = 合約_dgv("Project", e.RowIndex).Value.ToString
- NUD3.Value = 合約_dgv("工程總價", e.RowIndex).Value : NUD2.Value = 0 : 其他內容_tb.Text = ""
- PA = 合約編號_tb.Text : Set_附錄清單() : If 放大 = True Then : 縮放2_bt.PerformClick() : End If
- End If
- End Sub
- Private Sub 合約附錄_dgv_CellClick(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles 合約附錄_dgv.CellClick
- NUD3.Value = 合約附錄_dgv("原金額", e.RowIndex).Value : NUD2.Value = 合約附錄_dgv("追加減", e.RowIndex).Value
- 附錄編號_tb.Text = 合約附錄_dgv(表頭(99), e.RowIndex).Value.ToString : 其他內容_tb.Text = 合約附錄_dgv("其他內容", e.RowIndex).Value.ToString
- 合約附錄停用_ch.Checked = 合約附錄_dgv(表頭(179), e.RowIndex).Value
- End Sub
- Private Sub 合約編號1_cb_SelectedIndexChanged(sender As Object, e As EventArgs) Handles 合約編號1_cb.SelectedIndexChanged
- Set_合約清單()
- End Sub
- Private Sub 工程期1_ch_SelectedIndexChanged(sender As Object, e As EventArgs) Handles 工程期1_ch.SelectedIndexChanged
- Set_合約清單()
- End Sub
- Private Sub NUD3_ValueChanged(sender As Object, e As EventArgs) Handles NUD3.ValueChanged
- NUD1.Value = NUD3.Value + NUD2.Value
- End Sub
- Private Sub NUD2_ValueChanged(sender As Object, e As EventArgs) Handles NUD2.ValueChanged
- NUD1.Value = NUD3.Value + NUD2.Value
- End Sub
- Private Sub 查詢_bt_Click(sender As Object, e As EventArgs) Handles 查詢_bt.Click
- PA = 關鍵字搜尋_tb.Text : Set_合約清單()
- End Sub
- Private Sub 新增資料_bt_Click(sender As Object, e As EventArgs) Handles 新增資料_bt.Click
- If 合約編號_tb.Text = "" Then : MsgBox(對話框(0)) : Else
- SQL_附錄合約_最後一筆資料()
- If dr.Read() Then : EDR = Double.Parse(Strings.Right(dr("附錄編號").ToString, 9)) : Else : EDR = 0 : End If
- conn.Close() : EDR += 1
- If EDR < 10 Then : ESTR = "HP" & "00000000" & EDR
- ElseIf EDR > 9 And EDR < 100 Then : ESTR = "HP" & "0000000" & EDR
- ElseIf EDR > 99 And EDR < 1000 Then : ESTR = "HP" & "000000" & EDR
- ElseIf EDR > 999 And EDR < 10000 Then : ESTR = "HP" & "00000" & EDR
- ElseIf EDR > 9999 And EDR < 100000 Then : ESTR = "HP" & "0000" & EDR
- ElseIf EDR > 99999 And EDR < 100000 Then : ESTR = "HP" & "000" & EDR
- ElseIf EDR > 999999 And EDR < 1000000 Then : ESTR = "HP" & "00" & EDR
- ElseIf EDR > 9999999 And EDR < 10000000 Then : ESTR = "HP" & "0" & EDR
- ElseIf EDR > 99999999 Then : ESTR = "HP" & EDR : End If
- 附錄編號_tb.Text = ESTR : NUD2.Value = 0 : 其他內容_tb.Text = ""
- End If
- End Sub
- Private Sub 刪除_bt_Click(sender As Object, e As EventArgs) Handles 刪除_bt.Click
- If 合約編號_tb.Text = "" Then : MsgBox(對話框(0)) : Else
- If 附錄編號_tb.Text = "" Then : MsgBox(對話框(1)) : Else
- PA1 = 附錄編號_tb.Text : SQL_附錄合約_刪除() : Set_附錄清單() : MsgBox(對話框(2))
- End If
- End If
- End Sub
- Private Sub 存檔_bt_Click(sender As Object, e As EventArgs) Handles 存檔_bt.Click
- If 合約編號_tb.Text = "" Then : MsgBox(對話框(0)) : Else
- If 附錄編號_tb.Text = "" Then : MsgBox(對話框(1)) : Else
- PA = 合約編號_tb.Text : PA1 = 附錄編號_tb.Text : PA2 = Strings.Format(立約日期_dtp.Value, "yyyy/MM/dd") : PA3 = NUD3.Value : PA4 = NUD2.Value
- PA5 = NUD1.Value : PA6 = 其他內容_tb.Text : BL1 = 合約附錄停用_ch.Checked
- SQL_附錄合約_最後一筆資料1() : If dr.Read() Then : SQL_附錄合約_修改() : Else : SQL_附錄合約_新增() : End If : Set_附錄清單() : MsgBox(對話框(3))
- End If
- End If
- 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
- If 系統語言 = "繁體中文" Then
- 合約_dgv.Columns("工程").Visible = False
- Else
- 合約_dgv.Columns("Project").Visible = False
- End If
- Else
- 合約_dgv.Size = New System.Drawing.Point(NX + 400, NY) : 放大 = True
- If 系統語言 = "繁體中文" Then
- 合約_dgv.Columns("工程").Visible = True
- Else
- 合約_dgv.Columns("Project").Visible = False
- End If
- End If
- End Sub
- Private Sub 列印_bt_Click(sender As Object, e As EventArgs) Handles 列印_bt.Click
- If 合約編號_tb.Text = "" Then : MsgBox(對話框(4)) : Else
- If 附錄編號_tb.Text = "" Then : MsgBox(對話框(5)) : Else
- If 合約附錄停用_ch.Checked = True Then : MsgBox(對話框(6)) : 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) = "Appendix contract" : xlSheet.Cells(4, 1) = "編號(No) : " & 合約編號_tb.Text
- xlSheet.Cells(5, 1) = 工程名稱_中_tb.Text : xlSheet.Cells(6, 1) = 工程名稱_英_tb.Text
- xlSheet.Cells(7, 1) = "日期(Date) : " & Strings.Format(立約日期_dtp.Value, "yyyy/MM/dd")
- Dim BF As String
- If Strings.Left(合約編號_tb.Text, 2) = "HX" Then : BF = "PT HONG XHE INDUSTRIAL" : Else : BF = "PT PUNCAK GEMILANG SEMESTA"
- End If
- xlSheet.Cells(8, 1) = "根據 " & 合約編號_tb.Text & " 號合同,雙方為A方 " & 客戶名稱_tb.Text & " 和B方 " & BF
- xlSheet.Cells(9, 1) = "According to the contract of " & 合約編號_tb.Text & ", both parties are " & 客戶名稱_tb.Text & " of Party A and " & BF
- If 不列印金額_ch.Checked = False Then
- xlSheet.Cells(11, 1) = "雙方同意此 " & 合約編號_tb.Text & " 號合同工程款变更为:"
- xlSheet.Cells(12, 1) = "The parties agree that the contract amount of this " & 合約編號_tb.Text & " will be changed to: "
- xlSheet.Cells(13, 1) = "1、原合约金额(含税) :" & Strings.Format(NUD3.Value, "#,##0") & " RP"
- xlSheet.Cells(14, 1) = " Original contract amount (including tax): " & Strings.Format(NUD3.Value, "#,##0") & " RP"
- xlSheet.Cells(16, 1) = "2、追加/追减金额(含税) :" & Strings.Format(NUD2.Value, "#,##0") & " RP"
- xlSheet.Cells(17, 1) = " Additional/reduction amount (including tax): " & Strings.Format(NUD2.Value, "#,##0") & " RP"
- xlSheet.Cells(19, 1) = "3、结算总金額(含税) : " & Strings.Format(NUD1.Value, "#,##0") & " RP"
- xlSheet.Cells(20, 1) = " Total settlement amount (including tax): " & Strings.Format(NUD1.Value, "#,##0") & " RP"
- xlSheet.Cells(22, 1) = 其他內容_tb.Text
- xlSheet.Cells(24, 1) = "此份附錄合同立成02份(中,英文版),A方執01份、B方執01份,在法律上均具同時等價值。 "
- xlSheet.Cells(25, 1) = "This appendix has a contract of 02 copies (in Chinese and English), with A party holding 01 copies and Party B holding 01 copies, which are legally equivalent"
- xlSheet.Cells(27, 1) = "Party A (A方)" : xlSheet.Cells(27, 3) = "Party B (B方)"
- Else
- xlSheet.Cells(11, 1) = 其他內容_tb.Text
- xlSheet.Cells(13, 1) = "此份附錄合同立成02份(中,英文版),A方執01份、B方執01份,在法律上均具同時等價值。 "
- xlSheet.Cells(14, 1) = "This appendix has a contract of 02 copies (in Chinese and English), with A party holding 01 copies and Party B holding 01 copies, which are legally equivalent"
- xlSheet.Cells(16, 1) = "Party A (A方)" : xlSheet.Cells(27, 3) = "Party B (B方)"
- End If
- 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
- MsgBox(對話框(7))
- 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 = 12 : .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.Columns("A:C").Select : myExcel.Selection.ColumnWidth = 40
- xlSheet.Range("A2:C2").Select()
- With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
- .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
- With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 22 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False
- .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
- xlSheet.Range("A3:C3").Select()
- With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
- .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
- With myExcel.Selection.Font : .Name = "微軟正黑體" : .Size = 22 : .Strikethrough = False : .Superscript = False : .Subscript = False : .OutlineFont = False : .Shadow = False
- .Underline = xlUnderlineStyleNone : .ThemeColor = xlThemeColorLight1 : .TintAndShade = 0 : .ThemeFont = xlThemeFontNone : End With
- myExcel.Selection.Font.Underline = xlUnderlineStyleSingle
- xlSheet.Range("A4:C4").Select()
- With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
- .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
- xlSheet.Range("A5:C5").Select()
- With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
- .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
- xlSheet.Range("A6:C6").Select()
- With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
- .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
- xlSheet.Range("A7:C7").Select()
- With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = True : .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 = True : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
- .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
- myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
- myExcel.Selection.Borders(xlEdgeLeft).LineStyle = xlNone : myExcel.Selection.Borders(xlEdgeTop).LineStyle = xlNone
- With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
- myExcel.Selection.Borders(xlEdgeRight).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
- myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
- xlSheet.Range("A8:C8").Select()
- With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = True : .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 = True : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
- .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
- xlSheet.Rows("8:8").Select : myExcel.Selection.RowHeight = 45
- xlSheet.Range("A9:C9").Select()
- With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = True : .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 = True : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
- .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
- xlSheet.Rows("9:9").Select : myExcel.Selection.RowHeight = 45
-
- If 不列印金額_ch.Checked = False Then
- xlSheet.Range("A11:C11").Select()
- With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = True : .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 = True : .Orientation = 0 : .AddIndent = False
- .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
- xlSheet.Rows("11:11").Select : myExcel.Selection.RowHeight = 15.75
- xlSheet.Range("A12:C12").Select()
- With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = True : .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 = True : .Orientation = 0 : .AddIndent = False
- .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
- xlSheet.Rows("12:12").Select : myExcel.Selection.RowHeight = 15.75
- xlSheet.Range("A13:C13").Select()
- With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = True : .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 = True : .Orientation = 0 : .AddIndent = False
- .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
- xlSheet.Rows("13:13").Select : myExcel.Selection.RowHeight = 15.75
- xlSheet.Range("A14:C14").Select()
- With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = True : .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 = True : .Orientation = 0 : .AddIndent = False
- .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
- xlSheet.Rows("14:14").Select : myExcel.Selection.RowHeight = 15.75
- xlSheet.Range("A16:C16").Select()
- With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = True : .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 = True : .Orientation = 0 : .AddIndent = False
- .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
- xlSheet.Rows("16:16").Select : myExcel.Selection.RowHeight = 15.75
- xlSheet.Range("A17:C17").Select()
- With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = True : .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 = True : .Orientation = 0 : .AddIndent = False
- .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
- xlSheet.Rows("17:17").Select : myExcel.Selection.RowHeight = 15.75
- xlSheet.Range("A19:C19").Select()
- With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = True : .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 = True : .Orientation = 0 : .AddIndent = False
- .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
- xlSheet.Rows("19:19").Select : myExcel.Selection.RowHeight = 15.75
- xlSheet.Range("A20:C20").Select()
- With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = True : .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 = True : .Orientation = 0 : .AddIndent = False
- .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
- xlSheet.Rows("20:20").Select : myExcel.Selection.RowHeight = 15.75
- xlSheet.Range("A22:C22").Select()
- With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
- .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
- With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlTop : .WrapText = True : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
- .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
- xlSheet.Rows("22:22").Select : myExcel.Selection.RowHeight = 250
- xlSheet.Range("A24:C24").Select()
- With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = True : .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 = True : .Orientation = 0 : .AddIndent = False
- .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
- xlSheet.Rows("24:24").Select : myExcel.Selection.RowHeight = 15.75
- xlSheet.Range("A25:C25").Select()
- With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = True : .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 = True : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
- .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
- xlSheet.Rows("25:25").Select : myExcel.Selection.RowHeight = 35
-
- xlSheet.Range("A27:C27").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.Rows("28:28").Select : myExcel.Selection.RowHeight = 90
-
- xlSheet.Range("A28").Select()
- myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
- myExcel.Selection.Borders(xlEdgeLeft).LineStyle = xlNone : myExcel.Selection.Borders(xlEdgeTop).LineStyle = xlNone
- With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
- myExcel.Selection.Borders(xlEdgeRight).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
- myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
- xlSheet.Range("C28").Select()
- myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
- myExcel.Selection.Borders(xlEdgeLeft).LineStyle = xlNone : myExcel.Selection.Borders(xlEdgeTop).LineStyle = xlNone
- With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
- myExcel.Selection.Borders(xlEdgeRight).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
- myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
- xlSheet.Rows("10:10").Select : myExcel.Selection.RowHeight = 8 : xlSheet.Rows("15:15").Select : myExcel.Selection.RowHeight = 8
- xlSheet.Rows("18:18").Select : myExcel.Selection.RowHeight = 8 : xlSheet.Rows("21:21").Select : myExcel.Selection.RowHeight = 8
- Else
- xlSheet.Range("A11:C11").Select()
- With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = True : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
- .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = False : End With : myExcel.Selection.Merge
- With myExcel.Selection : .HorizontalAlignment = xlLeft : .VerticalAlignment = xlTop : .WrapText = True : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
- .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
- xlSheet.Rows("11:11").Select : myExcel.Selection.RowHeight = 400
- xlSheet.Range("A13:C13").Select()
- With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = True : .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 = True : .Orientation = 0 : .AddIndent = False
- .IndentLevel = 0 : .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
- xlSheet.Rows("13:13").Select : myExcel.Selection.RowHeight = 15.75
- xlSheet.Range("A14:C14").Select()
- With myExcel.Selection : .HorizontalAlignment = xlCenter : .VerticalAlignment = xlCenter : .WrapText = True : .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 = True : .Orientation = 0 : .AddIndent = False : .IndentLevel = 0
- .ShrinkToFit = False : .ReadingOrder = xlContext : .MergeCells = True : End With
- xlSheet.Rows("14:14").Select : myExcel.Selection.RowHeight = 35
-
- xlSheet.Range("A16:C16").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.Rows("17:17").Select : myExcel.Selection.RowHeight = 90
- xlSheet.Range("A17").Select()
- myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
- myExcel.Selection.Borders(xlEdgeLeft).LineStyle = xlNone : myExcel.Selection.Borders(xlEdgeTop).LineStyle = xlNone
- With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
- myExcel.Selection.Borders(xlEdgeRight).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
- myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
- xlSheet.Range("C17").Select()
- myExcel.Selection.Borders(xlDiagonalDown).LineStyle = xlNone : myExcel.Selection.Borders(xlDiagonalUp).LineStyle = xlNone
- myExcel.Selection.Borders(xlEdgeLeft).LineStyle = xlNone : myExcel.Selection.Borders(xlEdgeTop).LineStyle = xlNone
- With myExcel.Selection.Borders(xlEdgeBottom) : .LineStyle = xlContinuous : .ColorIndex = 0 : .TintAndShade = 0 : .Weight = xlThin : End With
- myExcel.Selection.Borders(xlEdgeRight).LineStyle = xlNone : myExcel.Selection.Borders(xlInsideVertical).LineStyle = xlNone
- myExcel.Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
- End If
- myExcel.ActiveWindow.DisplayGridlines = False
- xlSheet.Range("D1").Select()
- 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 = "" : .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
|