Bez popisu
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.

拆帳制考勤文件導入.vb 46KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377
  1. Public Class 拆帳制考勤文件導入
  2. Dim xlApp As Microsoft.Office.Interop.Excel.Application
  3. Dim xlBook As Microsoft.Office.Interop.Excel.Workbook
  4. Dim xlSheet As Microsoft.Office.Interop.Excel.Worksheet
  5. Dim file_name, 文件判斷 As String
  6. Private Sub 拆帳制考勤文件導入_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  7. End Sub
  8. Private Sub 拆帳制考勤文件導入_Shown(sender As Object, e As EventArgs) Handles MyBase.Shown
  9. SQL_營運成本收支單對帳表_查詢最後一筆年份清單() : 年份_cb.Items.Clear() : 年份_cb.Items.Add("") : While (dr.Read()) : 年份_cb.Items.Add(dr("年份")) : End While : conn.Close()
  10. End Sub
  11. Private Sub 選路徑1_bt_Click(sender As Object, e As EventArgs) Handles 選路徑1_bt.Click
  12. If 開啟檔案.ShowDialog <> Windows.Forms.DialogResult.Cancel Then : 路徑1_tb.Text = 開啟檔案.FileName
  13. '----------服務紀錄總表-----------------------------------------------------------------------------------------------------------------------------------------------
  14. file_name = 路徑1_tb.Text : xlApp = CreateObject("Excel.Application") : xlApp.DisplayAlerts = False : xlApp.Visible = False : xlApp.Workbooks.Open(file_name)
  15. xlSheet = xlApp.Worksheets(1) : xlSheet.Activate()
  16. 文件判斷 = xlSheet.Cells(2, 1).value : 文件判斷 &= xlSheet.Cells(3, 1).value : 文件判斷 &= xlSheet.Cells(3, 2).value : 文件判斷 &= xlSheet.Cells(3, 3).value
  17. 文件判斷 &= xlSheet.Cells(3, 4).value : 文件判斷 &= xlSheet.Cells(3, 5).value : 文件判斷 &= xlSheet.Cells(3, 6).value : 文件判斷 &= xlSheet.Cells(3, 7).value
  18. If 文件判斷 = "服務紀錄編號案號服務項目代碼服務項目類別身分證字號姓名服務日期" Then : Else : MsgBox("服務紀錄總表 檔案不吻合!!") : 路徑1_tb.Text = "" : End If
  19. xlApp.Visible = True : xlApp.Quit() : xlApp = Nothing
  20. End If
  21. End Sub
  22. Private Sub 選路徑2_bt_Click(sender As Object, e As EventArgs) Handles 選路徑2_bt.Click
  23. If 開啟檔案.ShowDialog <> Windows.Forms.DialogResult.Cancel Then : 路徑2_tb.Text = 開啟檔案.FileName
  24. '----------拆 帳 明 細 表-----------------------------------------------------------------------------------------------------------------------------------------------
  25. file_name = 路徑2_tb.Text : xlApp = CreateObject("Excel.Application") : xlApp.DisplayAlerts = False : xlApp.Visible = False : xlApp.Workbooks.Open(file_name)
  26. xlSheet = xlApp.Worksheets(1) : xlSheet.Activate()
  27. 文件判斷 = xlSheet.Cells(2, 1).value : 文件判斷 &= xlSheet.Cells(3, 1).value : 文件判斷 &= xlSheet.Cells(3, 2).value : 文件判斷 &= xlSheet.Cells(3, 3).value
  28. 文件判斷 &= xlSheet.Cells(3, 4).value : 文件判斷 &= xlSheet.Cells(3, 5).value : 文件判斷 &= xlSheet.Cells(3, 6).value : 文件判斷 &= xlSheet.Cells(3, 7).value
  29. If 文件判斷 = "員工基本資料序號姓名身分證字號主責督導副督導總服務金額公司拆帳金額" Then : Else : MsgBox("拆帳明細表 檔案不吻合!!") : 路徑2_tb.Text = "" : End If
  30. xlApp.Visible = True : xlApp.Quit() : xlApp = Nothing
  31. End If
  32. End Sub
  33. Private Sub 選路徑3_bt_Click(sender As Object, e As EventArgs) Handles 選路徑3_bt.Click
  34. If 開啟檔案.ShowDialog <> Windows.Forms.DialogResult.Cancel Then : 路徑3_tb.Text = 開啟檔案.FileName
  35. '----------薪資報表明細-----------------------------------------------------------------------------------------------------------------------------------------------
  36. file_name = 路徑3_tb.Text : xlApp = CreateObject("Excel.Application") : xlApp.DisplayAlerts = False : xlApp.Visible = False : xlApp.Workbooks.Open(file_name)
  37. xlSheet = xlApp.Worksheets(1) : xlSheet.Activate()
  38. 文件判斷 = xlSheet.Cells(3, 1).value : 文件判斷 &= xlSheet.Cells(3, 2).value : 文件判斷 &= xlSheet.Cells(3, 3).value : 文件判斷 &= xlSheet.Cells(3, 4).value
  39. 文件判斷 &= xlSheet.Cells(3, 5).value : 文件判斷 &= xlSheet.Cells(3, 6).value : 文件判斷 &= xlSheet.Cells(3, 7).value : 文件判斷 &= xlSheet.Cells(3, 8).value
  40. If 文件判斷 = "序員工編號分類姓名主責督導B碼時薪G碼/S碼時薪轉場費計算 (排班時間)" Then : Else : MsgBox("薪資報表明細 檔案不吻合!!") : 路徑3_tb.Text = "" : End If
  41. xlApp.Visible = True : xlApp.Quit() : xlApp = Nothing
  42. End If
  43. End Sub
  44. Private Sub 選路徑4_bt_Click(sender As Object, e As EventArgs) Handles 選路徑4_bt.Click
  45. If 開啟檔案.ShowDialog <> Windows.Forms.DialogResult.Cancel Then : 路徑4_tb.Text = 開啟檔案.FileName
  46. '----------每 日 明 細-----------------------------------------------------------------------------------------------------------------------------------------------
  47. file_name = 路徑4_tb.Text : xlApp = CreateObject("Excel.Application") : xlApp.DisplayAlerts = False : xlApp.Visible = False : xlApp.Workbooks.Open(file_name)
  48. xlSheet = xlApp.Worksheets(1) : xlSheet.Activate()
  49. 文件判斷 = xlSheet.Cells(3, 1).value : 文件判斷 &= xlSheet.Cells(3, 2).value : 文件判斷 &= xlSheet.Cells(3, 3).value : 文件判斷 &= xlSheet.Cells(3, 4).value
  50. 文件判斷 &= xlSheet.Cells(3, 5).value : 文件判斷 &= xlSheet.Cells(3, 6).value : 文件判斷 &= xlSheet.Cells(3, 7).value : 文件判斷 &= xlSheet.Cells(3, 8).value
  51. If 文件判斷 = "序員工編號分類姓名主責督導B碼時薪G碼/S碼時薪日期" Then : Else : MsgBox("每日明細 檔案不吻合!!") : 路徑4_tb.Text = "" : End If
  52. xlApp.Visible = True : xlApp.Quit() : xlApp = Nothing
  53. End If
  54. End Sub
  55. Private Sub 選路徑5_bt_Click(sender As Object, e As EventArgs) Handles 選路徑5_bt.Click
  56. If 開啟檔案.ShowDialog <> Windows.Forms.DialogResult.Cancel Then : 路徑5_tb.Text = 開啟檔案.FileName
  57. '----------個 案 總 表-----------------------------------------------------------------------------------------------------------------------------------------------
  58. file_name = 路徑5_tb.Text : xlApp = CreateObject("Excel.Application") : xlApp.DisplayAlerts = False : xlApp.Visible = False : xlApp.Workbooks.Open(file_name)
  59. xlSheet = xlApp.Worksheets(1) : xlSheet.Activate()
  60. 文件判斷 = xlSheet.Cells(3, 1).value : 文件判斷 &= xlSheet.Cells(3, 2).value : 文件判斷 &= xlSheet.Cells(3, 3).value : 文件判斷 &= xlSheet.Cells(3, 4).value
  61. 文件判斷 &= xlSheet.Cells(3, 5).value : 文件判斷 &= xlSheet.Cells(3, 6).value : 文件判斷 &= xlSheet.Cells(3, 7).value : 文件判斷 &= xlSheet.Cells(3, 8).value
  62. If 文件判斷 = "編號目前狀態個案來源案號衛福案號分類姓名性別" Then : Else : MsgBox("個案總表 檔案不吻合!!") : 路徑5_tb.Text = "" : End If
  63. xlApp.Visible = True : xlApp.Quit() : xlApp = Nothing
  64. End If
  65. End Sub
  66. Private Sub 選路徑6_bt_Click(sender As Object, e As EventArgs) Handles 選路徑6_bt.Click
  67. If 開啟檔案.ShowDialog <> Windows.Forms.DialogResult.Cancel Then : 路徑6_tb.Text = 開啟檔案.FileName
  68. '----------個 案 總 表-----------------------------------------------------------------------------------------------------------------------------------------------
  69. file_name = 路徑6_tb.Text : xlApp = CreateObject("Excel.Application") : xlApp.DisplayAlerts = False : xlApp.Visible = False : xlApp.Workbooks.Open(file_name)
  70. xlSheet = xlApp.Worksheets(1) : xlSheet.Activate()
  71. 文件判斷 = xlSheet.Cells(4, 1).value : 文件判斷 &= xlSheet.Cells(4, 2).value : 文件判斷 &= xlSheet.Cells(4, 3).value : 文件判斷 &= xlSheet.Cells(4, 4).value
  72. 文件判斷 &= xlSheet.Cells(4, 5).value : 文件判斷 &= xlSheet.Cells(4, 6).value : 文件判斷 &= xlSheet.Cells(4, 7).value : 文件判斷 &= xlSheet.Cells(4, 8).value
  73. If 文件判斷 = "序號服務代碼採用計畫CMS等級服務項目類別身分證號個案姓名給付價格" Then : Else : MsgBox("個案總表 檔案不吻合!!") : 路徑6_tb.Text = "" : End If
  74. xlApp.Visible = True : xlApp.Quit() : xlApp = Nothing
  75. End If
  76. End Sub
  77. Private Sub 選路徑7_bt_Click(sender As Object, e As EventArgs) Handles 選路徑7_bt.Click
  78. If 開啟檔案.ShowDialog <> Windows.Forms.DialogResult.Cancel Then : 路徑7_tb.Text = 開啟檔案.FileName
  79. '----------個 案 總 表-----------------------------------------------------------------------------------------------------------------------------------------------
  80. file_name = 路徑7_tb.Text : xlApp = CreateObject("Excel.Application") : xlApp.DisplayAlerts = False : xlApp.Visible = False : xlApp.Workbooks.Open(file_name)
  81. xlSheet = xlApp.Worksheets(1) : xlSheet.Activate()
  82. 文件判斷 = xlSheet.Cells(4, 1).value : 文件判斷 &= xlSheet.Cells(4, 2).value : 文件判斷 &= xlSheet.Cells(4, 3).value : 文件判斷 &= xlSheet.Cells(4, 4).value
  83. 文件判斷 &= xlSheet.Cells(4, 5).value : 文件判斷 &= xlSheet.Cells(4, 6).value : 文件判斷 &= xlSheet.Cells(4, 7).value : 文件判斷 &= xlSheet.Cells(4, 8).value
  84. If 文件判斷 = "序號服務代碼採用計畫CMS等級服務項目類別身分證號個案姓名給付價格" Then : Else : MsgBox("個案總表 檔案不吻合!!") : 路徑7_tb.Text = "" : End If
  85. xlApp.Visible = True : xlApp.Quit() : xlApp = Nothing
  86. End If
  87. End Sub
  88. Private Sub 導入_bt_Click(sender As Object, e As EventArgs) Handles 導入_bt.Click
  89. If 年份_cb.Text <> "" And 月份_cb.Text <> "" Then
  90. 資料數 = 10000 : Dim 文件判斷, 不吻合訊息 As String : 不吻合訊息 = ""
  91. '----------服務紀錄總表-----------------------------------------------------------------------------------------------------------------------------------------------
  92. If 路徑1_tb.Text <> "" Then
  93. file_name = 路徑1_tb.Text : xlApp = CreateObject("Excel.Application") : xlApp.DisplayAlerts = False : xlApp.Visible = False : xlApp.Workbooks.Open(file_name)
  94. xlSheet = xlApp.Worksheets(1) : xlSheet.Activate()
  95. SQL2 = ""
  96. ConnOpen() : SQL1 = "DELETE 人事拆帳制服務紀錄_仁寶 WHERE 流水號 LIKE N'" & 年份_cb.Text & 月份_cb.Text & "%'" : CmdSet_For_dr()
  97. For I As Integer = 0 To 10000 : MyModule1.進度條()
  98. SQL2 &= "(N'" & 年份_cb.Text & 月份_cb.Text & "',N'" & xlSheet.Cells(I + 5, 1).value & "',N'" & xlSheet.Cells(I + 5, 2).value & "',
  99. N'" & xlSheet.Cells(I + 5, 3).value & "',N'" & xlSheet.Cells(I + 5, 4).value & "',N'" & xlSheet.Cells(I + 5, 5).value & "',
  100. N'" & xlSheet.Cells(I + 5, 6).value & "',N'" & xlSheet.Cells(I + 5, 7).value & "',N'" & xlSheet.Cells(I + 5, 8).value & "',
  101. N'" & xlSheet.Cells(I + 5, 9).value & "',N'" & xlSheet.Cells(I + 5, 10).value & "',N'" & xlSheet.Cells(I + 5, 11).value & "',
  102. N'" & xlSheet.Cells(I + 5, 12).value & "',N'" & xlSheet.Cells(I + 5, 13).value & "',N'" & xlSheet.Cells(I + 5, 14).value & "',
  103. N'" & xlSheet.Cells(I + 5, 15).value & "',N'" & xlSheet.Cells(I + 5, 16).value & "',N'" & xlSheet.Cells(I + 5, 17).value & "',
  104. N'" & xlSheet.Cells(I + 5, 18).value & "',N'" & xlSheet.Cells(I + 5, 19).value & "',N'" & xlSheet.Cells(I + 5, 20).value & "',
  105. N'" & xlSheet.Cells(I + 5, 21).value & "',N'" & xlSheet.Cells(I + 5, 26).value & "',N'" & xlSheet.Cells(I + 5, 27).value & "',
  106. N'" & xlSheet.Cells(I + 5, 34).value & "'),"
  107. If (I <> 0 And I Mod 100 = 0) Or IsNothing(xlSheet.Cells(I + 5, 1).value) = True Then : MyModule1.進度條()
  108. If Not String.IsNullOrEmpty(SQL2) AndAlso SQL2.Length > 0 Then : SQL2 = SQL2.Substring(0, SQL2.Length - 1) : End If
  109. ConnOpen()
  110. SQL1 = "INSERT INTO 人事拆帳制服務紀錄_仁寶 (流水號, 編號, 案號, 服務項目代碼, 服務項目類別, 身分證字號, 姓名, 服務日期, 服務類別, 項目服務次數,
  111. 一般or原民區或離島, 項目單價, 申報費用, 部分負擔比例, 部分負擔費用, 補助比例, 補助費用, 民眾自費金額,
  112. 服務單位, 居服員姓名, 加班類型, 服務狀態, 排班時間, 排班時間長度, 服務子項目代碼)
  113. VALUES " & SQL2
  114. CmdSet_For_dr() : SQL2 = ""
  115. If IsNothing(xlSheet.Cells(I + 5, 1).value) = True Then : Exit For : End If
  116. End If
  117. Next : xlApp.Visible = True : xlApp.Quit() : xlApp = Nothing
  118. End If
  119. '----------拆 帳 明 細 表-----------------------------------------------------------------------------------------------------------------------------------------------
  120. If 路徑2_tb.Text <> "" Then
  121. file_name = 路徑2_tb.Text : xlApp = CreateObject("Excel.Application") : xlApp.DisplayAlerts = False : xlApp.Visible = False : xlApp.Workbooks.Open(file_name)
  122. xlSheet = xlApp.Worksheets(1) : xlSheet.Activate()
  123. ConnOpen() : SQL1 = "DELETE 人事拆帳制明細_仁寶 WHERE 流水號 LIKE N'" & 年份_cb.Text & 月份_cb.Text & "%'" : CmdSet_For_dr() : Dim DSF(7) As String
  124. SQL2 = ""
  125. For I As Integer = 0 To 10000 : MyModule1.進度條()
  126. If IsNothing(xlSheet.Cells(I + 4, 1).value) = False Then : DSF(0) = xlSheet.Cells(I + 4, 1).value : End If
  127. If IsNothing(xlSheet.Cells(I + 4, 2).value) = False Then : DSF(1) = xlSheet.Cells(I + 4, 2).value : End If
  128. If IsNothing(xlSheet.Cells(I + 4, 3).value) = False Then : DSF(2) = xlSheet.Cells(I + 4, 3).value : End If
  129. If IsNothing(xlSheet.Cells(I + 4, 4).value) = False Then : DSF(3) = xlSheet.Cells(I + 4, 4).value : End If
  130. If IsNothing(xlSheet.Cells(I + 4, 5).value) = False Then : DSF(4) = xlSheet.Cells(I + 4, 5).value : End If
  131. If IsNothing(xlSheet.Cells(I + 4, 6).value) = False Then : DSF(5) = xlSheet.Cells(I + 4, 6).value : End If
  132. If IsNothing(xlSheet.Cells(I + 4, 7).value) = False Then : DSF(6) = xlSheet.Cells(I + 4, 7).value : End If
  133. If IsNothing(xlSheet.Cells(I + 4, 8).value) = False Then : DSF(7) = xlSheet.Cells(I + 4, 8).value : End If
  134. SQL2 &= "(N'" & 年份_cb.Text & 月份_cb.Text & "',N'" & DSF(0) & "',N'" & DSF(1) & "', N'" & DSF(2) & "',N'" & DSF(3) & "',N'" & DSF(4) & "',
  135. N'" & DSF(5) & "',N'" & DSF(6) & "',N'" & DSF(7) & "',
  136. N'" & xlSheet.Cells(I + 4, 9).value & "',N'" & xlSheet.Cells(I + 4, 10).value & "',N'" & xlSheet.Cells(I + 4, 11).value & "',
  137. N'" & xlSheet.Cells(I + 4, 12).value & "',N'" & xlSheet.Cells(I + 4, 13).value & "',N'" & xlSheet.Cells(I + 4, 14).value & "',
  138. N'" & xlSheet.Cells(I + 4, 15).value & "',N'" & xlSheet.Cells(I + 4, 16).value & "',N'" & xlSheet.Cells(I + 4, 17).value & "',
  139. N'" & xlSheet.Cells(I + 4, 18).value & "',N'" & xlSheet.Cells(I + 4, 19).value & "',N'" & xlSheet.Cells(I + 4, 20).value & "',
  140. N'" & xlSheet.Cells(I + 4, 21).value & "',N'" & xlSheet.Cells(I + 4, 22).value & "',N'" & xlSheet.Cells(I + 4, 23).value & "'),"
  141. If (I <> 0 And I Mod 100 = 0) Or IsNothing(xlSheet.Cells(I + 4, 9).value) = True Then : MyModule1.進度條()
  142. If Not String.IsNullOrEmpty(SQL2) AndAlso SQL2.Length > 0 Then : SQL2 = SQL2.Substring(0, SQL2.Length - 1) : End If
  143. ConnOpen()
  144. SQL1 = "INSERT INTO 人事拆帳制明細_仁寶 (流水號, 序號, 姓名, 身分證字號, 主責督導, 副督導, 總服務金額, 公司拆帳金額, 員工拆帳金額, 全額,
  145. 公司拆帳, 員工拆帳, 補助or自費, 編號, 項目名稱, 次數, 一般or偏鄉, 單價, 加班類型, 服務人員角色, 拆帳方式,
  146. 公司拆帳比, 員工拆帳比, 員工計次金額)
  147. VALUES " & SQL2
  148. CmdSet_For_dr() : SQL2 = ""
  149. If IsNothing(xlSheet.Cells(I + 4, 9).value) = True Then : Exit For : End If
  150. End If
  151. Next : xlApp.Visible = True : xlApp.Quit() : xlApp = Nothing
  152. End If
  153. '----------薪資報表明細-----------------------------------------------------------------------------------------------------------------------------------------------
  154. If 路徑3_tb.Text <> "" Then
  155. file_name = 路徑3_tb.Text : xlApp = CreateObject("Excel.Application") : xlApp.DisplayAlerts = False : xlApp.Visible = False : xlApp.Workbooks.Open(file_name)
  156. xlSheet = xlApp.Worksheets(1) : xlSheet.Activate()
  157. ConnOpen() : SQL1 = "DELETE 人事拆帳制薪資報表明細_仁寶 WHERE 流水號 LIKE N'" & 年份_cb.Text & 月份_cb.Text & "%'" : CmdSet_For_dr()
  158. SQL2 = ""
  159. For I As Integer = 0 To 10000 : MyModule1.進度條()
  160. SQL2 &= "(N'" & 年份_cb.Text & 月份_cb.Text & "',N'" & xlSheet.Cells(I + 7, 1).value & "',N'" & xlSheet.Cells(I + 7, 2).value & "',
  161. N'" & xlSheet.Cells(I + 7, 3).value & "',N'" & xlSheet.Cells(I + 7, 4).value & "',N'" & xlSheet.Cells(I + 7, 5).value & "',
  162. N'" & xlSheet.Cells(I + 7, 6).value & "',N'" & xlSheet.Cells(I + 7, 7).value & "',N'" & xlSheet.Cells(I + 7, 8).value & "',
  163. N'" & xlSheet.Cells(I + 7, 9).value & "',N'" & xlSheet.Cells(I + 7, 11).value & "',N'" & xlSheet.Cells(I + 7, 12).value & "',
  164. N'" & xlSheet.Cells(I + 7, 14).value & "',N'" & xlSheet.Cells(I + 7, 15).value & "',N'" & xlSheet.Cells(I + 7, 16).value & "',
  165. N'" & xlSheet.Cells(I + 7, 17).value & "',N'" & xlSheet.Cells(I + 7, 18).value & "',N'" & xlSheet.Cells(I + 7, 19).value & "',
  166. N'" & xlSheet.Cells(I + 7, 20).value & "',N'" & xlSheet.Cells(I + 7, 21).value & "',N'" & xlSheet.Cells(I + 7, 22).value & "',
  167. N'" & xlSheet.Cells(I + 7, 23).value & "',N'" & xlSheet.Cells(I + 7, 24).value & "',N'" & xlSheet.Cells(I + 7, 25).value & "',
  168. N'" & xlSheet.Cells(I + 7, 26).value & "',N'" & xlSheet.Cells(I + 7, 27).value & "',N'" & xlSheet.Cells(I + 7, 28).value & "',
  169. N'" & xlSheet.Cells(I + 7, 29).value & "',N'" & xlSheet.Cells(I + 7, 30).value & "',N'" & xlSheet.Cells(I + 7, 31).value & "',
  170. N'" & xlSheet.Cells(I + 7, 32).value & "',N'" & xlSheet.Cells(I + 7, 33).value & "',N'" & xlSheet.Cells(I + 7, 34).value & "',
  171. N'" & xlSheet.Cells(I + 7, 35).value & "',N'" & xlSheet.Cells(I + 7, 36).value & "',N'" & xlSheet.Cells(I + 7, 37).value & "',
  172. N'" & xlSheet.Cells(I + 7, 38).value & "',N'" & xlSheet.Cells(I + 7, 39).value & "',N'" & xlSheet.Cells(I + 7, 40).value & "',
  173. N'" & xlSheet.Cells(I + 7, 41).value & "',N'" & xlSheet.Cells(I + 7, 42).value & "',N'" & xlSheet.Cells(I + 7, 43).value & "',
  174. N'" & xlSheet.Cells(I + 7, 44).value & "',N'" & xlSheet.Cells(I + 7, 45).value & "',N'" & xlSheet.Cells(I + 7, 46).value & "',
  175. N'" & xlSheet.Cells(I + 7, 47).value & "',N'" & xlSheet.Cells(I + 7, 48).value & "',N'" & xlSheet.Cells(I + 7, 49).value & "',
  176. N'" & xlSheet.Cells(I + 7, 50).value & "',N'" & xlSheet.Cells(I + 7, 51).value & "',N'" & xlSheet.Cells(I + 7, 52).value & "',
  177. N'" & xlSheet.Cells(I + 7, 53).value & "',N'" & xlSheet.Cells(I + 7, 54).value & "',N'" & xlSheet.Cells(I + 7, 55).value & "',
  178. N'" & xlSheet.Cells(I + 7, 56).value & "',N'" & xlSheet.Cells(I + 7, 57).value & "',N'" & xlSheet.Cells(I + 7, 58).value & "',
  179. N'" & xlSheet.Cells(I + 7, 59).value & "',N'" & xlSheet.Cells(I + 7, 60).value & "',N'" & xlSheet.Cells(I + 7, 61).value & "',
  180. N'" & xlSheet.Cells(I + 7, 62).value & "',N'" & xlSheet.Cells(I + 7, 63).value & "',N'" & xlSheet.Cells(I + 7, 64).value & "',
  181. N'" & xlSheet.Cells(I + 7, 65).value & "',N'" & xlSheet.Cells(I + 7, 66).value & "',N'" & xlSheet.Cells(I + 7, 67).value & "',
  182. N'" & xlSheet.Cells(I + 7, 68).value & "',N'" & xlSheet.Cells(I + 7, 69).value & "',N'" & xlSheet.Cells(I + 7, 70).value & "',
  183. N'" & xlSheet.Cells(I + 7, 71).value & "',N'" & xlSheet.Cells(I + 7, 72).value & "',N'" & xlSheet.Cells(I + 7, 73).value & "',
  184. N'" & xlSheet.Cells(I + 7, 74).value & "',N'" & xlSheet.Cells(I + 7, 75).value & "',N'" & xlSheet.Cells(I + 7, 76).value & "',
  185. N'" & xlSheet.Cells(I + 7, 77).value & "',N'" & xlSheet.Cells(I + 7, 78).value & "',N'" & xlSheet.Cells(I + 7, 79).value & "',
  186. N'" & xlSheet.Cells(I + 7, 80).value & "',N'" & xlSheet.Cells(I + 7, 81).value & "',N'" & xlSheet.Cells(I + 7, 82).value & "',
  187. N'" & xlSheet.Cells(I + 7, 83).value & "',N'" & xlSheet.Cells(I + 7, 84).value & "',N'" & xlSheet.Cells(I + 7, 85).value & "',
  188. N'" & xlSheet.Cells(I + 7, 86).value & "',N'" & xlSheet.Cells(I + 7, 87).value & "',N'" & xlSheet.Cells(I + 7, 88).value & "',
  189. N'" & xlSheet.Cells(I + 7, 89).value & "'),"
  190. If (I <> 0 And I Mod 100 = 0) Or IsNothing(xlSheet.Cells(I + 7, 1).value) = True Then : MyModule1.進度條()
  191. If Not String.IsNullOrEmpty(SQL2) AndAlso SQL2.Length > 0 Then : SQL2 = SQL2.Substring(0, SQL2.Length - 1) : End If
  192. ConnOpen()
  193. SQL1 = "INSERT INTO 人事拆帳制薪資報表明細_仁寶 (流水號, 序, 員工編號, 分類, 姓名, 主責督導, B碼時薪, G碼_S碼時薪, 平日排班轉場時間_分,
  194. 假日排班轉場時間_分, 平日轉場時薪, 假日轉場時薪, 平日轉場費, 假日轉場費, 服務時間_分, 平日班時數_分, 本薪,
  195. 加班時數_分, 加班費, B平日0_2小時, B平日3_8小時, B平日9_10小時, B平日11_12小時, B國假0_2小時,
  196. B國假3_8小時, B國假9_10小時, B國假11_12小時, B例假0_2小時, B例假3_8小時, B例假9_10小時, B例假11_12小時,
  197. B休假0_2小時, B休假3_8小時, B休假9_10小時, B休假11_12小時, B平日0_2薪資, B平日3_8薪資, B平日9_10薪資,
  198. B平日11_12薪資, B國假0_2薪資, B國假3_8薪資, B國假9_10薪資, B國假11_12薪資, B例假0_2薪資, B例假3_8薪資,
  199. B例假9_10薪資, B例假11_12薪資, B休假0_2薪資, B休假3_8薪資, B休假9_10薪資, B休假11_12薪資, B碼總計,
  200. GS平日0_2小時, GS平日3_8小時, GS平日9_10小時, GS平日11_12小時, GS國假0_2小時, GS國假3_8小時,
  201. GS國假9_10小時, GS國假11_12小時, GS例假0_2小時, GS例假3_8小時, GS例假9_10小時, GS例假11_12小時,
  202. GS休假0_2小時, GS休假3_8小時, GS休假9_10小時, GS休假11_12小時, GS平日0_2薪資, GS平日3_8薪資,
  203. GS平日9_10薪資, GS平日11_12薪資, GS國假0_2薪資, GS國假3_8薪資, GS國假9_10薪資, GS國假11_12薪資,
  204. GS例假0_2薪資, GS例假3_8薪資, GS例假9_10薪資, GS例假11_12薪資, GS休假0_2薪資, GS休假3_8薪資,
  205. GS休假9_10薪資, GS休假11_12薪資, GS碼總計, 服務紀錄B碼金額, 服務紀錄GS碼金額, 服務紀錄BGS碼金額)
  206. VALUES " & SQL2
  207. CmdSet_For_dr() : SQL2 = ""
  208. If IsNothing(xlSheet.Cells(I + 7, 1).value) = True Then : Exit For : End If
  209. End If
  210. Next : xlApp.Visible = True : xlApp.Quit() : xlApp = Nothing
  211. End If
  212. '----------每 日 明 細-----------------------------------------------------------------------------------------------------------------------------------------------
  213. If 路徑4_tb.Text <> "" Then
  214. file_name = 路徑4_tb.Text : xlApp = CreateObject("Excel.Application") : xlApp.DisplayAlerts = False : xlApp.Visible = False : xlApp.Workbooks.Open(file_name)
  215. xlSheet = xlApp.Worksheets(1) : xlSheet.Activate()
  216. ConnOpen() : SQL1 = "DELETE 人事拆帳制每日明細_仁寶 WHERE 流水號 LIKE N'" & 年份_cb.Text & 月份_cb.Text & "%'" : CmdSet_For_dr() : Dim DSF(7) As String
  217. SQL2 = ""
  218. For I As Integer = 0 To 10000 : MyModule1.進度條()
  219. DSF(0) = I + 1
  220. If IsNothing(xlSheet.Cells(I + 7, 2).value) = False Then : DSF(1) = xlSheet.Cells(I + 7, 2).value : End If
  221. If IsNothing(xlSheet.Cells(I + 7, 3).value) = False Then : DSF(2) = xlSheet.Cells(I + 7, 3).value : End If
  222. If IsNothing(xlSheet.Cells(I + 7, 4).value) = False Then : DSF(3) = xlSheet.Cells(I + 7, 4).value : End If
  223. If IsNothing(xlSheet.Cells(I + 7, 5).value) = False Then : DSF(4) = xlSheet.Cells(I + 7, 5).value : End If
  224. If IsNothing(xlSheet.Cells(I + 7, 6).value) = False Then : DSF(5) = xlSheet.Cells(I + 7, 6).value : End If
  225. If IsNothing(xlSheet.Cells(I + 7, 7).value) = False Then : DSF(6) = xlSheet.Cells(I + 7, 7).value : End If
  226. If IsNothing(xlSheet.Cells(I + 7, 8).value) = False Then : DSF(7) = xlSheet.Cells(I + 7, 8).value : End If
  227. SQL2 &= "(N'" & 年份_cb.Text & 月份_cb.Text & "',N'" & DSF(0) & "',N'" & DSF(1) & "', N'" & DSF(2) & "',N'" & DSF(3) & "',N'" & DSF(4) & "',
  228. N'" & DSF(5) & "',N'" & DSF(6) & "',N'" & DSF(7) & "',
  229. N'" & xlSheet.Cells(I + 7, 9).value & "',N'" & xlSheet.Cells(I + 7, 11).value & "',N'" & xlSheet.Cells(I + 7, 12).value & "',
  230. N'" & xlSheet.Cells(I + 7, 14).value & "',N'" & xlSheet.Cells(I + 7, 15).value & "',N'" & xlSheet.Cells(I + 7, 16).value & "',
  231. N'" & xlSheet.Cells(I + 7, 17).value & "',N'" & xlSheet.Cells(I + 7, 18).value & "',N'" & xlSheet.Cells(I + 7, 19).value & "',
  232. N'" & xlSheet.Cells(I + 7, 20).value & "',N'" & xlSheet.Cells(I + 7, 21).value & "',N'" & xlSheet.Cells(I + 7, 22).value & "',
  233. N'" & xlSheet.Cells(I + 7, 23).value & "'),"
  234. If (I <> 0 And I Mod 100 = 0) Or IsNothing(xlSheet.Cells(I + 7, 15).value) = True Then : MyModule1.進度條()
  235. If Not String.IsNullOrEmpty(SQL2) AndAlso SQL2.Length > 0 Then : SQL2 = SQL2.Substring(0, SQL2.Length - 1) : End If
  236. ConnOpen()
  237. SQL1 = "INSERT INTO 人事拆帳制每日明細_仁寶 (流水號, 序, 員工編號, 分類, 姓名, 主責督導, B碼時薪, G碼S碼時薪, 日期, 排班轉場時間_分,
  238. 交通時間小計_分, 轉場時薪, 轉場費, 加班類型, 服務個案, 個案主責督導, 身分別, 服務時間_分, 平日班時數_分, 本薪,
  239. 加班時數_分, 加班費)
  240. VALUES " & SQL2
  241. CmdSet_For_dr() : SQL2 = ""
  242. If IsNothing(xlSheet.Cells(I + 7, 15).value) = True Then : Exit For : End If
  243. End If
  244. Next : xlApp.Visible = True : xlApp.Quit() : xlApp = Nothing
  245. End If
  246. '----------個 案 總 表-----------------------------------------------------------------------------------------------------------------------------------------------
  247. If 路徑5_tb.Text <> "" Then
  248. file_name = 路徑5_tb.Text : xlApp = CreateObject("Excel.Application") : xlApp.DisplayAlerts = False : xlApp.Visible = False : xlApp.Workbooks.Open(file_name)
  249. xlSheet = xlApp.Worksheets(1) : xlSheet.Activate()
  250. ConnOpen() : SQL1 = "DELETE 人事拆帳總表 WHERE 流水 LIKE N'" & 年份_cb.Text & 月份_cb.Text & "%'" : CmdSet_For_dr() : Dim DSF(7) As String
  251. SQL2 = ""
  252. For I As Integer = 0 To 10000 : MyModule1.進度條()
  253. SQL2 &= "(N'" & 年份_cb.Text & 月份_cb.Text & "',N'" & xlSheet.Cells(I + 4, 1).value & "',N'" & xlSheet.Cells(I + 4, 2).value & "',
  254. N'" & xlSheet.Cells(I + 4, 3).value & "',N'" & xlSheet.Cells(I + 4, 4).value & "',N'" & xlSheet.Cells(I + 4, 5).value & "',
  255. N'" & xlSheet.Cells(I + 4, 6).value & "',N'" & xlSheet.Cells(I + 4, 7).value & "',N'" & xlSheet.Cells(I + 4, 8).value & "',
  256. N'" & xlSheet.Cells(I + 4, 9).value & "',N'" & xlSheet.Cells(I + 4, 10).value & "',N'" & xlSheet.Cells(I + 4, 11).value & "',
  257. N'" & xlSheet.Cells(I + 4, 12).value & "',N'" & xlSheet.Cells(I + 4, 13).value & "',N'" & xlSheet.Cells(I + 4, 14).value & "',
  258. N'" & xlSheet.Cells(I + 4, 15).value & "',N'" & xlSheet.Cells(I + 4, 16).value & "',N'" & xlSheet.Cells(I + 4, 17).value & "',
  259. N'" & xlSheet.Cells(I + 4, 18).value & "',N'" & xlSheet.Cells(I + 4, 19).value & "',N'" & xlSheet.Cells(I + 4, 20).value & "',
  260. N'" & xlSheet.Cells(I + 4, 21).value & "',N'" & xlSheet.Cells(I + 4, 22).value & "',N'" & xlSheet.Cells(I + 4, 23).value & "',
  261. N'" & xlSheet.Cells(I + 4, 24).value & "',N'" & xlSheet.Cells(I + 4, 25).value & "',N'" & xlSheet.Cells(I + 4, 26).value & "',
  262. N'" & xlSheet.Cells(I + 4, 27).value & "',N'" & xlSheet.Cells(I + 4, 28).value & "',N'" & xlSheet.Cells(I + 4, 29).value & "',
  263. N'" & xlSheet.Cells(I + 4, 30).value & "',N'" & xlSheet.Cells(I + 4, 31).value & "',N'" & xlSheet.Cells(I + 4, 33).value & "',
  264. N'" & xlSheet.Cells(I + 4, 34).value & "',N'" & xlSheet.Cells(I + 4, 35).value & "',N'" & xlSheet.Cells(I + 4, 36).value & "',
  265. N'" & xlSheet.Cells(I + 4, 37).value & "',N'" & xlSheet.Cells(I + 4, 38).value & "',N'" & xlSheet.Cells(I + 4, 39).value & "',
  266. N'" & xlSheet.Cells(I + 4, 40).value & "',N'" & xlSheet.Cells(I + 4, 41).value & "',N'" & xlSheet.Cells(I + 4, 42).value & "',
  267. N'" & xlSheet.Cells(I + 4, 43).value & "',N'" & xlSheet.Cells(I + 4, 44).value & "',N'" & xlSheet.Cells(I + 4, 45).value & "',
  268. N'" & xlSheet.Cells(I + 4, 46).value & "',N'" & xlSheet.Cells(I + 4, 47).value & "',N'" & xlSheet.Cells(I + 4, 48).value & "',
  269. N'" & xlSheet.Cells(I + 4, 49).value & "',N'" & xlSheet.Cells(I + 4, 50).value & "',N'" & xlSheet.Cells(I + 4, 51).value & "',
  270. N'" & xlSheet.Cells(I + 4, 52).value & "',N'" & xlSheet.Cells(I + 4, 53).value & "',N'" & xlSheet.Cells(I + 4, 54).value & "',
  271. N'" & xlSheet.Cells(I + 4, 55).value & "',N'" & xlSheet.Cells(I + 4, 56).value & "',N'" & xlSheet.Cells(I + 4, 57).value & "',
  272. N'" & xlSheet.Cells(I + 4, 58).value & "',N'" & xlSheet.Cells(I + 4, 59).value & "',N'" & xlSheet.Cells(I + 4, 60).value & "',
  273. N'" & xlSheet.Cells(I + 4, 61).value & "',N'" & xlSheet.Cells(I + 4, 62).value & "',N'" & xlSheet.Cells(I + 4, 63).value & "',
  274. N'" & xlSheet.Cells(I + 4, 64).value & "',N'" & xlSheet.Cells(I + 4, 65).value & "',N'" & xlSheet.Cells(I + 4, 66).value & "',
  275. N'" & xlSheet.Cells(I + 4, 67).value & "',N'" & xlSheet.Cells(I + 4, 68).value & "',N'" & xlSheet.Cells(I + 4, 69).value & "',
  276. N'" & xlSheet.Cells(I + 4, 70).value & "',N'" & xlSheet.Cells(I + 4, 71).value & "',N'" & xlSheet.Cells(I + 4, 72).value & "',
  277. N'" & xlSheet.Cells(I + 4, 73).value & "',N'" & xlSheet.Cells(I + 4, 74).value & "',N'" & xlSheet.Cells(I + 4, 75).value & "',
  278. N'" & xlSheet.Cells(I + 4, 76).value & "',N'" & xlSheet.Cells(I + 4, 77).value & "',N'" & xlSheet.Cells(I + 4, 78).value & "',
  279. N'" & xlSheet.Cells(I + 4, 79).value & "',N'" & xlSheet.Cells(I + 4, 80).value & "',N'" & xlSheet.Cells(I + 4, 81).value & "',
  280. N'" & xlSheet.Cells(I + 4, 84).value & "',N'" & xlSheet.Cells(I + 4, 85).value & "',N'" & xlSheet.Cells(I + 4, 86).value & "',
  281. N'" & xlSheet.Cells(I + 4, 87).value & "',N'" & xlSheet.Cells(I + 4, 88).value & "',N'" & xlSheet.Cells(I + 4, 89).value & "',
  282. N'" & xlSheet.Cells(I + 4, 90).value & "',N'" & xlSheet.Cells(I + 4, 91).value & "',N'" & xlSheet.Cells(I + 4, 92).value & "',
  283. N'" & xlSheet.Cells(I + 4, 93).value & "',N'" & xlSheet.Cells(I + 4, 94).value & "',N'" & xlSheet.Cells(I + 4, 95).value & "',
  284. N'" & xlSheet.Cells(I + 4, 96).value & "',N'" & xlSheet.Cells(I + 4, 97).value & "',N'" & xlSheet.Cells(I + 4, 98).value & "',
  285. N'" & xlSheet.Cells(I + 4, 99).value & "',N'" & xlSheet.Cells(I + 4, 100).value & "',N'" & xlSheet.Cells(I + 4, 101).value & "',
  286. N'" & xlSheet.Cells(I + 4, 102).value & "',N'" & xlSheet.Cells(I + 4, 103).value & "',N'" & xlSheet.Cells(I + 4, 104).value & "',
  287. N'" & xlSheet.Cells(I + 4, 105).value & "',N'" & xlSheet.Cells(I + 4, 106).value & "',N'" & xlSheet.Cells(I + 4, 107).value & "',
  288. N'" & xlSheet.Cells(I + 4, 108).value & "',N'" & xlSheet.Cells(I + 4, 109).value & "',N'" & xlSheet.Cells(I + 4, 110).value & "',
  289. N'" & xlSheet.Cells(I + 4, 111).value & "',N'" & xlSheet.Cells(I + 4, 112).value & "',N'" & xlSheet.Cells(I + 4, 113).value & "',
  290. N'" & xlSheet.Cells(I + 4, 121).value & "',N'" & xlSheet.Cells(I + 4, 122).value & "',N'" & xlSheet.Cells(I + 4, 123).value & "',
  291. N'" & xlSheet.Cells(I + 4, 124).value & "',N'" & xlSheet.Cells(I + 4, 125).value & "',N'" & xlSheet.Cells(I + 4, 126).value & "',
  292. N'" & xlSheet.Cells(I + 4, 127).value & "',N'" & xlSheet.Cells(I + 4, 128).value & "',N'" & xlSheet.Cells(I + 4, 129).value & "',
  293. N'" & xlSheet.Cells(I + 4, 130).value & "',N'" & xlSheet.Cells(I + 4, 131).value & "',N'" & xlSheet.Cells(I + 4, 132).value & "'),"
  294. If (I <> 0 And I Mod 100 = 0) Or IsNothing(xlSheet.Cells(I + 4, 1).value) = True Then : MyModule1.進度條()
  295. If Not String.IsNullOrEmpty(SQL2) AndAlso SQL2.Length > 0 Then : SQL2 = SQL2.Substring(0, SQL2.Length - 1) : End If
  296. ConnOpen()
  297. SQL1 = "INSERT INTO 人事拆帳總表 (流水, 編號, 目前狀態, 個案來源, 案號, 衛福案號, 分類, 姓名, 性別, 出生年月日, 年齡, 身分證字號, 電話,
  298. 身高, 體重, 小腿圍, 原住民身份, 原住民族別, 常用語言, CMS等級, 福利身份別, 補助比例, 計價類別, 失能等級,
  299. 障礙等級, 請外勞照護或領有特照津貼, 身障類別_新制, 身障類別_舊制, 身障項目別,
  300. 是否具備身心障礙失智症手冊or證明或CDR1分以上, 主要照顧者, 主要照顧者關係, 次要照顧者, 次要照顧者關係,
  301. 主責督導, 副督導, 主責居服員, 代理人, 代理人電話, 代理人手機號碼, 代理人地址, 個案戶籍縣市, 鄉鎮區, 里別,
  302. 個案戶籍地址, 個案居住縣市, 鄉鎮區1, 里別1, 個案居住地址, 居住狀況, 帳單地址, 個案教育程度, 罹患疾病, 疾病史,
  303. 行為與情緒, 申請服務種類, 備註, 服務開始時間, 暫停日期, 暫停備註, 結案日期, 結案原因, 結案備註,
  304. 機構到案家距離, 護照號碼, 國籍, 性別1, 工作縣市, 核准招募文號, 最新聘僱函文號, 聘僱函核准日期, 工作起始日,
  305. 契約期滿日, 建立日期, A單位名稱, A個管姓名, 聯絡電話, 電子郵件, 給付額度, 計價類別1,
  306. 請外勞照護或領有特照津貼1, 排班時數, 居服員, 服務項目總數_補助, 服務項目總數_自費, 補助人次, 自費人次,
  307. 服務天數, 服務項目, 服務總次數, 服務總次數_補助, 服務總次數_自費, 使用額度, 補助金額, 民眾負擔, 自費,
  308. 民眾總花費, 服務項目1, 服務次數1, 使用額度1, 補助金額1, 民眾負擔1, 自費1, 民眾總花費1, 服務項目2, 服務次數2,
  309. 使用額度2, 補助金額2, 民眾負擔2, 自費2, 民眾總花費2, 服務次數3, 給付價格3, 服務次數4, 給付價格4, 服務項目5,
  310. 服務次數5, 使用額度5, 補助金額5, 民眾負擔5, 自費5, 民眾總花費5, 照顧計畫)
  311. VALUES " & SQL2
  312. CmdSet_For_dr() : SQL2 = ""
  313. If IsNothing(xlSheet.Cells(I + 4, 1).value) = True Then : Exit For : End If
  314. End If
  315. Next : xlApp.Visible = True : xlApp.Quit() : xlApp = Nothing
  316. End If
  317. '----------A碼項目清冊-----------------------------------------------------------------------------------------------------------------------------------------------
  318. If 路徑6_tb.Text <> "" Then
  319. file_name = 路徑6_tb.Text : xlApp = CreateObject("Excel.Application") : xlApp.DisplayAlerts = False : xlApp.Visible = False : xlApp.Workbooks.Open(file_name)
  320. xlSheet = xlApp.Worksheets(1) : xlSheet.Activate()
  321. ConnOpen() : SQL1 = "DELETE 人事拆帳制A碼項目清冊 WHERE 流水號 LIKE N'" & 年份_cb.Text & 月份_cb.Text & "%'" : CmdSet_For_dr()
  322. SQL2 = ""
  323. For I As Integer = 0 To 10000 : MyModule1.進度條()
  324. SQL2 &= "(N'" & 年份_cb.Text & 月份_cb.Text & "',N'" & xlSheet.Cells(I + 5, 1).value & "',N'" & xlSheet.Cells(I + 5, 2).value & "',
  325. N'" & xlSheet.Cells(I + 5, 3).value & "',N'" & xlSheet.Cells(I + 5, 4).value & "',N'" & xlSheet.Cells(I + 5, 5).value & "',
  326. N'" & xlSheet.Cells(I + 5, 6).value & "',N'" & xlSheet.Cells(I + 5, 7).value & "',N'" & xlSheet.Cells(I + 5, 8).value & "',
  327. N'" & xlSheet.Cells(I + 5, 9).value & "',N'" & xlSheet.Cells(I + 5, 10).value & "',N'" & xlSheet.Cells(I + 5, 11).value & "',
  328. N'" & xlSheet.Cells(I + 5, 12).value & "',N'" & xlSheet.Cells(I + 5, 13).value & "',N'" & xlSheet.Cells(I + 5, 14).value & "',
  329. N'" & xlSheet.Cells(I + 5, 15).value & "',N'" & xlSheet.Cells(I + 5, 16).value & "',N'" & xlSheet.Cells(I + 5, 17).value & "',
  330. N'" & xlSheet.Cells(I + 5, 18).value & "'),"
  331. If (I <> 0 And I Mod 100 = 0) Or IsNothing(xlSheet.Cells(I + 5, 1).value) = True Then : MyModule1.進度條()
  332. If Not String.IsNullOrEmpty(SQL2) AndAlso SQL2.Length > 0 Then : SQL2 = SQL2.Substring(0, SQL2.Length - 1) : End If
  333. ConnOpen()
  334. SQL1 = "INSERT INTO 人事拆帳制A碼項目清冊 (流水號, 序號, 服務代碼, 採用計畫, CMS等級, 服務項目類別, 身分證號, 個案姓名, 給付價格, 數量, 小計,
  335. 服務日期, 服務單位, 服務當下居住縣市, 目前居住縣市, 目前居住行政區, 照管專員, 服務人員, 備註)
  336. VALUES " & SQL2
  337. CmdSet_For_dr() : SQL2 = ""
  338. If IsNothing(xlSheet.Cells(I + 5, 1).value) = True Then : Exit For : End If
  339. End If
  340. Next : xlApp.Visible = True : xlApp.Quit() : xlApp = Nothing
  341. End If
  342. '----------A碼長照所-----------------------------------------------------------------------------------------------------------------------------------------------
  343. If 路徑7_tb.Text <> "" Then
  344. file_name = 路徑7_tb.Text : xlApp = CreateObject("Excel.Application") : xlApp.DisplayAlerts = False : xlApp.Visible = False : xlApp.Workbooks.Open(file_name)
  345. xlSheet = xlApp.Worksheets(1) : xlSheet.Activate()
  346. ConnOpen() : SQL1 = "DELETE 人事拆帳制A碼項目長照所 WHERE 流水號 LIKE N'" & 年份_cb.Text & 月份_cb.Text & "%'" : CmdSet_For_dr()
  347. SQL2 = ""
  348. For I As Integer = 0 To 10000 : MyModule1.進度條()
  349. SQL2 &= "(N'" & 年份_cb.Text & 月份_cb.Text & "',N'" & xlSheet.Cells(I + 5, 1).value & "',N'" & xlSheet.Cells(I + 5, 2).value & "',
  350. N'" & xlSheet.Cells(I + 5, 3).value & "',N'" & xlSheet.Cells(I + 5, 4).value & "',N'" & xlSheet.Cells(I + 5, 5).value & "',
  351. N'" & xlSheet.Cells(I + 5, 6).value & "',N'" & xlSheet.Cells(I + 5, 7).value & "',N'" & xlSheet.Cells(I + 5, 8).value & "',
  352. N'" & xlSheet.Cells(I + 5, 9).value & "',N'" & xlSheet.Cells(I + 5, 10).value & "',N'" & xlSheet.Cells(I + 5, 11).value & "',
  353. N'" & xlSheet.Cells(I + 5, 12).value & "',N'" & xlSheet.Cells(I + 5, 13).value & "',N'" & xlSheet.Cells(I + 5, 14).value & "',
  354. N'" & xlSheet.Cells(I + 5, 15).value & "',N'" & xlSheet.Cells(I + 5, 16).value & "',N'" & xlSheet.Cells(I + 5, 17).value & "',
  355. N'" & xlSheet.Cells(I + 5, 18).value & "'),"
  356. If (I <> 0 And I Mod 100 = 0) Or IsNothing(xlSheet.Cells(I + 5, 1).value) = True Then : MyModule1.進度條()
  357. If Not String.IsNullOrEmpty(SQL2) AndAlso SQL2.Length > 0 Then : SQL2 = SQL2.Substring(0, SQL2.Length - 1) : End If
  358. ConnOpen()
  359. SQL1 = "INSERT INTO 人事拆帳制A碼項目長照所 (流水號, 序號, 服務代碼, 採用計畫, CMS等級, 服務項目類別, 身分證號, 個案姓名, 給付價格, 數量, 小計,
  360. 服務日期, 服務單位, 服務當下居住縣市, 目前居住縣市, 目前居住行政區, 照管專員, 服務人員, 備註)
  361. VALUES " & SQL2
  362. CmdSet_For_dr() : SQL2 = ""
  363. If IsNothing(xlSheet.Cells(I + 5, 1).value) = True Then : Exit For : End If
  364. End If
  365. Next : xlApp.Visible = True : xlApp.Quit() : xlApp = Nothing
  366. End If
  367. MsgBox("導入完成!!") : 最終數 = 0 : ICS_ASMS_ERP_SYS.ToolStripProgressBar1.Value = 最終數
  368. 首次開啟 = True
  369. BBL1 = "" : BBL2 = "" : BBL3 = "" : BBL4 = "" : BBL5 = "" : BBL6 = "" : PA = "" : PA1 = "" : PA2 = "" : PA3 = "" : PA4 = "" : PA5 = "" : PA6 = "" : PA7 = "" : PA8 = "" : PA9 = ""
  370. PA10 = "" : PA11 = "" : PA12 = "" : PA13 = "" : PA14 = "" : PA15 = "" : PA16 = "" : PA17 = "" : PA18 = "" : PA19 = "" : PA20 = "" : PA21 = "" : PA22 = "" : PA23 = "" : PA24 = ""
  371. PA25 = "" : PA26 = "" : PA27 = "" : PA28 = "" : PA29 = "" : PA30 = "" : PA31 = "" : PA32 = "" : PA33 = "" : PA34 = "" : PA35 = "" : PA36 = "" : PA37 = "" : PA38 = "" : PA39 = ""
  372. PA40 = "" : PA41 = "" : PA42 = "" : PA43 = "" : PA44 = "" : PA45 = "" : PA46 = "" : PA47 = "" : DTP = "" : DTP1 = "" : DTP2 = ""
  373. DTP3 = "" : 列印用SQL = ""
  374. 拆帳制薪資試算表.Show() : Me.Close()
  375. Else : MsgBox("請先選擇日期!!") : End If
  376. End Sub
  377. End Class