123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126 |
- Option Strict Off
- Public Class 供應商資料管理
- ReadOnly ds As New DataSet
- Dim EDR As Integer = 0 : Dim ESTR As String
- Private Sub Set_供應商清單()
- DataGridView1.DataSource = Nothing : ds.Clear() : DataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
- DataGridView1.ColumnHeadersHeight = 50 : DataGridView1.AllowUserToAddRows = False : DataGridView1.ClipboardCopyMode = DataGridViewClipboardCopyMode.EnableWithoutHeaderText
- DataGridView1.MultiSelect = True
- SQL__供應商資料管理清單()
- cmd.Connection = conn : cmd.CommandText = SQL1 : da.SelectCommand = cmd : da.Fill(ds) : DataGridView1.DataSource = ds.Tables(0) : conn.Close()
-
- DataGridView1.Columns(0).Visible = False : DataGridView1.Columns(1).FillWeight = 8 : DataGridView1.Columns(2).FillWeight = 3.5 : DataGridView1.Columns(3).Visible = False
- DataGridView1.Columns(4).Visible = False : DataGridView1.Columns(5).FillWeight = 6 : DataGridView1.Columns(6).FillWeight = 6 : DataGridView1.Columns(7).FillWeight = 6
- DataGridView1.Columns(8).FillWeight = 6 : DataGridView1.Columns(9).FillWeight = 16 : DataGridView1.Columns(10).FillWeight = 2 : DataGridView1.Columns(11).FillWeight = 16
- DataGridView1.Columns(12).FillWeight = 2 : DataGridView1.Columns(13).Visible = False : DataGridView1.Columns(14).Visible = False : DataGridView1.Columns(15).Visible = False
- DataGridView1.Columns(16).Visible = False : DataGridView1.Columns(17).Visible = False : DataGridView1.Columns(18).Visible = False : DataGridView1.Columns(19).Visible = False
- DataGridView1.Columns(20).Visible = False : DataGridView1.Columns(21).Visible = False : DataGridView1.Columns(22).Visible = False : DataGridView1.Columns(23).Visible = False
- DataGridView1.Columns(24).Visible = False : DataGridView1.Columns(25).FillWeight = 3.5 : DataGridView1.Columns(26).FillWeight = 7.5 : DataGridView1.Columns(27).FillWeight = 1.5
- DataGridView1.Columns(28).FillWeight = 1.5 : DataGridView1.Columns(29).FillWeight = 1.5 : DataGridView1.Columns(30).FillWeight = 1.5 : DataGridView1.Columns(31).FillWeight = 1.5
- DataGridView1.Columns(32).Visible = False : DataGridView1.Columns(33).FillWeight = 1.5 : DataGridView1.Columns(34).FillWeight = 1.5
-
- DataGridView1.Columns(29).DefaultCellStyle.Format = "#,##0" : DataGridView1.Columns(30).DefaultCellStyle.Format = "#,##0"
- DataGridView1.Columns(29).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight : DataGridView1.Columns(29).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleRight
- DataGridView1.Columns(30).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight : DataGridView1.Columns(30).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleRight
-
- 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(7).ReadOnly = True : DataGridView1.Columns(8).ReadOnly = True
- DataGridView1.Columns(9).ReadOnly = True : DataGridView1.Columns(10).ReadOnly = True : DataGridView1.Columns(11).ReadOnly = True : DataGridView1.Columns(12).ReadOnly = True
- DataGridView1.Columns(13).ReadOnly = True : DataGridView1.Columns(14).ReadOnly = True : DataGridView1.Columns(15).ReadOnly = True : DataGridView1.Columns(16).ReadOnly = True
- DataGridView1.Columns(17).ReadOnly = True : DataGridView1.Columns(18).ReadOnly = True : DataGridView1.Columns(19).ReadOnly = True : DataGridView1.Columns(20).ReadOnly = True
- DataGridView1.Columns(21).ReadOnly = True : DataGridView1.Columns(22).ReadOnly = True : DataGridView1.Columns(23).ReadOnly = True : DataGridView1.Columns(24).ReadOnly = True
- DataGridView1.Columns(25).ReadOnly = True : DataGridView1.Columns(26).ReadOnly = True : DataGridView1.Columns(27).ReadOnly = True : DataGridView1.Columns(28).ReadOnly = True
- DataGridView1.Columns(29).ReadOnly = True : DataGridView1.Columns(30).ReadOnly = True : DataGridView1.Columns(31).ReadOnly = True : DataGridView1.Columns(32).ReadOnly = True
- DataGridView1.Columns(33).ReadOnly = True : DataGridView1.Columns(34).ReadOnly = True
- End Sub
- Private Sub ComboBox1下拉表單資料載入()
- PA = "%%" : SQL_付款方式查詢()
- ComboBox1.Items.Clear() : While (dr.Read()) : ComboBox1.Items.Add(dr("付款方式")) : End While : conn.Close()
- 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
- TextBox1.Enabled = False : TextBox27.Visible = False
- ComboBox1下拉表單資料載入() : Set_供應商清單()
- If gUserName = "李協叡" Then : 資料刪除ToolStripMenuItem.Enabled = True : Else : 資料刪除ToolStripMenuItem.Enabled = False : End If
- End Sub
- Private Sub DataGridView1_CellClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellClick
- If e.RowIndex = -1 Then : Else
- TextBox1.Text = DataGridView1.Rows(e.RowIndex).Cells("編號").Value.ToString : TextBox2.Text = DataGridView1.Rows(e.RowIndex).Cells("名稱").Value.ToString
- TextBox3.Text = DataGridView1.Rows(e.RowIndex).Cells("簡稱").Value.ToString : TextBox4.Text = DataGridView1.Rows(e.RowIndex).Cells("負責人").Value.ToString
- TextBox5.Text = DataGridView1.Rows(e.RowIndex).Cells("負責人電話").Value.ToString : TextBox6.Text = DataGridView1.Rows(e.RowIndex).Cells("公司電話1").Value.ToString
- TextBox7.Text = DataGridView1.Rows(e.RowIndex).Cells("公司電話2").Value.ToString : TextBox8.Text = DataGridView1.Rows(e.RowIndex).Cells("傳真1").Value.ToString
- TextBox9.Text = DataGridView1.Rows(e.RowIndex).Cells("傳真2").Value.ToString : TextBox10.Text = DataGridView1.Rows(e.RowIndex).Cells("地址1").Value.ToString
- TextBox11.Text = DataGridView1.Rows(e.RowIndex).Cells("郵遞區號1").Value.ToString : TextBox12.Text = DataGridView1.Rows(e.RowIndex).Cells("地址2").Value.ToString
- TextBox13.Text = DataGridView1.Rows(e.RowIndex).Cells("郵遞區號2").Value.ToString : TextBox14.Text = DataGridView1.Rows(e.RowIndex).Cells("聯絡人1").Value.ToString
- TextBox15.Text = DataGridView1.Rows(e.RowIndex).Cells("聯絡人電話1").Value.ToString : TextBox16.Text = DataGridView1.Rows(e.RowIndex).Cells("聯絡人1MAIL").Value.ToString
- TextBox17.Text = DataGridView1.Rows(e.RowIndex).Cells("聯1LINE_唯信").Value.ToString : TextBox18.Text = DataGridView1.Rows(e.RowIndex).Cells("聯絡人2").Value.ToString
- TextBox19.Text = DataGridView1.Rows(e.RowIndex).Cells("聯絡人電話2").Value.ToString : TextBox20.Text = DataGridView1.Rows(e.RowIndex).Cells("聯絡人2MAIL").Value.ToString
- TextBox21.Text = DataGridView1.Rows(e.RowIndex).Cells("聯2LINE_唯信").Value.ToString : TextBox22.Text = DataGridView1.Rows(e.RowIndex).Cells("聯絡人3").Value.ToString
- TextBox23.Text = DataGridView1.Rows(e.RowIndex).Cells("聯絡人手機3").Value.ToString : TextBox24.Text = DataGridView1.Rows(e.RowIndex).Cells("聯絡人3MAIL").Value.ToString
- TextBox25.Text = DataGridView1.Rows(e.RowIndex).Cells("聯3LINE_唯信").Value.ToString : TextBox26.Text = DataGridView1.Rows(e.RowIndex).Cells("統一編號").Value.ToString
- ComboBox1.Text = DataGridView1.Rows(e.RowIndex).Cells("付款方式").Value.ToString : NumericUpDown1.Value = DataGridView1.Rows(e.RowIndex).Cells("請款日").Value.ToString
- NumericUpDown2.Value = DataGridView1.Rows(e.RowIndex).Cells("票據日").Value.ToString : NumericUpDown3.Value = DataGridView1.Rows(e.RowIndex).Cells("折扣").Value.ToString
- NumericUpDown4.Value = DataGridView1.Rows(e.RowIndex).Cells("稅率").Value.ToString : ComboBox2.Text = DataGridView1.Rows(e.RowIndex).Cells("幣別").Value.ToString
- TextBox28.Text = DataGridView1.Rows(e.RowIndex).Cells("備註").Value.ToString : CheckBox1.Checked = DataGridView1.Rows(e.RowIndex).Cells("外貿").Value
- CheckBox2.Checked = DataGridView1.Rows(e.RowIndex).Cells("停用").Value
- End If
- End Sub
- Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox1.SelectedIndexChanged
- PA1 = ComboBox1.Text : SQL_付款方式_編號()
- If dr.Read() Then : TextBox27.Text = dr("編號") : End If : conn.Close()
- End Sub
- Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
- PA = InputBox("請輸入要查詢的關鍵字")
- Set_供應商清單()
- End Sub
- Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click
- DataGridView1.Enabled = False
- TextBox2.Text = "" : TextBox3.Text = "" : TextBox4.Text = "" : TextBox5.Text = "" : TextBox6.Text = "" : TextBox7.Text = "" : TextBox8.Text = "" : TextBox9.Text = ""
- TextBox10.Text = "" : TextBox11.Text = "" : TextBox12.Text = "" : TextBox13.Text = "" : TextBox14.Text = "" : TextBox15.Text = "" : TextBox16.Text = "" : TextBox17.Text = ""
- TextBox18.Text = "" : TextBox19.Text = "" : TextBox20.Text = "" : TextBox21.Text = "" : TextBox22.Text = "" : TextBox23.Text = "" : TextBox24.Text = "" : TextBox25.Text = ""
- TextBox26.Text = "" : NumericUpDown1.Value = 0 : NumericUpDown2.Value = 0 : NumericUpDown3.Value = 0 : NumericUpDown4.Value = 0 : ComboBox2.Text = "NTD" : TextBox28.Text = ""
- TextBox27.Text = "" : CheckBox1.Checked = False : CheckBox2.Checked = False : ComboBox1下拉表單資料載入()
- '----------------------自动生成流水号-------------------------------------------------------------------------
- SQL_供應商資料表流水號最後一筆()
- If dr.Read() Then : EDR = Double.Parse(Strings.Right(dr("編號").ToString, 8)) : Else : EDR = 0 : End If : conn.Close() : EDR += 1
- If EDR < 10 Then : ESTR = "FI" & "0000000" & EDR
- ElseIf EDR > 9 And EDR < 100 Then : ESTR = "FI" & "000000" & EDR
- ElseIf EDR > 99 And EDR < 1000 Then : ESTR = "FI" & "00000" & EDR
- ElseIf EDR > 999 And EDR < 10000 Then : ESTR = "FI" & "0000" & EDR
- ElseIf EDR > 9999 And EDR < 100000 Then : ESTR = "FI" & "000" & EDR
- ElseIf EDR > 99999 And EDR < 100000 Then : ESTR = "FI" & "00" & EDR
- ElseIf EDR > 999999 And EDR < 1000000 Then : ESTR = "FI" & "0" & EDR
- ElseIf EDR > 9999999 Then : ESTR = "FI" & EDR : End If : TextBox1.Text = ESTR
- End Sub
- Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
- If DataGridView1.Enabled = False Then
- If ComboBox1.Text = "" Then : MsgBox("沒有選擇付款方式 。")
- Else
- SQL_供應商資料表新增() : conn.Close()
- MsgBox("資料新增完畢 。") : Set_供應商清單() : PA = "" : DataGridView1.Enabled = True
- End If
- Else
- SQL_供應商資料表修改() : conn.Close()
- MsgBox("資料存檔完畢 。") : Set_供應商清單() : PA = "" : DataGridView1.Enabled = True
- End If
- End Sub
- '-----------------------------滑鼠右鍵------------------------------------------------------------------------------------------------------------------------------------------
- Private Sub 重新整理ToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles 重新整理ToolStripMenuItem.Click
- PA = "" : Set_供應商清單()
- End Sub
- Private Sub 關鍵字查詢ToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles 關鍵字查詢ToolStripMenuItem.Click
- Me.Button3.PerformClick()
- End Sub
- Private Sub 新增供應商資料ToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles 新增供應商資料ToolStripMenuItem.Click
- Me.Button6.PerformClick()
- End Sub
- Private Sub 資料存檔ToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles 資料存檔ToolStripMenuItem.Click
- Me.Button4.PerformClick()
- End Sub
- Private Sub 資料刪除ToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles 資料刪除ToolStripMenuItem.Click
- Dim aa As MsgBoxResult = MsgBox("確定要刪除該筆資料?", MsgBoxStyle.OkCancel)
- If aa = MsgBoxResult.Ok Then
- SQL_供應商資料表刪除() : conn.Close() : MsgBox("刪除完成") : Set_供應商清單() : PA = ""
- End If
- End Sub
- End Class
|