123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126 |
- Option Strict Off
- Imports System.Data.SqlClient
- Imports System.IO
- Public Class 零用金支付單一覽表
- ReadOnly conn As New SqlConnection
- ReadOnly da As New SqlDataAdapter
- ReadOnly cmd As New SqlCommand
- ReadOnly ds As New DataSet : ReadOnly ds1 As New DataSet : ReadOnly ds2 As New DataSet : ReadOnly ds3 As New DataSet : ReadOnly ds4 As New DataSet
- Dim dr As SqlDataReader
- Private Sub Set_支付單清單()
- DataGridView1.DataSource = Nothing : ds.Clear()
- DataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
- DataGridView1.ColumnHeadersHeight = 25
- DataGridView1.AllowUserToAddRows = False
- DataGridView1.RowTemplate.Height = 35
- If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
- SQL1 = "SELECT 流水號, 項次 AS Item, 用途 AS Konten, 金額 AS Jumlah, 備註 AS Komentar FROM 零用金支付明細 WHERE 流水號 LIKE N'" & TextBox1.Text & "' ORDER BY 項次"
- 列印用SQL2 = SQL1
- cmd.Connection = conn : cmd.CommandText = SQL1 : da.SelectCommand = cmd : da.Fill(ds) : DataGridView1.DataSource = ds.Tables(0) : conn.Close() : Set_grid()
- End Sub
- Private Sub Set_grid()
- DataGridView1.Columns(0).Visible = False : DataGridView1.Columns(1).FillWeight = 80 : DataGridView1.Columns(2).FillWeight = 538 : DataGridView1.Columns(3).FillWeight = 140
- DataGridView1.Columns(4).FillWeight = 537
- DataGridView1.Columns(3).DefaultCellStyle.Format = "#,##0"
- DataGridView1.Columns(3).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
- DataGridView1.Columns(3).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
- DataGridView1.EditMode = DataGridViewEditMode.EditOnEnter
-
- TextBox7.Text = "0"
- For i As Integer = 0 To DataGridView1.Rows.Count - 1
- TextBox7.Text = Val(TextBox7.Text) + DataGridView1.Rows(i).Cells("Jumlah").Value
- Next i
- TextBox7.Text = Format(Val(TextBox7.Text), "#,##0")
- End Sub
- Private Sub Set_清單3()
- DataGridView4.DataSource = Nothing : ds3.Clear()
- DataGridView4.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
- DataGridView4.ColumnHeadersHeight = 25
- DataGridView4.AllowUserToAddRows = False
- If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
- If 登入人部門 = "NA" Then
- SQL1 = "SELECT 零用金支付表.流水號 AS Nomor_Seri, 零用金支付表.部門 AS Departemen, 零用金支付表.申請人 AS Pemohon, LEFT(零用金支付表.申請日期, 10) AS Tanggal_Aplikasi,
- 零用金支付表.審核人 AS Peninjau, LEFT(零用金支付表.審核日期, 10) AS Tanggal_Peninjau, 零用金支付表.核准人 AS Setuju,
- LEFT(零用金支付表.核准日期, 10) AS Tanggal_Setuju, 零用金支付表.核准圖檔, 零用金支付表.簽名編碼,
- 零用金支付明細.出納 AS Penarikan
- FROM 零用金支付表 INNER JOIN
- 零用金支付明細 ON 零用金支付表.流水號 = 零用金支付明細.流水號
- WHERE (零用金支付表.審核人 NOT LIKE N'作廢%') AND (零用金支付表.審核人 NOT LIKE N'') AND
- (零用金支付表.核准人 NOT LIKE N'作廢%') AND (零用金支付表.核准人 NOT LIKE N'')
- GROUP BY 零用金支付表.流水號, 零用金支付表.部門, 零用金支付表.申請人, LEFT(零用金支付表.申請日期, 10),
- 零用金支付表.審核人, LEFT(零用金支付表.審核日期, 10), 零用金支付表.核准人, LEFT(零用金支付表.核准日期, 10),
- 零用金支付表.核准圖檔, 零用金支付表.簽名編碼, 零用金支付明細.出納
- ORDER BY 零用金支付表.流水號 DESC"
- Else
- SQL1 = "SELECT 零用金支付表.流水號 AS Nomor_Seri, 零用金支付表.部門 AS Departemen, 零用金支付表.申請人 AS Pemohon, LEFT(零用金支付表.申請日期, 10) AS Tanggal_Aplikasi,
- 零用金支付表.審核人 AS Peninjau, LEFT(零用金支付表.審核日期, 10) AS Tanggal_Peninjau, 零用金支付表.核准人 AS Setuju,
- LEFT(零用金支付表.核准日期, 10) AS Tanggal_Setuju, 零用金支付表.核准圖檔, 零用金支付表.簽名編碼,
- 零用金支付明細.出納 AS Penarikan
- FROM 零用金支付表 INNER JOIN
- 零用金支付明細 ON 零用金支付表.流水號 = 零用金支付明細.流水號
- WHERE (零用金支付表.申請人 LIKE N'" & gUserName & "') AND (零用金支付表.審核人 NOT LIKE N'作廢%') AND (零用金支付表.審核人 NOT LIKE N'') AND
- (零用金支付表.核准人 NOT LIKE N'作廢%') AND (零用金支付表.核准人 NOT LIKE N'')
- GROUP BY 零用金支付表.流水號, 零用金支付表.部門, 零用金支付表.申請人, LEFT(零用金支付表.申請日期, 10),
- 零用金支付表.審核人, LEFT(零用金支付表.審核日期, 10), 零用金支付表.核准人, LEFT(零用金支付表.核准日期, 10),
- 零用金支付表.核准圖檔, 零用金支付表.簽名編碼, 零用金支付明細.出納
- ORDER BY 零用金支付表.流水號 DESC"
- End If
- cmd.Connection = conn : cmd.CommandText = SQL1 : da.SelectCommand = cmd : da.Fill(ds3) : DataGridView4.DataSource = ds3.Tables(0) : conn.Close() : Set_grid3()
- End Sub
- Private Sub Set_grid3()
- DataGridView4.Columns(0).FillWeight = 120 : DataGridView4.Columns(1).FillWeight = 115 : DataGridView4.Columns(2).FillWeight = 200 : DataGridView4.Columns(3).FillWeight = 115
- DataGridView4.Columns(4).FillWeight = 200 : DataGridView4.Columns(5).FillWeight = 115 : DataGridView4.Columns(6).FillWeight = 200 : DataGridView4.Columns(7).FillWeight = 115
- DataGridView4.Columns(8).Visible = False : DataGridView4.Columns(9).Visible = False : DataGridView4.Columns(10).FillWeight = 113
- End Sub
- Private Sub 零用金支付單一覽表_Load(sender As Object, e As EventArgs) Handles MyBase.Load
- Me.MdiParent = HX_PGS_ERP_SYS : Me.WindowState = 2 : Me.AutoScroll = True
- TextBox6.Visible = False
- Set_清單3()
- End Sub
- Private Sub 登入閒置控制_MouseMove(sender As Object, e As EventArgs) Handles MyBase.MouseMove
- timeNow = 0
- HX_PGS_ERP_SYS.Timer1.Enabled = False
- HX_PGS_ERP_SYS.Timer1.Enabled = True
- End Sub
- Private Sub 登入閒置控制_KeyPress(sender As Object, e As EventArgs) Handles MyBase.KeyPress
- timeNow = 0
- HX_PGS_ERP_SYS.Timer1.Enabled = False
- HX_PGS_ERP_SYS.Timer1.Enabled = True
- End Sub
- Private Sub DataGridView4_CellClick(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles DataGridView4.CellClick
- If e.RowIndex = -1 Then : Else
- PA = DataGridView4(0, e.RowIndex).Value.ToString : PA1 = DataGridView4(1, e.RowIndex).Value.ToString : PA2 = DataGridView4(2, e.RowIndex).Value.ToString
- PA3 = DataGridView4(4, e.RowIndex).Value.ToString : PA4 = DataGridView4(6, e.RowIndex).Value.ToString : PA5 = DataGridView4(9, e.RowIndex).Value.ToString
- PA6 = DataGridView4(8, e.RowIndex).Value.ToString : PA7 = DataGridView4(3, e.RowIndex).Value.ToString : PA8 = DataGridView4(5, e.RowIndex).Value.ToString
- PA9 = DataGridView4(7, e.RowIndex).Value.ToString
- TextBox1.Text = PA : TextBox2.Text = PA1 : TextBox3.Text = PA2 : TextBox4.Text = PA3 : TextBox5.Text = PA4 : TextBox13.Text = PA5 : TextBox6.Text = PA6 : DateTimePicker1.Value = PA7
- DateTimePicker2.Value = PA8 : DateTimePicker3.Value = PA9 : 列印用SQL = PA : 簽核圖片編號 = TextBox6.Text : Set_支付單清單()
-
- If conn.State = ConnectionState.Closed Then : conn.ConnectionString = ConString : conn.Open() : End If
- SQL1 = "SELECT 簽名檔圖片 FROM HX主管簽名檔管理 WHERE 圖片流水號 LIKE N'" & PA6 & "'"
- cmd.Connection = conn : cmd.CommandText = SQL1 : dr = cmd.ExecuteReader
- 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
- End If
- End Sub
- Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
- If 列印用SQL2 = "" Then
- MsgBox("沒有選擇零用金支付單。 No petty cash payment form selected.")
- Else
- 列印_零用金支付單.ShowDialog() : 列印用SQL = "" : 列印用SQL2 = ""
- End If
- End Sub
- '----------------------滑鼠右鍵--------------------------------------------------------------------------------------------------------------------------------------------------------------------
- Private Sub 重新讀取ToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles 重新讀取ToolStripMenuItem.Click
- Set_清單3()
- End Sub
- Private Sub AAAToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles AAAToolStripMenuItem.Click
- Me.Button2.PerformClick()
- End Sub
- End Class
|