Няма описание
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. Public Class 人員排班條件設定
  2. Private Sub 讀取人員資料表()
  3. Dim ds As New DataSet : Dim 穩定(7), 不穩定(7) As Integer
  4. 人員_dgv.DataSource = Nothing : ds.Clear()
  5. 人員_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
  6. 人員_dgv.ColumnHeadersHeight = 25 : 人員_dgv.AllowUserToAddRows = False
  7. 人員_dgv.RowTemplate.Height = 70
  8. SQL_人員備註清單()
  9. da.Fill(ds) : 人員_dgv.DataSource = ds.Tables(0) : conn.Close()
  10. 人員_dgv.Columns(0).FillWeight = 50 : 人員_dgv.Columns(1).Visible = False : 人員_dgv.Columns(2).FillWeight = 70 : 人員_dgv.Columns(3).FillWeight = 70
  11. 人員_dgv.Columns(4).FillWeight = 50 : 人員_dgv.Columns(5).FillWeight = 50 : 人員_dgv.Columns(6).FillWeight = 50 : 人員_dgv.Columns(7).FillWeight = 80
  12. 人員_dgv.Columns(8).FillWeight = 80 : 人員_dgv.Columns(9).FillWeight = 80 : 人員_dgv.Columns(10).FillWeight = 80 : 人員_dgv.Columns(11).FillWeight = 80
  13. 人員_dgv.Columns(12).FillWeight = 80 : 人員_dgv.Columns(13).FillWeight = 80 : 人員_dgv.Columns(14).FillWeight = 80 : 人員_dgv.Columns(15).FillWeight = 50
  14. 人員_dgv.Columns(16).FillWeight = 400
  15. 人員_dgv.EditMode = DataGridViewEditMode.EditOnEnter
  16. 人員_dgv.Columns(0).ReadOnly = True : 人員_dgv.Columns(2).ReadOnly = True : 人員_dgv.Columns(5).ReadOnly = True : 人員_dgv.Columns(6).ReadOnly = True
  17. 人員_dgv.Columns(7).ReadOnly = True : 人員_dgv.Columns(8).ReadOnly = True : 人員_dgv.Columns(9).ReadOnly = True : 人員_dgv.Columns(10).ReadOnly = True
  18. 人員_dgv.Columns(11).ReadOnly = True : 人員_dgv.Columns(12).ReadOnly = True : 人員_dgv.Columns(13).ReadOnly = True : 人員_dgv.Columns(14).ReadOnly = True
  19. 人員_dgv.Columns(15).ReadOnly = True
  20. For i As Integer = 0 To 7 : 穩定(i) = 0 : 不穩定(i) = 0 : Next
  21. For i As Integer = 0 To 人員_dgv.Rows.Count - 1 : 人員_dgv.Rows(i).Cells("No.").Value = i + 1
  22. If IsDBNull(人員_dgv.Rows(i).Cells(5).Value) Then : 人員_dgv.Rows(i).Cells(5).Value = False : End If
  23. If IsDBNull(人員_dgv.Rows(i).Cells(6).Value) Then : 人員_dgv.Rows(i).Cells(6).Value = False : End If
  24. If IsDBNull(人員_dgv.Rows(i).Cells(7).Value) Then : 人員_dgv.Rows(i).Cells(7).Value = False : End If
  25. If IsDBNull(人員_dgv.Rows(i).Cells(8).Value) Then : 人員_dgv.Rows(i).Cells(8).Value = False : End If
  26. If IsDBNull(人員_dgv.Rows(i).Cells(9).Value) Then : 人員_dgv.Rows(i).Cells(9).Value = False : End If
  27. If IsDBNull(人員_dgv.Rows(i).Cells(10).Value) Then : 人員_dgv.Rows(i).Cells(10).Value = False : End If
  28. If IsDBNull(人員_dgv.Rows(i).Cells(11).Value) Then : 人員_dgv.Rows(i).Cells(11).Value = False : End If
  29. If IsDBNull(人員_dgv.Rows(i).Cells(12).Value) Then : 人員_dgv.Rows(i).Cells(12).Value = False : End If
  30. If IsDBNull(人員_dgv.Rows(i).Cells(13).Value) Then : 人員_dgv.Rows(i).Cells(13).Value = False : End If
  31. If IsDBNull(人員_dgv.Rows(i).Cells(14).Value) Then : 人員_dgv.Rows(i).Cells(14).Value = False : End If
  32. If IsDBNull(人員_dgv.Rows(i).Cells(15).Value) Then : 人員_dgv.Rows(i).Cells(15).Value = False : End If
  33. If 人員_dgv.Rows(i).Cells(3).Value.ToString <> "" Then
  34. If 人員_dgv.Rows(i).Cells(15).Value = True Then
  35. If 人員_dgv.Rows(i).Cells("1F掛號").Value = True Then : 穩定(0) += 1 : End If
  36. If 人員_dgv.Rows(i).Cells("1F掛號(實)").Value = True Then : 穩定(1) += 1 : End If
  37. If 人員_dgv.Rows(i).Cells("1F跟診").Value = True Then : 穩定(2) += 1 : End If
  38. If 人員_dgv.Rows(i).Cells("1F治療").Value = True Then : 穩定(3) += 1 : End If
  39. If 人員_dgv.Rows(i).Cells("1F治療(實)").Value = True Then : 穩定(4) += 1 : End If
  40. If 人員_dgv.Rows(i).Cells("2F櫃台").Value = True Then : 穩定(5) += 1 : End If
  41. If 人員_dgv.Rows(i).Cells("2F醫美").Value = True Then : 穩定(6) += 1 : End If
  42. If 人員_dgv.Rows(i).Cells("行政").Value = True Then : 穩定(7) += 1 : End If
  43. Else
  44. If 人員_dgv.Rows(i).Cells("1F掛號").Value = True Then : 不穩定(0) += 1 : End If
  45. If 人員_dgv.Rows(i).Cells("1F掛號(實)").Value = True Then : 不穩定(1) += 1 : End If
  46. If 人員_dgv.Rows(i).Cells("1F跟診").Value = True Then : 不穩定(2) += 1 : End If
  47. If 人員_dgv.Rows(i).Cells("1F治療").Value = True Then : 不穩定(3) += 1 : End If
  48. If 人員_dgv.Rows(i).Cells("1F治療(實)").Value = True Then : 不穩定(4) += 1 : End If
  49. If 人員_dgv.Rows(i).Cells("2F櫃台").Value = True Then : 不穩定(5) += 1 : End If
  50. If 人員_dgv.Rows(i).Cells("2F醫美").Value = True Then : 不穩定(6) += 1 : End If
  51. If 人員_dgv.Rows(i).Cells("行政").Value = True Then : 不穩定(7) += 1 : End If
  52. End If
  53. End If
  54. Next
  55. 崗位01_Y.Text = 穩定(0) : 崗位02_Y.Text = 穩定(1) : 崗位03_Y.Text = 穩定(2) : 崗位04_Y.Text = 穩定(3)
  56. 崗位05_Y.Text = 穩定(4) : 崗位06_Y.Text = 穩定(5) : 崗位07_Y.Text = 穩定(6) : 崗位08_Y.Text = 穩定(7)
  57. 崗位01_N.Text = 不穩定(0) : 崗位02_N.Text = 不穩定(1) : 崗位03_N.Text = 不穩定(2) : 崗位04_N.Text = 不穩定(3)
  58. 崗位05_N.Text = 不穩定(4) : 崗位06_N.Text = 不穩定(5) : 崗位07_N.Text = 不穩定(6) : 崗位08_N.Text = 不穩定(7)
  59. End Sub
  60. Private Sub 人員排班條件設定_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  61. End Sub
  62. Private Sub 人員排班條件設定_Shown(sender As Object, e As EventArgs) Handles MyBase.Shown
  63. 讀取人員資料表()
  64. End Sub
  65. Private Sub 備註存檔_tb_Click(sender As Object, e As EventArgs) Handles 備註存檔_tb.Click
  66. If 編號_tb.Text <> "" Then
  67. PA10 = 問題備註_tb.Text : PA11 = 人員職位_tb.Text : PA12 = 職務性質_tb.Text : PA13 = 早班_ch.Checked : PA14 = 晚班_ch.Checked : PA = 編號_tb.Text
  68. PA9 = 崗位01_ch.Checked : PA8 = 崗位02_ch.Checked : PA7 = 崗位03_ch.Checked : PA6 = 崗位04_ch.Checked : PA5 = 崗位05_ch.Checked : PA4 = 崗位06_ch.Checked
  69. PA3 = 崗位07_ch.Checked : PA2 = 崗位08_ch.Checked : PA1 = 穩定_ch.Checked
  70. SQL_人員備註修改()
  71. End If
  72. For I As Integer = 0 To 人員_dgv.Rows.Count - 1
  73. PA = 人員_dgv("編號", I).Value.ToString : PA10 = 人員_dgv("人員備註", I).Value.ToString
  74. PA11 = 人員_dgv("職位", I).Value.ToString : PA12 = 人員_dgv("性質", I).Value.ToString
  75. PA13 = 人員_dgv("早班", I).Value : PA14 = 人員_dgv("晚班", I).Value
  76. PA9 = 人員_dgv(7, I).Value : PA8 = 人員_dgv(8, I).Value : PA7 = 人員_dgv(9, I).Value
  77. PA6 = 人員_dgv(10, I).Value : PA5 = 人員_dgv(11, I).Value : PA4 = 人員_dgv(12, I).Value
  78. PA3 = 人員_dgv(13, I).Value : PA2 = 人員_dgv(14, I).Value : PA1 = 人員_dgv(15, I).Value
  79. SQL_人員備註修改()
  80. Next : MsgBox("存檔完成!!") : 讀取人員資料表()
  81. End Sub
  82. Private Sub 人員_dgv_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles 人員_dgv.MouseUp
  83. 'If 報價總表_dgv.SelectedCells.Count = 1 Then : 通知訊息 = 報價總表_dgv.SelectedCells(0).ColumnIndex & " " & 報價總表_dgv.SelectedCells(0).RowIndex) : End If
  84. If 人員_dgv.SelectedCells.Count > 0 Then
  85. If 人員_dgv.SelectedCells(0).ColumnIndex = 5 Then
  86. If 人員_dgv.Rows(人員_dgv.SelectedCells(0).RowIndex).Cells(5).Value = True Then
  87. 人員_dgv.Rows(人員_dgv.SelectedCells(0).RowIndex).Cells(5).Value = False
  88. Else : 人員_dgv.Rows(人員_dgv.SelectedCells(0).RowIndex).Cells(5).Value = True : End If
  89. ElseIf 人員_dgv.SelectedCells(0).ColumnIndex = 6 Then
  90. If 人員_dgv.Rows(人員_dgv.SelectedCells(0).RowIndex).Cells(6).Value = True Then
  91. 人員_dgv.Rows(人員_dgv.SelectedCells(0).RowIndex).Cells(6).Value = False
  92. Else : 人員_dgv.Rows(人員_dgv.SelectedCells(0).RowIndex).Cells(6).Value = True : End If
  93. ElseIf 人員_dgv.SelectedCells(0).ColumnIndex = 7 Then
  94. If 人員_dgv.Rows(人員_dgv.SelectedCells(0).RowIndex).Cells(7).Value = True Then
  95. 人員_dgv.Rows(人員_dgv.SelectedCells(0).RowIndex).Cells(7).Value = False
  96. Else : 人員_dgv.Rows(人員_dgv.SelectedCells(0).RowIndex).Cells(7).Value = True : End If
  97. ElseIf 人員_dgv.SelectedCells(0).ColumnIndex = 8 Then
  98. If 人員_dgv.Rows(人員_dgv.SelectedCells(0).RowIndex).Cells(8).Value = True Then
  99. 人員_dgv.Rows(人員_dgv.SelectedCells(0).RowIndex).Cells(8).Value = False
  100. Else : 人員_dgv.Rows(人員_dgv.SelectedCells(0).RowIndex).Cells(8).Value = True : End If
  101. ElseIf 人員_dgv.SelectedCells(0).ColumnIndex = 9 Then
  102. If 人員_dgv.Rows(人員_dgv.SelectedCells(0).RowIndex).Cells(9).Value = True Then
  103. 人員_dgv.Rows(人員_dgv.SelectedCells(0).RowIndex).Cells(9).Value = False
  104. Else : 人員_dgv.Rows(人員_dgv.SelectedCells(0).RowIndex).Cells(9).Value = True : End If
  105. ElseIf 人員_dgv.SelectedCells(0).ColumnIndex = 10 Then
  106. If 人員_dgv.Rows(人員_dgv.SelectedCells(0).RowIndex).Cells(10).Value = True Then
  107. 人員_dgv.Rows(人員_dgv.SelectedCells(0).RowIndex).Cells(10).Value = False
  108. Else : 人員_dgv.Rows(人員_dgv.SelectedCells(0).RowIndex).Cells(10).Value = True : End If
  109. ElseIf 人員_dgv.SelectedCells(0).ColumnIndex = 11 Then
  110. If 人員_dgv.Rows(人員_dgv.SelectedCells(0).RowIndex).Cells(11).Value = True Then
  111. 人員_dgv.Rows(人員_dgv.SelectedCells(0).RowIndex).Cells(11).Value = False
  112. Else : 人員_dgv.Rows(人員_dgv.SelectedCells(0).RowIndex).Cells(11).Value = True : End If
  113. ElseIf 人員_dgv.SelectedCells(0).ColumnIndex = 12 Then
  114. If 人員_dgv.Rows(人員_dgv.SelectedCells(0).RowIndex).Cells(12).Value = True Then
  115. 人員_dgv.Rows(人員_dgv.SelectedCells(0).RowIndex).Cells(12).Value = False
  116. Else : 人員_dgv.Rows(人員_dgv.SelectedCells(0).RowIndex).Cells(12).Value = True : End If
  117. ElseIf 人員_dgv.SelectedCells(0).ColumnIndex = 13 Then
  118. If 人員_dgv.Rows(人員_dgv.SelectedCells(0).RowIndex).Cells(13).Value = True Then
  119. 人員_dgv.Rows(人員_dgv.SelectedCells(0).RowIndex).Cells(13).Value = False
  120. Else : 人員_dgv.Rows(人員_dgv.SelectedCells(0).RowIndex).Cells(13).Value = True : End If
  121. ElseIf 人員_dgv.SelectedCells(0).ColumnIndex = 14 Then
  122. If 人員_dgv.Rows(人員_dgv.SelectedCells(0).RowIndex).Cells(14).Value = True Then
  123. 人員_dgv.Rows(人員_dgv.SelectedCells(0).RowIndex).Cells(14).Value = False
  124. Else : 人員_dgv.Rows(人員_dgv.SelectedCells(0).RowIndex).Cells(14).Value = True : End If
  125. ElseIf 人員_dgv.SelectedCells(0).ColumnIndex = 15 Then
  126. If 人員_dgv.Rows(人員_dgv.SelectedCells(0).RowIndex).Cells(15).Value = True Then
  127. 人員_dgv.Rows(人員_dgv.SelectedCells(0).RowIndex).Cells(15).Value = False
  128. Else : 人員_dgv.Rows(人員_dgv.SelectedCells(0).RowIndex).Cells(15).Value = True : End If
  129. End If
  130. End If
  131. End Sub
  132. Private Sub 人員_dgv_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles 人員_dgv.CellClick
  133. If e.RowIndex = -1 Then : Else
  134. PA = 人員_dgv("編號", e.RowIndex).Value.ToString : PA1 = 人員_dgv("姓名", e.RowIndex).Value.ToString
  135. 編號_tb.Text = 人員_dgv("編號", e.RowIndex).Value.ToString : 人員名稱_tb.Text = 人員_dgv("姓名", e.RowIndex).Value.ToString
  136. SQL_人員備註()
  137. If dr.Read Then
  138. 人員職位_tb.Text = dr("職位").ToString : 職務性質_tb.Text = dr("性質").ToString : 問題備註_tb.Text = dr("人員備註").ToString
  139. If IsDBNull(dr("早班")) Then : Else : 早班_ch.Checked = dr("早班") : End If : If IsDBNull(dr("晚班")) Then : Else : 晚班_ch.Checked = dr("晚班") : End If
  140. If IsDBNull(dr("崗位01")) Then : Else : 崗位01_ch.Checked = dr("崗位01") : End If : If IsDBNull(dr("崗位02")) Then : Else : 崗位02_ch.Checked = dr("崗位02") : End If
  141. If IsDBNull(dr("崗位03")) Then : Else : 崗位03_ch.Checked = dr("崗位03") : End If : If IsDBNull(dr("崗位04")) Then : Else : 崗位04_ch.Checked = dr("崗位04") : End If
  142. If IsDBNull(dr("崗位05")) Then : Else : 崗位05_ch.Checked = dr("崗位05") : End If : If IsDBNull(dr("崗位06")) Then : Else : 崗位06_ch.Checked = dr("崗位06") : End If
  143. If IsDBNull(dr("崗位07")) Then : Else : 崗位07_ch.Checked = dr("崗位07") : End If : If IsDBNull(dr("崗位08")) Then : Else : 崗位08_ch.Checked = dr("崗位08") : End If
  144. If IsDBNull(dr("穩定")) Then : Else : 穩定_ch.Checked = dr("穩定") : End If
  145. End If
  146. End If
  147. End Sub
  148. End Class