123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410 |
- Option Strict Off
- Imports System.Net
- Public Class 業務專案控制表
- ReadOnly ds, ds1, ds2 As New DataSet
- Dim DTP(2) As String
- Private Sub DGV1讀取前設定()
- DataGridView1.DataSource = Nothing : ds.Clear()
- DataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
- DataGridView1.ColumnHeadersHeight = 50
- DataGridView1.AllowUserToAddRows = False
- ConnOpen()
- End Sub
- Private Sub DGV1讀取後設定()
- CmdSet_For_DGV() : da.Fill(ds) : DataGridView1.DataSource = ds.Tables(0) : conn.Close() : Set_grid1()
- End Sub
- Private Sub 讀取專案主檔()
- DGV1讀取前設定()
- If PA = "" Then
- SQL1 = "SELECT 專案流水號, 專案內容, 專案性質, 合約性質, 備註, 專案人數 AS 執行人數, 執行天數, 地點, 報價, 報價日期, 專案成本 AS 報價金額, 立案, 立案日期, 收款金額 AS 訂金,
- 結案, 結案日期, 應收金額 AS 應收尾款, 幣別, 建檔, 客戶
- FROM 業務專案主檔 ORDER BY 專案流水號 DESC"
- Else
- SQL1 = "SELECT 專案流水號, 專案內容, 專案性質, 合約性質, 備註, 專案人數 AS 執行人數, 執行天數, 地點, 報價, 報價日期, 專案成本 AS 報價金額, 立案, 立案日期, 收款金額 AS 訂金,
- 結案, 結案日期, 應收金額 AS 應收尾款, 幣別, 建檔, 客戶
- FROM 業務專案主檔
- WHERE 專案流水號 LIKE N'%" & PA & "%' OR 專案內容 LIKE N'%" & PA & "%' OR 專案人數 LIKE N'%" & PA & "%' OR 執行天數 LIKE N'%" & PA & "%' OR 地點 LIKE N'%" & PA & "%' OR
- 立案日期 LIKE N'%" & PA & "%' OR 結案日期 LIKE N'%" & PA & "%' OR 備註 LIKE N'%" & PA & "%' OR 結案 LIKE N'%" & PA & "%'
- ORDER BY 專案流水號 DESC"
- End If
- DGV1讀取後設定()
- End Sub
- Private Sub Set_grid1()
- DataGridView1.Columns(0).Width = 90 : DataGridView1.Columns(1).Width = 300 : DataGridView1.Columns(2).Width = 70 : DataGridView1.Columns(3).Width = 70
- DataGridView1.Columns(4).Width = 350 : DataGridView1.Columns(5).Width = 40 : DataGridView1.Columns(6).Width = 40 : DataGridView1.Columns(7).Width = 100
- DataGridView1.Columns(8).Width = 50 : DataGridView1.Columns(9).Width = 80 : DataGridView1.Columns(10).Width = 90 : DataGridView1.Columns(11).Width = 50
- DataGridView1.Columns(12).Width = 80 : DataGridView1.Columns(13).Width = 90 : DataGridView1.Columns(14).Width = 50 : DataGridView1.Columns(15).Width = 80
- DataGridView1.Columns(16).Width = 90 : DataGridView1.Columns(17).Width = 60 : DataGridView1.Columns(18).Visible = False : DataGridView1.Columns(19).Width = 85
-
- DataGridView1.Columns(5).DefaultCellStyle.Format = "#,##0" : DataGridView1.Columns(6).DefaultCellStyle.Format = "#,##0" : DataGridView1.Columns(10).DefaultCellStyle.Format = "#,##0"
- DataGridView1.Columns(13).DefaultCellStyle.Format = "#,##0" : DataGridView1.Columns(16).DefaultCellStyle.Format = "#,##0"
- DataGridView1.Columns(5).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight : DataGridView1.Columns(5).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleRight
- DataGridView1.Columns(6).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight : DataGridView1.Columns(6).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleRight
- DataGridView1.Columns(10).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight : DataGridView1.Columns(10).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleRight
- DataGridView1.Columns(13).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight : DataGridView1.Columns(13).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleRight
- DataGridView1.Columns(16).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight : DataGridView1.Columns(16).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleRight
-
- For i As Integer = 0 To DataGridView1.Rows.Count - 1
- If DataGridView1.Rows(i).Cells("報價").Value Is DBNull.Value Then : DataGridView1.Rows(i).Cells("報價").Value = False : End If
- If DataGridView1.Rows(i).Cells("立案").Value Is DBNull.Value Then : DataGridView1.Rows(i).Cells("立案").Value = False : End If
- If DataGridView1.Rows(i).Cells("結案").Value Is DBNull.Value Then : DataGridView1.Rows(i).Cells("結案").Value = False : End If
- If DataGridView1.Rows(i).Cells("建檔").Value Is DBNull.Value Then : DataGridView1.Rows(i).Cells("建檔").Value = False : End If
-
- If DataGridView1.Rows(i).Cells("立案").Value = False Then
- DataGridView1.Rows(i).Cells("執行天數").Value = 0
- ElseIf DataGridView1.Rows(i).Cells("立案").Value = True And (DataGridView1.Rows(i).Cells("結案日期").Value.ToString = "" Or DataGridView1.Rows(i).Cells("結案日期").Value.ToString = " ") Then
- DataGridView1.Rows(i).Cells("執行天數").Value = DateDiff("d", DataGridView1.Rows(i).Cells("立案日期").Value, Format(Today(), "yyyy/MM/dd")) + 1
- ElseIf DataGridView1.Rows(i).Cells("立案").Value = True And (DataGridView1.Rows(i).Cells("結案日期").Value.ToString <> "" Or DataGridView1.Rows(i).Cells("結案日期").Value.ToString <> " ") Then
- DataGridView1.Rows(i).Cells("執行天數").Value = DateDiff("d", DataGridView1.Rows(i).Cells("立案日期").Value, DataGridView1.Rows(i).Cells("結案日期").Value) + 1
- End If
- Next i
- End Sub
- Private Sub DGV3讀取前設定()
- DataGridView3.DataSource = Nothing : ds2.Clear()
- DataGridView3.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
- DataGridView3.ColumnHeadersHeight = 25
- DataGridView3.AllowUserToAddRows = False
- ConnOpen()
- End Sub
- Private Sub DGV3讀取後設定()
- CmdSet_For_DGV() : da.Fill(ds2) : DataGridView3.DataSource = ds2.Tables(0) : conn.Close() : Set_grid3()
- End Sub
- Private Sub 讀取專案人事資料()
- DGV3讀取前設定()
- SQL1 = "SELECT 人員資料.姓名, 人員資料.性別, 人員資料.薪資結構, 人員資料.月薪 / 25 AS 月薪, 人員資料.日薪, 人員資料.時薪 * 8 AS 時薪, 業務專案清單.專案流水號, 業務專案清單.對應流水號
- FROM 業務專案清單 INNER JOIN 人員資料 ON 業務專案清單.對應流水號 = 人員資料.人員編號
- WHERE (業務專案清單.專案流水號 = '" & TextBox1.Text & "')"
- DGV3讀取後設定()
- End Sub
- Private Sub Set_grid3()
- DataGridView3.Columns(0).Width = 90 : DataGridView3.Columns(1).Width = 80 : DataGridView3.Columns(2).Visible = False
- DataGridView3.Columns(3).Visible = False : DataGridView3.Columns(4).Visible = False : DataGridView3.Columns(5).Visible = False
- DataGridView3.Columns(6).Visible = False : DataGridView3.Columns(7).Visible = False
- End Sub
- Private Sub DGV2讀取前設定()
- DataGridView2.DataSource = Nothing : ds1.Clear() : ds1.Reset()
- DataGridView2.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
- DataGridView2.ColumnHeadersHeight = 25
- DataGridView2.AllowUserToAddRows = False
- ConnOpen()
- End Sub
- Private Sub DGV2讀取後設定()
- CmdSet_For_DGV() : da.Fill(ds1) : DataGridView2.DataSource = ds1.Tables(0) : conn.Close() : Set_grid2()
- End Sub
- Private Sub 員工資料()
- DGV2讀取前設定()
- If PA = "" Then
- SQL1 = "SELECT 人員編號, 姓名, 性別, 出生年份, 手機, 薪資結構 FROM 人員資料"
- Else
- SQL1 = "SELECT 人員編號, 姓名, 性別, 出生年份, 手機, 薪資結構 FROM 人員資料 WHERE 人員編號 LIKE N'%" & PA & "%' OR 姓名 LIKE N'%" & PA & "%' OR 性別 LIKE N'%" & PA & "%' " &
- "OR 籍貫 LIKE N'%" & PA & "%' OR 出生年份 LIKE N'%" & PA & "%' OR 證件 LIKE N'%" & PA & "%' OR 証號 LIKE N'%" & PA & "%' OR 手機 LIKE N'%" & PA & "%' " &
- "OR 薪資結構 LIKE N'%" & PA & "%' OR 薪資 LIKE N'%" & PA & "%' OR 備註 LIKE N'%" & PA & "%'"
- End If
- DGV2讀取後設定()
- End Sub
- Private Sub Set_grid2()
- DataGridView2.Columns(0).Width = 80 : DataGridView2.Columns(1).Width = 70 : DataGridView2.Columns(2).Width = 50
- DataGridView2.Columns(3).Visible = False : DataGridView2.Columns(4).Width = 100 : DataGridView2.Columns(5).Visible = False
- End Sub
- Private Sub ComboBox2下拉表單資料載入()
- conn.Close()
- ConnOpen()
- SQL1 = "SELECT 客户 FROM 客戶清單 ORDER BY 客户"
- CmdSet_For_dr()
- ComboBox2.Items.Clear()
- While (dr.Read()) : ComboBox2.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
- TextBox5.Visible = False : TextBox6.Enabled = False : TextBox7.Enabled = False : TextBox8.Visible = False
- TextBox11.Text = "0.00" : TextBox12.Text = "0.00" : TextBox13.Text = "0.00" : TextBox16.Text = "0"
- 讀取專案主檔() : 員工資料() : ComboBox2下拉表單資料載入()
- Target1 = Target & AA(4) & "/"
- WebBrowser3.Url = New Uri(Target1)
- If FolderBrowserDialog1.ShowDialog = DialogResult.OK Then
- WebBrowser1.Navigate(FolderBrowserDialog1.SelectedPath)
- End If
- 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 DataGridView1_RowPostPaint(ByVal sender As Object, ByVal e As DataGridViewRowPostPaintEventArgs) Handles DataGridView1.RowPostPaint
- Dim linePen As New Pen(Color.Blue, 2)
- If e.RowIndex = DataGridView1.Rows.Count - 1 Then
- Exit Sub
- Else
- If DataGridView1.Rows(e.RowIndex).Cells("立案").Value = True And DataGridView1.Rows(e.RowIndex).Cells("結案").Value = False Then
- Dim startX As Integer = IIf(DataGridView1.RowHeadersVisible, DataGridView1.RowHeadersWidth, 0)
- Dim startY As Integer = e.RowBounds.Top + e.RowBounds.Height - 1
- Dim endX As Integer = startX + DataGridView1.Columns.GetColumnsWidth(DataGridViewElementStates.Visible) - DataGridView1.HorizontalScrollingOffset
- e.Graphics.DrawLine(linePen, startX, startY, endX, startY)
- Exit Sub
- End If
- End If
- For i As Integer = 0 To DataGridView1.Rows.Count - 1
- If DataGridView1.Rows(i).Cells("幣別").Value.ToString = "TWD" Then
- DataGridView1.Rows(i).DefaultCellStyle.BackColor = Color.LightPink
- ElseIf DataGridView1.Rows(i).Cells("幣別").Value.ToString = "USD" Then
- DataGridView1.Rows(i).DefaultCellStyle.BackColor = Color.LightGreen
- ElseIf DataGridView1.Rows(i).Cells("幣別").Value.ToString = "RMB" Then
- DataGridView1.Rows(i).DefaultCellStyle.BackColor = Color.LightGoldenrodYellow
- ElseIf DataGridView1.Rows(i).Cells("幣別").Value.ToString = "HKD" Then
- DataGridView1.Rows(i).DefaultCellStyle.BackColor = Color.DarkBlue
- End If
- Next
- End Sub
-
- Private Sub DataGridView3_CellClick(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles DataGridView3.CellClick
- If e.RowIndex = -1 Then : Else
- TextBox8.Text = DataGridView3.Rows(e.RowIndex).Cells("專案流水號").Value
- TextBox7.Text = DataGridView3.Rows(e.RowIndex).Cells("對應流水號").Value
- End If
- End Sub
- Private Sub DataGridView2_CellClick(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles DataGridView2.CellClick
- If e.RowIndex = -1 Then : Else
- TextBox6.Text = DataGridView2(0, e.RowIndex).Value.ToString
- End If
- End Sub
- Private Sub DataGridView1_CellClick(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles DataGridView1.CellClick
- If e.RowIndex = -1 Then : Else
- ComboBox2下拉表單資料載入()
- TextBox1.Text = DataGridView1.Rows(e.RowIndex).Cells("專案流水號").Value : TextBox2.Text = DataGridView1.Rows(e.RowIndex).Cells("專案內容").Value
- TextBox3.Text = DataGridView1.Rows(e.RowIndex).Cells("地點").Value : TextBox4.Text = DataGridView1.Rows(e.RowIndex).Cells("備註").Value
- TextBox16.Text = DataGridView1.Rows(e.RowIndex).Cells("執行天數").Value
- ComboBox3.Text = DataGridView1.Rows(e.RowIndex).Cells("專案性質").Value.ToString : ComboBox4.Text = DataGridView1.Rows(e.RowIndex).Cells("合約性質").Value.ToString
- ComboBox5.Text = DataGridView1.Rows(e.RowIndex).Cells("幣別").Value.ToString
-
- PA2 = DataGridView1.Rows(e.RowIndex).Cells("客戶").Value.ToString : ComboBox2.Text = DataGridView1.Rows(e.RowIndex).Cells("客戶").Value.ToString
-
- CheckBox10.Checked = DataGridView1.Rows(e.RowIndex).Cells("報價").Value
- DTP(2) = DataGridView1.Rows(e.RowIndex).Cells("報價日期").Value.ToString
- If DTP(2) = "" Then : DateTimePicker3.Format = DateTimePickerFormat.Custom : DateTimePicker3.CustomFormat = " "
- Else : DateTimePicker3.Format = DateTimePickerFormat.Short : DateTimePicker3.Text = DTP(2) : DateTimePicker3.Text = DateTimePicker3.Text : End If
- TextBox12.Text = Format(Val(DataGridView1.Rows(e.RowIndex).Cells("報價金額").Value), "#,##0.00")
-
- CheckBox11.Checked = DataGridView1.Rows(e.RowIndex).Cells("立案").Value
- DTP(0) = DataGridView1.Rows(e.RowIndex).Cells("立案日期").Value.ToString
- If DTP(0) = "" Then : DateTimePicker1.Format = DateTimePickerFormat.Custom : DateTimePicker1.CustomFormat = " "
- Else : DateTimePicker1.Format = DateTimePickerFormat.Short : DateTimePicker1.Text = DTP(0) : DateTimePicker1.Text = DateTimePicker1.Text : End If
- TextBox11.Text = Format(Val(DataGridView1.Rows(e.RowIndex).Cells("訂金").Value), "#,##0.00")
-
- CheckBox1.Checked = DataGridView1.Rows(e.RowIndex).Cells("結案").Value
- DTP(1) = DataGridView1.Rows(e.RowIndex).Cells("結案日期").Value.ToString
- If DTP(1) = "" Then : DateTimePicker2.Format = DateTimePickerFormat.Custom : DateTimePicker2.CustomFormat = " "
- Else : DateTimePicker2.Format = DateTimePickerFormat.Short : DateTimePicker2.Text = DTP(1) : DateTimePicker2.Text = DateTimePicker2.Text : End If
- TextBox13.Text = Format(Val(DataGridView1.Rows(e.RowIndex).Cells("應收尾款").Value), "#,##0.00")
-
- 讀取專案人事資料()
- Button5.Enabled = False
- CheckBox12.Checked = DataGridView1.Rows(e.RowIndex).Cells("建檔").Value
- If DataGridView1.Rows(e.RowIndex).Cells("建檔").Value = True Then
- Target1 = Target & AA(4) & "/" & DataGridView1.Rows(e.RowIndex).Cells("專案流水號").Value & "/"
- WebBrowser3.Url = New Uri(Target1)
- Else
- Target1 = Target & AA(4) & "/"
- WebBrowser3.Url = New Uri(Target1)
- End If
-
- ComboBox1.Text = DataGridView3.Rows.Count
- End If
- End Sub
- Private Sub DateTimePicker1_ValueChanged(sender As Object, e As EventArgs) Handles DateTimePicker1.MouseDown
- DateTimePicker1.Format = DateTimePickerFormat.Short
- End Sub
- Private Sub DateTimePicker2_ValueChanged(sender As Object, e As EventArgs) Handles DateTimePicker2.MouseDown
- DateTimePicker2.Format = DateTimePickerFormat.Short
- End Sub
- Private Sub DateTimePicker3_ValueChanged(sender As Object, e As EventArgs) Handles DateTimePicker3.MouseDown
- DateTimePicker3.Format = DateTimePickerFormat.Short
- End Sub
- Private Sub Button13_Click(sender As Object, e As EventArgs) Handles Button13.Click
- DateTimePicker1.Format = DateTimePickerFormat.Custom : DateTimePicker1.CustomFormat = " "
- End Sub
- Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
- DateTimePicker2.Format = DateTimePickerFormat.Custom : DateTimePicker2.CustomFormat = " "
- End Sub
- Private Sub Button9_Click(sender As Object, e As EventArgs) Handles Button9.Click
- DateTimePicker3.Format = DateTimePickerFormat.Custom : DateTimePicker3.CustomFormat = " "
- End Sub
- Private Sub Button10_Click(sender As Object, e As EventArgs) Handles Button10.Click
- Target1 = Target & AA(4) & "/"
- WebBrowser3.Url = New Uri(Target1)
- End Sub
- Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
- PA = InputBox("請輸入要查詢的資料") : 員工資料() : PA = ""
- End Sub
- Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
- PA = InputBox("請輸入要查詢的資料") : 讀取專案主檔() : PA = ""
- End Sub
- Private Sub Button14_Click(sender As Object, e As EventArgs) Handles Button14.Click
- If FolderBrowserDialog1.ShowDialog = DialogResult.OK Then
- WebBrowser1.Navigate(FolderBrowserDialog1.SelectedPath)
- End If
- End Sub
- Private Sub Button8_Click(sender As Object, e As EventArgs) Handles Button8.Click
- TextBox1.Text = "" : TextBox2.Text = "" : TextBox3.Text = "" : TextBox4.Text = ""
- TextBox11.Text = "0.00" : TextBox12.Text = "0.00" : TextBox13.Text = "0.00" : TextBox16.Text = "0"
- CheckBox1.Checked = False : CheckBox10.Checked = False : CheckBox11.Checked = False
- DateTimePicker1.Format = DateTimePickerFormat.Custom : DateTimePicker1.CustomFormat = " "
- DateTimePicker2.Format = DateTimePickerFormat.Custom : DateTimePicker2.CustomFormat = " "
- DateTimePicker3.Format = DateTimePickerFormat.Custom : DateTimePicker3.CustomFormat = " "
- Button5.Enabled = True
- End Sub
- Private Sub Set_日期格式轉換()
- DTP(0) = DateTimePicker1.Text : DTP(1) = DateTimePicker2.Text : DTP(2) = DateTimePicker3.Text
- If DTP(0) = " " Then : DTP(0) = "" : Else : DTP(0) = Format(DateTimePicker1.Value, "yyyy/MM/dd") : End If
- If DTP(1) = " " Then : DTP(1) = "" : Else : DTP(1) = Format(DateTimePicker2.Value, "yyyy/MM/dd") : End If
- If DTP(2) = " " Then : DTP(2) = "" : Else : DTP(2) = Format(DateTimePicker3.Value, "yyyy/MM/dd") : End If
- End Sub
- Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click
- ConnOpen()
- Set_日期格式轉換()
- SQL1 = "UPDATE 業務專案主檔 SET 專案內容 = N'" & TextBox2.Text & "', 專案性質 = N'" & ComboBox3.Text & "', 合約性質 = N'" & ComboBox4.Text & "', 備註 = '" & TextBox4.Text &
- "', 專案人數 = '" & ComboBox1.Text & "', 執行天數 = '" & TextBox16.Text & "', 地點 = '" & TextBox3.Text & "', 報價 = '" & CheckBox10.Checked &
- "', 報價日期 = '" & DTP(2) & "', 專案成本 = '" & TextBox12.Text & "', 立案 = '" & CheckBox11.Checked & "', 立案日期 = '" & DTP(0) &
- "', 收款金額 = '" & TextBox11.Text & "', 結案 = '" & CheckBox1.Checked & "', 結案日期 = '" & DTP(1) &
- "', 應收金額 = '" & TextBox13.Text & "', 幣別 = '" & ComboBox5.Text & "', 建檔 = '" & CheckBox12.Checked & "', 客戶 = N'" & ComboBox2.Text & "'
- WHERE 專案流水號 LIKE N'" & TextBox1.Text & "'"
- cmd.CommandText = SQL1 : cmd.ExecuteNonQuery()
- MsgBox("修改完成")
- conn.Close()
- 讀取專案主檔()
- End Sub
- Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
- Dim aa1 As MsgBoxResult
- aa1 = MsgBox("確定要刪除該筆資料?", MsgBoxStyle.OkCancel)
- If aa1 = MsgBoxResult.Ok Then
- ConnOpen()
- SQL1 = "DELETE FROM 業務專案主檔 WHERE (專案流水號 = '" & TextBox1.Text & "')"
- cmd.CommandText = SQL1 : cmd.Connection = conn : cmd.ExecuteNonQuery() : conn.Close()
- ConnOpen()
- SQL1 = "DELETE FROM 業務專案清單 WHERE (專案流水號 = '" & TextBox1.Text & "')"
- cmd.CommandText = SQL1 : cmd.Connection = conn : cmd.ExecuteNonQuery() : conn.Close()
- '------------------FTP刪除資料夾-----------------------------------------------------------------------------------------
- Dim frq As FtpWebRequest, fcr As NetworkCredential
- frq = CType(WebRequest.Create(New Uri(Target & AA(4) & "/" & TextBox1.Text)), FtpWebRequest)
- fcr = New NetworkCredential(FTP帳號, FTP密碼)
- Dim frp As FtpWebResponse
- frq.Credentials = fcr '认证信息
- frq.Method = WebRequestMethods.Ftp.RemoveDirectory
- frp = CType(frq.GetResponse, FtpWebResponse) '发送、操作、并返回
- frp.Close()
- MsgBox("刪除完成")
- End If
- 讀取專案主檔()
- End Sub
- Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click
- Dim NUM1 As Integer
- For NUM1 = 0 To 99999999
- If NUM1 < 10 Then : TextBox1.Text = "BP" & "0000000" & NUM1
- ElseIf NUM1 > 9 And NUM1 < 100 Then : TextBox1.Text = "BP" & "000000" & NUM1
- ElseIf NUM1 > 99 And NUM1 < 1000 Then : TextBox1.Text = "BP" & "00000" & NUM1
- ElseIf NUM1 > 999 And NUM1 < 10000 Then : TextBox1.Text = "BP" & "0000" & NUM1
- ElseIf NUM1 > 9999 And NUM1 < 100000 Then : TextBox1.Text = "BP" & "000" & NUM1
- ElseIf NUM1 > 99999 And NUM1 < 1000000 Then : TextBox1.Text = "BP" & "00" & NUM1
- ElseIf NUM1 > 999999 And NUM1 < 10000000 Then : TextBox1.Text = "BP" & "0" & NUM1
- ElseIf NUM1 > 9999999 Then : TextBox1.Text = "BP" & NUM1 : End If
- ConnOpen()
- SQL1 = "SELECT 專案流水號 FROM 業務專案主檔 WHERE (專案流水號 ='" & TextBox1.Text & "')"
- CmdSet_For_dr()
- If dr.Read() Then : TextBox1.Text = dr("專案流水號").ToString : TextBox5.Text = "NO" : Else : TextBox5.Text = "" : End If
- conn.Close()
- If TextBox5.Text = "" Then : NUM1 = 99999999 : End If
- Next
- Set_日期格式轉換()
- ConnOpen()
- SQL1 = "INSERT INTO 業務專案主檔 (專案流水號, 專案內容, 專案性質, 合約性質, 備註, 專案人數, 執行天數, 地點, 報價, 報價日期, 專案成本, 立案, 立案日期, 收款金額, 結案,
- 結案日期, 應收金額, 幣別, 建檔, 客戶) " &
- "VALUES (N'" & TextBox1.Text & "', N'" & TextBox2.Text & "', N'" & ComboBox3.Text & "', N'" & ComboBox4.Text & "', N'" & TextBox4.Text & "', N'" & ComboBox1.Text &
- "', N'" & TextBox16.Text & "', N'" & TextBox3.Text & "', N'" & CheckBox10.Checked & "', N'" & DTP(2) & "', N'" & TextBox12.Text & "', N'" & CheckBox11.Checked &
- "', N'" & DTP(0) & "', N'" & TextBox11.Text & "', N'" & CheckBox1.Checked & "', N'" & DTP(1) & "', N'" & TextBox13.Text & "', N'" & ComboBox5.Text &
- "', N'" & CheckBox12.Checked & "', N'" & ComboBox2.Text & "')"
- cmd.Connection = conn : cmd.CommandText = SQL1 : cmd.ExecuteNonQuery() : conn.Close()
- '------------------FTP新增資料夾-----------------------------------------------------------------------------------------
- Dim frq As FtpWebRequest, fcr As NetworkCredential
- frq = CType(WebRequest.Create(New Uri(Target & AA(4) & "/" & TextBox1.Text)), FtpWebRequest)
- fcr = New NetworkCredential(FTP帳號, FTP密碼)
- Dim frp As FtpWebResponse
- frq.Credentials = fcr '认证信息
- frq.Method = WebRequestMethods.Ftp.MakeDirectory
- frp = CType(frq.GetResponse, FtpWebResponse) '发送、操作、并返回
- frp.Close()
- MsgBox("新增完成")
- 讀取專案主檔()
- End Sub
- Private Sub Button7_Click(sender As Object, e As EventArgs) Handles Button7.Click
- If TextBox1.Text = "" Or TextBox6.Text = "" Then
- MsgBox("請正確選擇資料")
- Else
- ConnOpen()
- SQL1 = "SELECT 專案流水號, 對應流水號 FROM 業務專案清單 WHERE (專案流水號 ='" & TextBox1.Text & "') AND (對應流水號 ='" & TextBox6.Text & "')"
- CmdSet_For_dr()
- If dr.Read() Then
- MsgBox("資料已經存在")
- Else
- TextBox5.Text = "YES"
- End If
- conn.Close()
- If TextBox5.Text = "YES" Then
- ConnOpen()
- SQL1 = "INSERT INTO 業務專案清單 (專案流水號, 對應流水號, 設計天數) VALUES ('" & TextBox1.Text & "','" & TextBox6.Text & "','0')"
- cmd.Connection = conn : cmd.CommandText = SQL1 : cmd.ExecuteNonQuery()
- MsgBox("新增完成")
- conn.Close()
- 讀取專案人事資料()
- Else
- End If
- End If
- End Sub
- Private Sub Button11_Click(sender As Object, e As EventArgs) Handles Button11.Click
- Dim aa As MsgBoxResult
- aa = MsgBox("確定要刪除該筆資料?", MsgBoxStyle.OkCancel)
- If aa = MsgBoxResult.Ok Then
- ConnOpen()
- SQL1 = "DELETE FROM 業務專案清單 WHERE (專案流水號 = '" & TextBox8.Text & "') AND (對應流水號 = '" & TextBox7.Text & "')"
- cmd.CommandText = SQL1 : cmd.Connection = conn : cmd.ExecuteNonQuery() : conn.Close()
- MsgBox("刪除完成")
- End If
- 讀取專案人事資料()
- ComboBox1.Text = DataGridView3.Rows.Count
- ConnOpen()
- SQL1 = "UPDATE 業務專案主檔 SET 專案人數 = '" & ComboBox1.Text & "' WHERE 專案流水號 LIKE N'" & TextBox1.Text & "'"
- cmd.Connection = conn : cmd.CommandText = SQL1 : cmd.ExecuteNonQuery() : conn.Close()
- 讀取專案主檔()
- End Sub
- Private Sub Button12_Click(sender As Object, e As EventArgs) Handles Button12.Click
- WebBrowser1.GoBack()
- End Sub
- Private Sub Button15_Click(sender As Object, e As EventArgs) Handles Button15.Click
- WebBrowser1.GoForward()
- End Sub
- Private Sub Button17_Click(sender As Object, e As EventArgs) Handles Button17.Click
- WebBrowser3.GoBack()
- End Sub
- Private Sub Button16_Click(sender As Object, e As EventArgs) Handles Button16.Click
- WebBrowser3.GoForward()
- End Sub
- Private Sub Button19_Click(sender As Object, e As EventArgs) Handles Button19.Click
- ComboBox2下拉表單資料載入()
- End Sub
- Private Sub Button20_Click(sender As Object, e As EventArgs) Handles Button20.Click
- 讀取專案主檔()
- End Sub
- Private Sub Button18_Click(sender As Object, e As EventArgs) Handles Button18.Click
- If ComboBox3.Text = "" Or PA2 = "" Then
- MsgBox("沒有選擇專案。")
- ElseIf ComboBox3.Text = "軟體設計" And PA2 <> "" Then
- 系統開發功能點檢表.Close() : 系統開發功能點檢表.Show() : 系統開發功能點檢表.BringToFront()
- Else
- MsgBox("軟體設計以外的專案還未開發。")
- End If
- End Sub
- End Class
|