Keine Beschreibung
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

加班審核.vb 5.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. Imports System.IO
  2. Public Class 加班審核
  3. ReadOnly ds1 As New DataSet
  4. Private Sub Set_加班明細()
  5. 月清單_DGV.DataSource = Nothing : ds1.Clear()
  6. 月清單_DGV.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  7. 月清單_DGV.ColumnHeadersHeight = 40
  8. 月清單_DGV.AllowUserToAddRows = False
  9. SQL_加班申請明細()
  10. da.Fill(ds1) : 月清單_DGV.DataSource = ds1.Tables(0) : conn.Close()
  11. 月清單_DGV.Columns(1).Visible = False
  12. 月清單_DGV.Columns(0).FillWeight = 60 : 月清單_DGV.Columns(2).FillWeight = 90 : 月清單_DGV.Columns(3).FillWeight = 60 : 月清單_DGV.Columns(4).Visible = False
  13. 月清單_DGV.Columns(5).FillWeight = 100 : 月清單_DGV.Columns(6).FillWeight = 200 : 月清單_DGV.Columns(7).FillWeight = 80 : 月清單_DGV.Columns(8).FillWeight = 90
  14. 月清單_DGV.Columns(9).FillWeight = 80 : 月清單_DGV.Columns(10).FillWeight = 90 : 月清單_DGV.Columns(11).Visible = False : 月清單_DGV.Columns(12).Visible = False
  15. 月清單_DGV.Columns(13).Visible = False
  16. For I As Integer = 0 To 月清單_DGV.Rows.Count - 1
  17. If 月清單_DGV.Rows(I).Cells("星期").Value.ToString = "星期六" Then : 月清單_DGV.Rows(I).DefaultCellStyle.BackColor = Color.LightPink
  18. ElseIf 月清單_DGV.Rows(I).Cells("星期").Value.ToString = "星期日" Then : 月清單_DGV.Rows(I).DefaultCellStyle.BackColor = Color.LightPink
  19. End If
  20. Next
  21. End Sub
  22. Private Sub 加班審核_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  23. 審核人_tb.Text = gUserName : 請假類別_cb.SelectedIndex = 0
  24. Set_加班明細()
  25. End Sub
  26. Private Sub 月清單_DGV_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles 月清單_DGV.CellClick
  27. If e.RowIndex = -1 Then : Else
  28. 員工編號_tb.Text = 月清單_DGV("員工編號", e.RowIndex).Value.ToString : 申請人_tb.Text = 月清單_DGV("姓名", e.RowIndex).Value.ToString
  29. 特假日期_tb.Text = 月清單_DGV("日期", e.RowIndex).Value.ToString : 審核人1_tb.Text = 月清單_DGV("核准人1", e.RowIndex).Value.ToString
  30. 事由_tb.Text = 月清單_DGV("事由紀錄", e.RowIndex).Value.ToString : 審核人2_tb.Text = 月清單_DGV("核准人2", e.RowIndex).Value.ToString
  31. DTP1_tb.Text = 月清單_DGV("核准日期1", e.RowIndex).Value.ToString : DTP2_tb.Text = 月清單_DGV("核准日期2", e.RowIndex).Value.ToString
  32. 審核人1_tb.Text = gUserName : 審核人2_tb.Text = gUserName
  33. '------------驗貨報告讀取--------------------------------------------------------------------------------------------
  34. If 月清單_DGV("圖片資料庫", e.RowIndex).Value.ToString <> "" And 月清單_DGV("圖片編號", e.RowIndex).Value.ToString <> "" Then
  35. 圖片庫 = 月清單_DGV("圖片資料庫", e.RowIndex).Value.ToString : SQL_連線字串_圖片資料庫() : PA2 = 月清單_DGV("圖片編號", e.RowIndex).Value.ToString
  36. SQL_加班圖() : PictureBox1.Image = Nothing
  37. While dr.Read() = True
  38. Dim unused As Byte() = New Byte(-1) {} : Dim bytes As Byte() = DirectCast(dr.Item("圖片"), Byte())
  39. Dim oStream As New MemoryStream(bytes) : PictureBox1.Image = Bitmap.FromStream(oStream)
  40. End While : conn.Close() : PictureBox1.SizeMode = 4
  41. Else
  42. PictureBox1.Image = Nothing
  43. End If
  44. End If
  45. End Sub
  46. Private Sub 月清單_DGV_RowPostPaint(ByVal sender As Object, ByVal e As DataGridViewRowPostPaintEventArgs) Handles 月清單_DGV.RowPostPaint
  47. For I As Integer = 0 To 月清單_DGV.Rows.Count - 1
  48. If 月清單_DGV.Rows(I).Cells("星期").Value.ToString = "星期六" Then : 月清單_DGV.Rows(I).DefaultCellStyle.BackColor = Color.LightPink
  49. ElseIf 月清單_DGV.Rows(I).Cells("星期").Value.ToString = "星期日" Then : 月清單_DGV.Rows(I).DefaultCellStyle.BackColor = Color.LightPink
  50. End If
  51. Next
  52. End Sub
  53. Private Sub 加班核准_bt_Click(sender As Object, e As EventArgs) Handles 加班核准_bt.Click
  54. If 特假日期_tb.Text = "" Then
  55. MsgBox("日期不能為空白")
  56. Else
  57. If 審核人1_tb.Text <> "" And 審核人2_tb.Text = "" Then
  58. PA = "申請中" : PA1 = Format(Today(), "yyyy/MM/dd") : PA2 = ""
  59. ElseIf 審核人1_tb.Text <> "" And 審核人2_tb.Text <> "" Then
  60. PA = "已核准" : PA1 = DTP1_tb.Text : PA2 = Format(Today(), "yyyy/MM/dd")
  61. End If
  62. SQL_加班審核核准() : Set_加班明細() : MsgBox("審核完成")
  63. End If
  64. End Sub
  65. Private Sub Button1_Click(sender As Object, e As EventArgs) Handles 加班未准_bt.Click
  66. If 特假日期_tb.Text = "" Then
  67. MsgBox("日期不能為空白")
  68. Else
  69. SQL_加班審核未准() : Set_加班明細() : MsgBox("審核完成")
  70. End If
  71. End Sub
  72. Private Sub 默認核准_bt_Click(sender As Object, e As EventArgs) Handles 默認核准_bt.Click
  73. If 特假日期_tb.Text = "" Then
  74. MsgBox("日期不能為空白")
  75. Else
  76. 審核人1_tb.Text = "自動核准" : 審核人2_tb.Text = "自動核准"
  77. PA = "已核准" : PA1 = Format(Today(), "yyyy/MM/dd") : PA2 = Format(Today(), "yyyy/MM/dd")
  78. SQL_加班審核核准() : Set_加班明細() : MsgBox("審核完成")
  79. End If
  80. End Sub
  81. Private Sub PictureBox1_Click(sender As Object, e As EventArgs) Handles PictureBox1.Click
  82. 圖片傳遞 = PictureBox1.Image : 圖片放大視窗.ShowDialog()
  83. End Sub
  84. End Class