123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142 |
- Option Strict Off
- Public Class 銷售退貨確認
- ReadOnly ds As New DataSet
- Private Sub Set_清單()
- DataGridView1.DataSource = Nothing : ds.Clear() : DataGridView1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
- DataGridView1.ColumnHeadersHeight = 40 : DataGridView1.AllowUserToAddRows = False
- SQL_銷售退貨確認清單()
- da.Fill(ds) : DataGridView1.DataSource = ds.Tables(0) : conn.Close()
-
- DataGridView1.Columns(0).Visible = False : DataGridView1.Columns(1).FillWeight = 110 : DataGridView1.Columns(2).Visible = False : DataGridView1.Columns(3).FillWeight = 200
- DataGridView1.Columns(4).Visible = False : DataGridView1.Columns(5).Visible = False : DataGridView1.Columns(6).FillWeight = 60 : DataGridView1.Columns(7).FillWeight = 150
- DataGridView1.Columns(8).FillWeight = 80 : DataGridView1.Columns(9).FillWeight = 80 : DataGridView1.Columns(10).FillWeight = 40 : DataGridView1.Columns(11).FillWeight = 60
- DataGridView1.Columns(12).FillWeight = 40 : DataGridView1.Columns(13).FillWeight = 110 : DataGridView1.Columns(14).FillWeight = 60 : DataGridView1.Columns(15).Visible = False
- DataGridView1.Columns(16).FillWeight = 60 : DataGridView1.Columns(17).FillWeight = 40 : DataGridView1.Columns(18).FillWeight = 60 : DataGridView1.Columns(19).FillWeight = 40
-
- DataGridView1.Columns(6).DefaultCellStyle.Format = "#,##0" : DataGridView1.Columns(17).DefaultCellStyle.Format = "#,##0.0" : DataGridView1.Columns(19).DefaultCellStyle.Format = "#,##0.0"
- DataGridView1.Columns(1).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : DataGridView1.Columns(1).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
- DataGridView1.Columns(2).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : DataGridView1.Columns(2).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
- DataGridView1.Columns(6).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : DataGridView1.Columns(6).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
- DataGridView1.Columns(8).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : DataGridView1.Columns(8).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
- DataGridView1.Columns(9).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : DataGridView1.Columns(9).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
- DataGridView1.Columns(10).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : DataGridView1.Columns(10).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
- DataGridView1.Columns(11).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : DataGridView1.Columns(11).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
- DataGridView1.Columns(12).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : DataGridView1.Columns(12).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
- DataGridView1.Columns(13).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter : DataGridView1.Columns(13).HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
- For I As Integer = 0 To 19 : DataGridView1.Columns(I).ReadOnly = True : Next
- For i As Integer = 0 To DataGridView1.Rows.Count - 1
- DataGridView1.Rows(i).Cells("選擇").Value = False
- If DataGridView1.Rows(i).Cells("業務比例").Value.ToString = "" Then : DataGridView1.Rows(i).Cells("業務比例").Value = 0 : End If
- If DataGridView1.Rows(i).Cells("司機比例").Value.ToString = "" Then : DataGridView1.Rows(i).Cells("司機比例").Value = 0 : End If
- Next
- End Sub
- Private Sub ComboBox6下拉表單資料載入()
- SQL_員工名稱下拉清單()
- ComboBox6.Items.Clear() : ComboBox8.Items.Clear() : While (dr.Read()) : ComboBox6.Items.Add(dr("名稱")) : ComboBox8.Items.Add(dr("名稱")) : End While : conn.Close()
- End Sub
- Private Sub ComboBox7下拉表單資料載入()
- SQL_傭金比例下拉清單()
- ComboBox7.Items.Clear() : ComboBox9.Items.Clear()
- While (dr.Read()) : ComboBox7.Items.Add(Format(dr("比例"), "#,##0.0")) : ComboBox9.Items.Add(Format(dr("比例"), "#,##0.0")) : 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
- ComboBox6下拉表單資料載入() : ComboBox7下拉表單資料載入() : Set_清單()
- End Sub
- Private Sub DataGridView1_CellClick(ByVal sender As System.Object, ByVal e As DataGridViewCellEventArgs) Handles DataGridView1.CellClick
- If e.RowIndex = -1 Then : Else
- ComboBox6下拉表單資料載入() : ComboBox7下拉表單資料載入()
- TextBox3.Text = DataGridView1.Rows(e.RowIndex).Cells("單據編號").Value : TextBox1.Text = DataGridView1.Rows(e.RowIndex).Cells("訂單流水號").Value.ToString
- ComboBox6.Text = DataGridView1.Rows(e.RowIndex).Cells("業務").Value.ToString : ComboBox7.Text = Format(DataGridView1.Rows(e.RowIndex).Cells("業務比例").Value, "#,##0.0")
- ComboBox8.Text = DataGridView1.Rows(e.RowIndex).Cells("司機").Value.ToString : ComboBox9.Text = Format(DataGridView1.Rows(e.RowIndex).Cells("司機比例").Value, "#,##0.0")
- If DataGridView1.Rows(e.RowIndex).Cells("選擇").Value = False And DataGridView1.Rows(e.RowIndex).Cells("司機").Value.ToString <> "" Then
- DataGridView1.Rows(e.RowIndex).Cells("選擇").Value = True
- ElseIf DataGridView1.Rows(e.RowIndex).Cells("司機").Value.ToString = "" Then
- MsgBox("請最少指定送貨司機。") : DataGridView1.Rows(e.RowIndex).Cells("選擇").Value = False
- End If
- End If
- 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(1, e.RowIndex).Value.ToString <> DataGridView1(1, e.RowIndex + 1).Value.ToString 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
- End Sub
- Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
- For i As Integer = 0 To DataGridView1.Rows.Count - 1
- If TextBox3.Text = DataGridView1.Rows(i).Cells("單據編號").Value.ToString Then
- If DataGridView1.Rows(i).Cells("司機").Value.ToString = "" Then
- For ii As Integer = 0 To DataGridView1.Rows.Count - 1
- DataGridView1.Rows(ii).Cells("選擇").Value = False
- Next
- MsgBox("請最少指定送貨司機。")
- Exit For
- End If
- DataGridView1.Rows(i).Cells("選擇").Value = True
- End If
- Next i
- End Sub
- Private Sub Button13_Click(sender As Object, e As EventArgs) Handles Button13.Click
- For i As Integer = 0 To DataGridView1.Rows.Count - 1
- If DataGridView1.Rows(i).Cells("司機").Value.ToString = "" Then
- For ii As Integer = 0 To DataGridView1.Rows.Count - 1
- DataGridView1.Rows(ii).Cells("選擇").Value = False
- Next
- MsgBox("請最少指定送貨司機。")
- Exit For
- End If
- DataGridView1.Rows(i).Cells("選擇").Value = True
- Next i
- End Sub
- Private Sub Button12_Click(sender As Object, e As EventArgs) Handles Button12.Click
- For i As Integer = 0 To DataGridView1.Rows.Count - 1 : DataGridView1.Rows(i).Cells("選擇").Value = False : Next i
- End Sub
- Private Sub Set_日期格式轉換()
- DTP = Format(DateTimePicker1.Value, "yyyy/MM/dd")
- End Sub
- Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
- Set_日期格式轉換() : Dim 出貨情況 As String
- For i As Integer = 0 To DataGridView1.Rows.Count - 1
- 資料數 = DataGridView1.Rows.Count : MyModule1.進度條()
- If DataGridView1.Rows(i).Cells("選擇").Value = True Then
- PA1 = DataGridView1.Rows(i).Cells("資料流水號").Value : SQL_銷售退貨確認_倉儲明細表_銷售出庫確認() : conn.Close()
-
- If TextBox1.Text = "" Then : Else
- If DataGridView1.Rows(i).Cells("出貨備齊").Value = True Then : 出貨情況 = "完全出貨" : Else : 出貨情況 = "分批出貨" : End If
- PA1 = 出貨情況 : PA = TextBox1.Text : SQL_銷售退貨確認_訂單控制表_出貨情況() : conn.Close()
- If 出貨情況 = "完全出貨" Then
- PA = TextBox1.Text : SQL_銷售退貨確認_訂單明細表_出貨情況一() : conn.Close()
- ElseIf 出貨情況 = "分批出貨" Then
- PA = DataGridView1.Rows(i).Cells("訂單明細流水").Value : SQL_銷售退貨確認_訂單明細表_出貨情況二() : conn.Close()
- End If
- End If
- End If
- Next : Set_清單() : MsgBox("退貨單開立完成。") : MAOJI_ERP_SYS.ToolStripProgressBar1.Value = 0 : 最終數 = 0
- End Sub
- Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
- PA1 = ComboBox6.Text : NU1 = ComboBox7.Text : PA2 = ComboBox8.Text : NU2 = ComboBox9.Text : PA = TextBox3.Text
- SQL_出貨單業務司機指定() : Set_清單()
- End Sub
- '-----------------------------滑鼠右鍵------------------------------------------------------------------------------------------------------------------------------------------
- Private Sub 重新整理ToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles 重新整理ToolStripMenuItem.Click
- Set_清單() : DateTimePicker1.Value = Today()
- 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.Button13.PerformClick()
- End Sub
- Private Sub 全部取消ToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles 全部取消ToolStripMenuItem.Click
- Me.Button12.PerformClick()
- End Sub
- Private Sub 確認收料入庫ToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles 確認收料入庫ToolStripMenuItem.Click
- Me.Button4.PerformClick()
- End Sub
- End Class
|