123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197 |
- Option Strict Off
- Imports System.IO
- Public Class 營運成本收支單審核
- ReadOnly ds As New DataSet : ReadOnly ds1 As New DataSet : ReadOnly ds2 As New DataSet
- Private ReadOnly QQW(11) As String
- Private II As Integer
- Private Sub Set_清單1()
- DataGridView2.DataSource = Nothing : ds1.Clear()
- DataGridView2.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
- DataGridView2.ColumnHeadersHeight = 25
- DataGridView2.AllowUserToAddRows = False
- SQL_營運成本收支單審核清單()
- da.Fill(ds1) : DataGridView2.DataSource = ds1.Tables(0) : conn.Close()
-
- DataGridView2.Columns(0).FillWeight = 160 : DataGridView2.Columns(1).FillWeight = 100 : DataGridView2.Columns(2).FillWeight = 100 : DataGridView2.Columns(3).Visible = False
- End Sub
- Private Sub Set_費用清單()
- DataGridView1.DataSource = Nothing : ds.Clear()
- DataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
- DataGridView1.ColumnHeadersHeight = 25
- DataGridView1.AllowUserToAddRows = False
- DataGridView1.RowTemplate.Height = 35
- SQL_營運成本收支單審核費用清單()
- da.Fill(ds) : DataGridView1.DataSource = ds.Tables(0) : conn.Close()
-
- DataGridView1.Columns(0).Visible = False : DataGridView1.Columns(1).FillWeight = 80 : DataGridView1.Columns(2).FillWeight = 300 : DataGridView1.Columns(3).FillWeight = 500
- DataGridView1.Columns(4).FillWeight = 140 : DataGridView1.Columns(5).FillWeight = 140 : DataGridView1.Columns(6).FillWeight = 140 : DataGridView1.Columns(7).FillWeight = 140
- DataGridView1.Columns(8).FillWeight = 140
-
- DataGridView1.Columns(1).ReadOnly = True : DataGridView1.Columns(2).ReadOnly = True : DataGridView1.Columns(3).ReadOnly = True : DataGridView1.Columns(4).ReadOnly = True
- DataGridView1.Columns(5).ReadOnly = True : DataGridView1.Columns(6).ReadOnly = True
-
- DataGridView1.Columns(4).DefaultCellStyle.Format = "#,##0" : DataGridView1.Columns(5).DefaultCellStyle.Format = "#,##0" : DataGridView1.Columns(6).DefaultCellStyle.Format = "#,##0"
- DataGridView1.Columns(7).DefaultCellStyle.Format = "#,##0"
- DataGridView1.Columns(4).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight : DataGridView1.Columns(4).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleRight
- 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(7).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight : DataGridView1.Columns(7).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleRight
- DataGridView1.EditMode = DataGridViewEditMode.EditOnEnter
-
- TextBox5.Text = "0" : TextBox2.Text = "0" : TextBox6.Text = "0" : TextBox7.Text = "0" : TextBox8.Text = "0"
- For i As Integer = 0 To DataGridView1.Rows.Count - 1
- TextBox5.Text = Val(TextBox5.Text) + DataGridView1.Rows(i).Cells("現金").Value : TextBox2.Text = Val(TextBox2.Text) + DataGridView1.Rows(i).Cells("支出").Value
- TextBox7.Text = Val(TextBox7.Text) + DataGridView1.Rows(i).Cells("零用金").Value : TextBox8.Text = Val(TextBox8.Text) + DataGridView1.Rows(i).Cells("支票").Value
- Next i
- TextBox6.Text = Val(TextBox7.Text) + Val(TextBox5.Text) - Val(TextBox2.Text)
- If Val(TextBox6.Text) > 0 Then : TextBox6.ForeColor = Color.Blue : Else : TextBox6.ForeColor = Color.Red : End If
- TextBox5.Text = Format(Val(TextBox5.Text), "#,##0") : TextBox2.Text = Format(Val(TextBox2.Text), "#,##0") : TextBox6.Text = Format(Val(TextBox6.Text), "#,##0")
- TextBox7.Text = Format(Val(TextBox7.Text), "#,##0") : TextBox8.Text = Format(Val(TextBox8.Text), "#,##0")
- End Sub
- Private Sub Set_清單()
- DataGridView3.DataSource = Nothing : ds2.Clear()
- DataGridView3.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
- DataGridView3.ColumnHeadersHeight = 25
- DataGridView3.AllowUserToAddRows = False
- SQL_營運成本收支單審核_圖檔編碼()
- da.Fill(ds2) : DataGridView3.DataSource = ds2.Tables(0) : conn.Close()
-
- DataGridView3.Columns(0).FillWeight = 173 : DataGridView3.Columns(1).Visible = False
- If DataGridView3.Rows.Count = 0 Then : Else
- TextBox14.Text = DataGridView3(0, 0).Value.ToString : PA = TextBox14.Text
- SQL_使用者權限圖片顯示()
- While dr.Read() = True
- Dim unused As Byte() = New Byte(-1) {}
- Dim bytes As Byte() = DirectCast(dr.Item("簽名檔圖片"), Byte())
- Dim oStream As New MemoryStream(bytes)
- PictureBox1.Image = Bitmap.FromStream(oStream)
- End While
- conn.Close() : PictureBox1.SizeMode = 4
- For QAZ = 0 To 999
- QQW(0) = Strings.Right(DataGridView3(0, 0).Value.ToString, 2) : QQW(1) = Strings.Right(Year(Today), 2) : QQW(2) = Strings.Left(Year(Today), 2) : QQW(3) = Month(Today) + 9
- QQW(4) = Strings.Right(QQW(0), 1) : QQW(5) = Strings.Left(QQW(0), 1) : QQW(6) = Strings.Right(QQW(1), 1) : QQW(7) = Strings.Left(QQW(1), 1) : QQW(8) = Strings.Right(QQW(2), 1)
- QQW(9) = Strings.Left(QQW(2), 1) : QQW(10) = Strings.Right(QQW(3), 1) : QQW(11) = Strings.Left(QQW(3), 1)
- For RT = 4 To 11
- Delay(3)
- Dim ran = New Random(DateTime.Now.Millisecond) : Dim NUM1 As Integer = ran.Next(1, 4096)
- For I = 0 To 4096 : If NUM1 > 9 Then : NUM1 -= 9 : ElseIf NUM1 < 9 Then : I = 4096 : End If : Next
- If NUM1 = 1 Then : II = RT : 轉換() : ElseIf NUM1 = 2 Then : II = RT : 轉換() : ElseIf NUM1 = 3 Then : ElseIf NUM1 = 4 Then : II = RT : 轉換() : ElseIf NUM1 = 5 Then
- ElseIf NUM1 = 6 Then : II = RT : 轉換() : ElseIf NUM1 = 7 Then : ElseIf NUM1 = 8 Then : II = RT : 轉換() : ElseIf NUM1 = 9 Then : II = RT : 轉換() : End If
- Next
-
- Dim ran1 = New Random(DateTime.Now.Millisecond) : Dim NUM2 As Integer = ran1.Next(1, 4096)
- For I = 0 To 4096 : If NUM2 > 99 Then : NUM2 -= 49 : ElseIf NUM2 < 99 Then : I = 4096 : End If : Next
-
- TextBox13.Text = QQW(11) & "2" & QQW(9) & "7" & QQW(7) & "0" & QQW(5) & QQW(4) & "1" & QQW(6) & "3" & QQW(8) & "9" & QQW(10) & NUM2
-
- SQL_營運成本收支單審核_簽名編碼() : If dr.Read() = True Then : Else : QAZ = 999 : End If : conn.Close()
- Next
- End If
- End Sub
- Private Sub 轉換()
- If QQW(II) = "1" Then : QQW(II) = "A" : ElseIf QQW(II) = "2" Then : QQW(II) = "B" : ElseIf QQW(II) = "3" Then : QQW(II) = "C" : ElseIf QQW(II) = "4" Then : QQW(II) = "D"
- ElseIf QQW(II) = "5" Then : QQW(II) = "E" : ElseIf QQW(II) = "6" Then : QQW(II) = "F" : ElseIf QQW(II) = "7" Then : QQW(II) = "G" : ElseIf QQW(II) = "8" Then : QQW(II) = "H"
- ElseIf QQW(II) = "9" Then : QQW(II) = "I" : ElseIf QQW(II) = "0" Then : QQW(II) = "J" : End If
- End Sub
- Public Sub Delay(ByRef Interval As Double) 'Interval单位为毫秒
- Dim time As DateTime = DateTime.Now : Dim Span As Double = Interval * 1234 : While ((DateTime.Now.Ticks - time.Ticks) < Span) : Application.DoEvents() : End While
- End Sub
- Private Sub 營運費用支付審核_Load(sender As Object, e As EventArgs) Handles MyBase.Load
- Me.MdiParent = MAOJI_ERP_SYS : Me.WindowState = 2 : Me.AutoScroll = True
- RadioButton1.Checked = True : DataGridView2.Visible = True
- Set_清單1() : Set_清單()
- End Sub
- Private Sub DataGridView2_CellClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView2.CellClick
- If e.RowIndex = -1 Then : Else
- TextBox1.Text = DataGridView2(0, e.RowIndex).Value.ToString : DateTimePicker1.Value = DataGridView2(1, e.RowIndex).Value.ToString : Set_費用清單()
- TextBox3.Text = DataGridView2(3, e.RowIndex).Value.ToString
- End If
- End Sub
- Private Sub DataGridView3_CellClick(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles DataGridView3.CellClick
- If e.RowIndex = -1 Then : Else
- TextBox14.Text = DataGridView3(0, e.RowIndex).Value.ToString : PA = TextBox14.Text
- SQL_使用者權限圖片顯示()
- While dr.Read() = True
- Dim unused As Byte() = New Byte(-1) {}
- Dim bytes As Byte() = DirectCast(dr.Item("簽名檔圖片"), Byte())
- Dim oStream As New MemoryStream(bytes)
- PictureBox1.Image = Bitmap.FromStream(oStream)
- End While
- conn.Close()
- PictureBox1.SizeMode = 4
- For QAZ = 0 To 999
- QQW(0) = Strings.Right(DataGridView3(0, e.RowIndex).Value.ToString, 2) : QQW(1) = Strings.Right(Year(Today), 2) : QQW(2) = Strings.Left(Year(Today), 2) : QQW(3) = Month(Today) + 9
- QQW(4) = Strings.Right(QQW(0), 1) : QQW(5) = Strings.Left(QQW(0), 1) : QQW(6) = Strings.Right(QQW(1), 1) : QQW(7) = Strings.Left(QQW(1), 1) : QQW(8) = Strings.Right(QQW(2), 1)
- QQW(9) = Strings.Left(QQW(2), 1) : QQW(10) = Strings.Right(QQW(3), 1) : QQW(11) = Strings.Left(QQW(3), 1)
- For RT = 4 To 11
- Delay(3)
- Dim ran = New Random(DateTime.Now.Millisecond) : Dim NUM1 As Integer = ran.Next(1, 4096)
- For I = 0 To 4096 : If NUM1 > 9 Then : NUM1 -= 9 : ElseIf NUM1 < 9 Then : I = 4096 : End If : Next
- If NUM1 = 1 Then : II = RT : 轉換() : ElseIf NUM1 = 2 Then : II = RT : 轉換() : ElseIf NUM1 = 3 Then : ElseIf NUM1 = 4 Then : II = RT : 轉換() : ElseIf NUM1 = 5 Then
- ElseIf NUM1 = 6 Then : II = RT : 轉換() : ElseIf NUM1 = 7 Then : ElseIf NUM1 = 8 Then : II = RT : 轉換() : ElseIf NUM1 = 9 Then : II = RT : 轉換() : End If
- Next
-
- Dim ran1 = New Random(DateTime.Now.Millisecond) : Dim NUM2 As Integer = ran1.Next(1, 4096)
- For I = 0 To 4096 : If NUM2 > 99 Then : NUM2 -= 49 : ElseIf NUM2 < 99 Then : I = 4096 : End If : Next
-
- TextBox13.Text = QQW(11) & "2" & QQW(9) & "7" & QQW(7) & "0" & QQW(5) & QQW(4) & "1" & QQW(6) & "3" & QQW(8) & "9" & QQW(10) & NUM2
-
- SQL_營運成本收支單審核_簽名編碼() : If dr.Read() = True Then : Else : QAZ = 999 : End If : conn.Close()
- Next
- End If
- End Sub
- Private Sub Set_切換格式()
- DataGridView1.DataSource = Nothing : ds.Clear() : TextBox1.Text = "" : TextBox3.Text = "" : TextBox5.Text = "" : TextBox2.Text = "" : TextBox6.Text = ""
- TextBox7.Text = "" : TextBox8.Text = "" : Set_清單1()
- End Sub
- Private Sub RadioButton1_CheckedChanged(sender As Object, e As EventArgs) Handles RadioButton1.Click
- RadioButton1.Checked = True : RadioButton2.Checked = False
- DataGridView1.DataSource = Nothing : ds.Clear() : TextBox1.Text = "" : TextBox3.Text = "" : TextBox5.Text = "" : TextBox2.Text = "" : TextBox6.Text = ""
- Button1.Enabled = True : Button2.Enabled = True : 審核通過ToolStripMenuItem.Enabled = True : 單據作廢ToolStripMenuItem.Enabled = True : Set_切換格式()
- End Sub
- Private Sub RadioButton2_CheckedChanged(sender As Object, e As EventArgs) Handles RadioButton2.Click
- RadioButton1.Checked = False : RadioButton2.Checked = True
- DataGridView1.DataSource = Nothing : ds.Clear() : TextBox1.Text = "" : TextBox3.Text = "" : TextBox5.Text = "" : TextBox2.Text = "" : TextBox6.Text = ""
- Button1.Enabled = False : Button2.Enabled = False : 審核通過ToolStripMenuItem.Enabled = False : 單據作廢ToolStripMenuItem.Enabled = False : Set_切換格式()
- End Sub
- Private Sub Set_日期格式轉換()
- DTP = Format(Today(), "yyyy/MM/dd")
- End Sub
- Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
- If TextBox1.Text = "" Then : MsgBox("請選擇需要審核的單據。")
- Else
- If CheckBox1.Checked = False Then : Set_日期格式轉換() : Else : DTP = Format(DateTimePicker1.Value, "yyyy/MM/dd") : End If
- SQL_營運成本收支單審核_控制表修改() : conn.Close()
- SQL_營運成本收支單審核_明細表修改() : conn.Close()
- For i As Integer = 0 To DataGridView1.Rows.Count - 1
- PA1 = TextBox1.Text : PA2 = DataGridView1.Rows(i).Cells("項次").Value
- If DataGridView1.Rows(i).Cells("零用金").Value <> 0 Then : SQL_營運成本收支單審核_明細表_備用金確認() : conn.Close()
- ElseIf DataGridView1.Rows(i).Cells("現金").Value <> 0 Then : SQL_營運成本收支單審核_明細表_現金確認() : conn.Close()
- ElseIf DataGridView1.Rows(i).Cells("支出").Value <> 0 Then : SQL_營運成本收支單審核_明細表_公帳確認() : conn.Close() : End If
- Next
- MsgBox("審核完畢。") : TextBox1.Text = "" : TextBox3.Text = "" : DataGridView1.DataSource = Nothing : ds.Clear() : Set_清單1() : Set_清單()
- End If
- End Sub
- Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
- If TextBox1.Text = "" Then : MsgBox("請選擇需要審核的單據。")
- Else
- PA = InputBox("請輸入作廢原因。")
- If PA = "" Then : MsgBox("請輸入作廢原因,不可空白。")
- Else
- If CheckBox1.Checked = False Then : Set_日期格式轉換() : Else : DTP = Format(DateTimePicker1.Value, "yyyy/MM/dd") : End If
- SQL_營運成本收支單審核_控制表作廢() : conn.Close()
- MsgBox("審核完畢。") : PA = "" : TextBox1.Text = "" : TextBox3.Text = "" : DataGridView1.DataSource = Nothing : ds.Clear() : Set_清單1()
- End If
- End If
- End Sub
- '----------------------滑鼠右鍵--------------------------------------------------------------------------------------------------------------------------------------------------------------------
- Private Sub 重新讀取ToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles 重新讀取ToolStripMenuItem.Click
- Set_清單1()
- End Sub
- Private Sub 審核通過ToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles 審核通過ToolStripMenuItem.Click
- Me.Button1.PerformClick()
- End Sub
- Private Sub 單據作廢ToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles 單據作廢ToolStripMenuItem.Click
- Me.Button2.PerformClick()
- End Sub
- End Class
|