Option Strict Off
Public Class 銷售分析表
    ReadOnly ds1, ds2, ds3, ds4, ds5, ds6, ds7, ds8, ds9, ds10, ds11 As New DataSet
    Dim 首次開啟 As Boolean = False : Dim 比例 As Integer
    Private Sub Set_清單1()
        廠商彙總_dgv.DataSource = Nothing : ds1.Clear()
        廠商彙總_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
        廠商彙總_dgv.ColumnHeadersHeight = 25
        廠商彙總_dgv.AllowUserToAddRows = False
        廠商彙總_dgv.RowTemplate.Height = 30

        PA19 = 業務_cb.Text
        SQL_銷售分析表_廠商彙總()
        da.Fill(ds1) : 廠商彙總_dgv.DataSource = ds1.Tables(0) : conn.Close()

        廠商彙總_dgv.Columns(0).FillWeight = 80 : 廠商彙總_dgv.Columns(1).FillWeight = 100 : 廠商彙總_dgv.Columns(2).FillWeight = 150
        廠商彙總_dgv.Columns(3).FillWeight = 100 : 廠商彙總_dgv.Columns(4).FillWeight = 100
        For I As Integer = 0 To 3 : 廠商彙總_dgv.Columns(I).ReadOnly = True : Next
        廠商彙總_dgv.Columns("成本預估").DefaultCellStyle.Format = "#,##0"
        廠商彙總_dgv.Columns("成本預估").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
        廠商彙總_dgv.Columns("成本預估").HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
        廠商彙總_dgv.Columns("編號").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
        廠商彙總_dgv.Columns("編號").HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
        廠商彙總_dgv.Columns("項次").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
        廠商彙總_dgv.Columns("項次").HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
        For i As Integer = 0 To 廠商彙總_dgv.Rows.Count - 1
            廠商彙總_dgv("項次", i).Value = i + 1
        Next
        Chart1.Series.Clear() : Chart1.ChartAreas(0).AxisX.Minimum = 0
        Chart1.Series.Add("成本預估")
        Chart1.Series("成本預估").ChartType = SeriesChartType.Column
        For i As Integer = 0 To 廠商彙總_dgv.Rows.Count - 1
            If i >= 20 Then : Exit For : Else
                Chart1.Series("成本預估").Points.AddXY(廠商彙總_dgv.Rows(i).Cells("供應商").Value.ToString, 廠商彙總_dgv.Rows(i).Cells("成本預估").Value.ToString)
            End If
        Next
    End Sub
    Private Sub Set_清單2()
        運費_dgv.DataSource = Nothing : ds2.Clear()
        運費_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
        運費_dgv.ColumnHeadersHeight = 25
        運費_dgv.AllowUserToAddRows = False
        運費_dgv.RowTemplate.Height = 25

        PA19 = 業務_cb.Text
        SQL_銷售分析表_運費()
        da.Fill(ds2) : 運費_dgv.DataSource = ds2.Tables(0) : conn.Close()
        運費_dgv.Columns(0).FillWeight = 100 : 運費_dgv.Columns(1).FillWeight = 100 : 運費_dgv.Columns(2).FillWeight = 100
        運費_dgv.Columns(3).FillWeight = 100
        For I As Integer = 0 To 3 : 運費_dgv.Columns(I).ReadOnly = True : Next
        運費_dgv.Columns("運費").DefaultCellStyle.Format = "#,##0"
        運費_dgv.Columns("運費").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
        運費_dgv.Columns("運費").HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
        運費_dgv.Columns("單號").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
        運費_dgv.Columns("單號").HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
        運費_dgv.Columns("項次").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
        運費_dgv.Columns("項次").HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
        For i As Integer = 0 To 運費_dgv.Rows.Count - 1
            運費_dgv("項次", i).Value = i + 1
        Next : Set_清單7()
    End Sub
    Private Sub Set_清單3()
        銷售它項_dgv.DataSource = Nothing : ds3.Clear()
        銷售它項_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
        銷售它項_dgv.ColumnHeadersHeight = 25
        銷售它項_dgv.AllowUserToAddRows = False
        銷售它項_dgv.RowTemplate.Height = 25

        PA19 = 業務_cb.Text
        SQL_銷售分析表_它項明細()
        da.Fill(ds3) : 銷售它項_dgv.DataSource = ds3.Tables(0) : conn.Close()
        銷售它項_dgv.Columns(0).FillWeight = 80 : 銷售它項_dgv.Columns(1).FillWeight = 110 : 銷售它項_dgv.Columns(2).FillWeight = 110
        銷售它項_dgv.Columns(3).FillWeight = 110 : 銷售它項_dgv.Columns(4).FillWeight = 200 : 銷售它項_dgv.Columns(5).Visible = False : 銷售它項_dgv.Columns(6).Visible = False
        銷售它項_dgv.Columns(7).Visible = False : 銷售它項_dgv.Columns(8).FillWeight = 200 : 銷售它項_dgv.Columns(9).FillWeight = 80 : 銷售它項_dgv.Columns(10).FillWeight = 80
        銷售它項_dgv.Columns(11).FillWeight = 80 : 銷售它項_dgv.Columns(12).Visible = False : 銷售它項_dgv.Columns(13).Visible = False : 銷售它項_dgv.Columns(14).Visible = False
        For I As Integer = 0 To 14 : 銷售它項_dgv.Columns(I).ReadOnly = True : Next
        銷售它項_dgv.Columns("數量").DefaultCellStyle.Format = "#,##0" : 銷售它項_dgv.Columns("成本").DefaultCellStyle.Format = "#,##0"
        銷售它項_dgv.Columns("單價").DefaultCellStyle.Format = "#,##0" : 銷售它項_dgv.Columns("售價").DefaultCellStyle.Format = "#,##0"
        銷售它項_dgv.Columns("數量").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
        銷售它項_dgv.Columns("數量").HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
        銷售它項_dgv.Columns("成本").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
        銷售它項_dgv.Columns("成本").HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
        銷售它項_dgv.Columns("單價").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
        銷售它項_dgv.Columns("單價").HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
        銷售它項_dgv.Columns("售價").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
        銷售它項_dgv.Columns("售價").HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
        銷售它項_dgv.Columns("項次").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
        銷售它項_dgv.Columns("項次").HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
        銷售它項_dgv.Columns("倉儲情況").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
        銷售它項_dgv.Columns("倉儲情況").HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
        銷售它項_dgv.Columns("料號").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
        銷售它項_dgv.Columns("料號").HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
        銷售它項_dgv.Columns("單號").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
        銷售它項_dgv.Columns("單號").HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
        For i As Integer = 0 To 銷售它項_dgv.Rows.Count - 1
            If 銷售它項_dgv("含稅", i).Value = False Then
                銷售它項_dgv("售價", i).Value = 銷售它項_dgv("數量", i).Value * 銷售它項_dgv("單價", i).Value
            ElseIf 銷售它項_dgv("含稅", i).Value = True Then
                銷售它項_dgv("售價", i).Value = 銷售它項_dgv("數量", i).Value * 銷售它項_dgv("單價", i).Value * 1.05
            End If
            銷售它項_dgv("項次", i).Value = i + 1
        Next : Set_清單10()
    End Sub
    Private Sub Set_清單4()
        銷售明細_dgv.DataSource = Nothing : ds4.Clear()
        銷售明細_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
        銷售明細_dgv.ColumnHeadersHeight = 25
        銷售明細_dgv.AllowUserToAddRows = False
        If 小間距_ch.Checked = False And 中間距_ch.Checked = False And 大間距_ch.Checked = True Then
            銷售明細_dgv.RowTemplate.Height = 95
        ElseIf 小間距_ch.Checked = False And 中間距_ch.Checked = True And 大間距_ch.Checked = False Then
            銷售明細_dgv.RowTemplate.Height = 60
        ElseIf 小間距_ch.Checked = True And 中間距_ch.Checked = False And 大間距_ch.Checked = False Then
            銷售明細_dgv.RowTemplate.Height = 25
        End If

        PA19 = 業務_cb.Text
        SQL_銷售分析表_物料明細()
        da.Fill(ds4) : 銷售明細_dgv.DataSource = ds4.Tables(0) : conn.Close()
        銷售明細_dgv.Columns(0).FillWeight = 80 : 銷售明細_dgv.Columns(1).FillWeight = 110 : 銷售明細_dgv.Columns(2).FillWeight = 110
        銷售明細_dgv.Columns(3).FillWeight = 110 : 銷售明細_dgv.Columns(4).FillWeight = 200 : 銷售明細_dgv.Columns(5).FillWeight = 90 : 銷售明細_dgv.Columns(6).FillWeight = 160
        銷售明細_dgv.Columns(7).FillWeight = 90 : 銷售明細_dgv.Columns(8).FillWeight = 200 : 銷售明細_dgv.Columns(9).FillWeight = 80 : 銷售明細_dgv.Columns(10).FillWeight = 80
        銷售明細_dgv.Columns(11).FillWeight = 80 : 銷售明細_dgv.Columns(12).FillWeight = 50 : 銷售明細_dgv.Columns(13).FillWeight = 80 : 銷售明細_dgv.Columns(14).Visible = False
        For I As Integer = 0 To 14 : 銷售明細_dgv.Columns(I).ReadOnly = True : Next
        銷售明細_dgv.Columns("數量").DefaultCellStyle.Format = "#,##0" : 銷售明細_dgv.Columns("成本").DefaultCellStyle.Format = "#,##0"
        銷售明細_dgv.Columns("單價").DefaultCellStyle.Format = "#,##0.0" : 銷售明細_dgv.Columns("售價").DefaultCellStyle.Format = "#,##0"
        銷售明細_dgv.Columns("數量").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
        銷售明細_dgv.Columns("數量").HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
        銷售明細_dgv.Columns("成本").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
        銷售明細_dgv.Columns("成本").HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
        銷售明細_dgv.Columns("單價").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
        銷售明細_dgv.Columns("單價").HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
        銷售明細_dgv.Columns("售價").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
        銷售明細_dgv.Columns("售價").HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
        銷售明細_dgv.Columns("項次").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
        銷售明細_dgv.Columns("項次").HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
        銷售明細_dgv.Columns("倉儲情況").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
        銷售明細_dgv.Columns("倉儲情況").HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
        銷售明細_dgv.Columns("料號").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
        銷售明細_dgv.Columns("料號").HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
        銷售明細_dgv.Columns("單號").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
        銷售明細_dgv.Columns("單號").HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
        For i As Integer = 0 To 銷售明細_dgv.Rows.Count - 1
            If 銷售明細_dgv("含稅", i).Value = False Then
                銷售明細_dgv("售價", i).Value = 銷售明細_dgv("數量", i).Value * 銷售明細_dgv("單價", i).Value
            ElseIf 銷售明細_dgv("含稅", i).Value = True Then
                銷售明細_dgv("售價", i).Value = 銷售明細_dgv("數量", i).Value * 銷售明細_dgv("單價", i).Value * 1.05
            End If
            銷售明細_dgv("項次", i).Value = i + 1
        Next : Set_清單9()
    End Sub
    Private Sub Set_清單5()
        銷售備註_dgv.DataSource = Nothing : ds5.Clear()
        銷售備註_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
        銷售備註_dgv.ColumnHeadersHeight = 25
        銷售備註_dgv.AllowUserToAddRows = False
        銷售備註_dgv.RowTemplate.Height = 25

        PA19 = 業務_cb.Text
        SQL_銷售分析表_銷售備註()
        da.Fill(ds5) : 銷售備註_dgv.DataSource = ds5.Tables(0) : conn.Close()
        銷售備註_dgv.Columns(0).FillWeight = 80 : 銷售備註_dgv.Columns(1).FillWeight = 150 : 銷售備註_dgv.Columns(2).FillWeight = 480
        銷售備註_dgv.Columns(3).FillWeight = 120
        For I As Integer = 0 To 3 : 銷售備註_dgv.Columns(I).ReadOnly = True : Next
        銷售備註_dgv.Columns("收入").DefaultCellStyle.Format = "#,##0" : 銷售備註_dgv.Columns("支出").DefaultCellStyle.Format = "#,##0"
        銷售備註_dgv.Columns("收入").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
        銷售備註_dgv.Columns("收入").HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
        銷售備註_dgv.Columns("支出").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
        銷售備註_dgv.Columns("支出").HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
        銷售備註_dgv.Columns("項次").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
        銷售備註_dgv.Columns("項次").HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
        銷售備註_dgv.Columns("單號").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
        銷售備註_dgv.Columns("單號").HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
        For i As Integer = 0 To 銷售備註_dgv.Rows.Count - 1
            銷售備註_dgv("項次", i).Value = i + 1
        Next
        Set_清單11()
    End Sub
    Private Sub Set_清單6()
        稅金_dgv.DataSource = Nothing : ds6.Clear()
        稅金_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
        稅金_dgv.ColumnHeadersHeight = 25
        稅金_dgv.AllowUserToAddRows = False
        稅金_dgv.RowTemplate.Height = 25

        PA19 = 業務_cb.Text
        SQL_銷售分析表_稅金()
        da.Fill(ds6) : 稅金_dgv.DataSource = ds6.Tables(0) : conn.Close()
        稅金_dgv.Columns(0).FillWeight = 80 : 稅金_dgv.Columns(1).FillWeight = 120 : 稅金_dgv.Columns(2).FillWeight = 100
        For I As Integer = 0 To 2 : 稅金_dgv.Columns(I).ReadOnly = True : Next
        稅金_dgv.Columns("稅金").DefaultCellStyle.Format = "#,##0"
        稅金_dgv.Columns("稅金").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
        稅金_dgv.Columns("稅金").HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
        稅金_dgv.Columns("項次").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
        稅金_dgv.Columns("項次").HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
        稅金_dgv.Columns("單號").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
        稅金_dgv.Columns("單號").HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
        For i As Integer = 0 To 稅金_dgv.Rows.Count - 1
            稅金_dgv("項次", i).Value = i + 1
        Next : Set_清單8()
    End Sub
    Private Sub Set_合記計算()
        售價小計_tb.Text = "0" : 稅金_tb.Text = "0" : 銷售合計_tb.Text = "0" : 收入小計_tb.Text = "0" : 支出小計_tb.Text = "0" : 額外收支_tb.Text = "0" : 物料成本_tb.Text = "0"
        司機運費_tb.Text = "0" : 管銷費用_tb.Text = "0" : 其他成本_tb.Text = "0"
        For i As Integer = 0 To 銷售明細_dgv.Rows.Count - 1
            售價小計_tb.Text = Val(售價小計_tb.Text) + (銷售明細_dgv("數量", i).Value * 銷售明細_dgv("單價", i).Value)
            If Strings.Left(銷售明細_dgv("料號", i).Value.ToString, 1) <> "Y" Then
                If Strings.Left(銷售明細_dgv("料號", i).Value.ToString, 1) <> 1 Then
                    物料成本_tb.Text = Val(物料成本_tb.Text) + (銷售明細_dgv("數量", i).Value * 銷售明細_dgv("成本", i).Value)
                End If
                If Strings.Left(銷售明細_dgv("料號", i).Value.ToString, 1) = 1 Then
                    其他成本_tb.Text = Val(其他成本_tb.Text) + (銷售明細_dgv("數量", i).Value * 銷售明細_dgv("成本", i).Value)
                End If
            End If
        Next
        For i As Integer = 0 To 稅金_dgv.Rows.Count - 1
            稅金_tb.Text = Val(稅金_tb.Text) + 稅金_dgv("稅金", i).Value
        Next
        管銷費用_tb.Text = Val(物料成本_tb.Text) * 1.06 - Val(物料成本_tb.Text)
        銷售合計_tb.Text = Val(售價小計_tb.Text) + Val(稅金_tb.Text)
        For i As Integer = 0 To 銷售備註_dgv.Rows.Count - 1
            收入小計_tb.Text = Val(收入小計_tb.Text) + 銷售備註_dgv("收入", i).Value
            支出小計_tb.Text = Val(支出小計_tb.Text) + 銷售備註_dgv("支出", i).Value
        Next
        額外收支_tb.Text = Val(收入小計_tb.Text) - Val(支出小計_tb.Text)
        For i As Integer = 0 To 運費_dgv.Rows.Count - 1
            司機運費_tb.Text = Val(司機運費_tb.Text) + 運費_dgv("運費", i).Value
        Next
        For i As Integer = 0 To 銷售它項_dgv.Rows.Count - 1
            其他成本_tb.Text = Val(其他成本_tb.Text) + (銷售它項_dgv("數量", i).Value * 銷售它項_dgv("成本", i).Value) - (銷售它項_dgv("數量", i).Value * 銷售它項_dgv("單價", i).Value)
        Next
        預估利潤_tb.Text = Val(售價小計_tb.Text) + Val(額外收支_tb.Text) - Val(其他成本_tb.Text) - Val(物料成本_tb.Text) - Val(司機運費_tb.Text) - Val(管銷費用_tb.Text)
        For i As Integer = 0 To 廠商彙總_dgv.Rows.Count - 1
            比例 = 廠商彙總_dgv("成本預估", i).Value / Val(物料成本_tb.Text) * 100
            If 比例 > 100 Then : 比例 = 100 : End If
            If 比例 = 0 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._000 : ElseIf 比例 = 1 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._001
            ElseIf 比例 = 2 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._002 : ElseIf 比例 = 3 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._003
            ElseIf 比例 = 4 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._004 : ElseIf 比例 = 5 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._005
            ElseIf 比例 = 6 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._006 : ElseIf 比例 = 7 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._007
            ElseIf 比例 = 8 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._008 : ElseIf 比例 = 9 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._009
            ElseIf 比例 = 10 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._010 : ElseIf 比例 = 11 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._011
            ElseIf 比例 = 12 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._012 : ElseIf 比例 = 13 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._013
            ElseIf 比例 = 14 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._014 : ElseIf 比例 = 15 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._015
            ElseIf 比例 = 16 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._016 : ElseIf 比例 = 17 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._017
            ElseIf 比例 = 18 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._018 : ElseIf 比例 = 19 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._019
            ElseIf 比例 = 20 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._020 : ElseIf 比例 = 21 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._021
            ElseIf 比例 = 22 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._022 : ElseIf 比例 = 23 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._023
            ElseIf 比例 = 24 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._024 : ElseIf 比例 = 25 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._025
            ElseIf 比例 = 26 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._026 : ElseIf 比例 = 27 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._027
            ElseIf 比例 = 28 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._028 : ElseIf 比例 = 29 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._029
            ElseIf 比例 = 30 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._030 : ElseIf 比例 = 31 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._031
            ElseIf 比例 = 32 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._032 : ElseIf 比例 = 33 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._033
            ElseIf 比例 = 34 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._034 : ElseIf 比例 = 35 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._035
            ElseIf 比例 = 36 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._036 : ElseIf 比例 = 37 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._037
            ElseIf 比例 = 38 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._038 : ElseIf 比例 = 39 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._039
            ElseIf 比例 = 40 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._040 : ElseIf 比例 = 41 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._041
            ElseIf 比例 = 42 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._042 : ElseIf 比例 = 43 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._043
            ElseIf 比例 = 44 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._044 : ElseIf 比例 = 45 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._045
            ElseIf 比例 = 46 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._046 : ElseIf 比例 = 47 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._047
            ElseIf 比例 = 48 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._048 : ElseIf 比例 = 49 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._049
            ElseIf 比例 = 50 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._050 : ElseIf 比例 = 51 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._051
            ElseIf 比例 = 52 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._052 : ElseIf 比例 = 53 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._053
            ElseIf 比例 = 54 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._054 : ElseIf 比例 = 55 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._055
            ElseIf 比例 = 56 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._056 : ElseIf 比例 = 57 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._057
            ElseIf 比例 = 58 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._058 : ElseIf 比例 = 59 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._059
            ElseIf 比例 = 60 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._060 : ElseIf 比例 = 61 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._061
            ElseIf 比例 = 62 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._062 : ElseIf 比例 = 63 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._063
            ElseIf 比例 = 64 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._064 : ElseIf 比例 = 65 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._065
            ElseIf 比例 = 66 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._066 : ElseIf 比例 = 67 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._067
            ElseIf 比例 = 68 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._068 : ElseIf 比例 = 69 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._069
            ElseIf 比例 = 70 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._070 : ElseIf 比例 = 71 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._071
            ElseIf 比例 = 72 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._072 : ElseIf 比例 = 73 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._073
            ElseIf 比例 = 74 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._074 : ElseIf 比例 = 75 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._075
            ElseIf 比例 = 76 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._076 : ElseIf 比例 = 77 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._077
            ElseIf 比例 = 78 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._078 : ElseIf 比例 = 79 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._079
            ElseIf 比例 = 80 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._080 : ElseIf 比例 = 81 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._081
            ElseIf 比例 = 82 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._082 : ElseIf 比例 = 83 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._083
            ElseIf 比例 = 84 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._084 : ElseIf 比例 = 85 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._085
            ElseIf 比例 = 86 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._086 : ElseIf 比例 = 87 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._087
            ElseIf 比例 = 88 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._088 : ElseIf 比例 = 89 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._089
            ElseIf 比例 = 90 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._090 : ElseIf 比例 = 91 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._091
            ElseIf 比例 = 92 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._092 : ElseIf 比例 = 93 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._093
            ElseIf 比例 = 94 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._094 : ElseIf 比例 = 95 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._095
            ElseIf 比例 = 96 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._096 : ElseIf 比例 = 97 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._097
            ElseIf 比例 = 98 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._098 : ElseIf 比例 = 99 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._099
            ElseIf 比例 >= 100 Then : 廠商彙總_dgv.Rows(i).Cells("成本佔比").Value = My.Resources._100 : End If
        Next
        售價小計_tb.Text = Format(Val(售價小計_tb.Text), "#,##0") : 稅金_tb.Text = Format(Val(稅金_tb.Text), "#,##0") : 銷售合計_tb.Text = Format(Val(銷售合計_tb.Text), "#,##0")
        收入小計_tb.Text = Format(Val(收入小計_tb.Text), "#,##0") : 支出小計_tb.Text = Format(Val(支出小計_tb.Text), "#,##0") : 額外收支_tb.Text = Format(Val(額外收支_tb.Text), "#,##0")
        司機運費_tb.Text = Format(Val(司機運費_tb.Text), "#,##0") : 管銷費用_tb.Text = Format(Val(管銷費用_tb.Text), "#,##0") : 預估利潤_tb.Text = Format(Val(預估利潤_tb.Text), "#,##0")
        物料成本_tb.Text = Format(Val(物料成本_tb.Text), "#,##0") : 其他成本_tb.Text = Format(Val(其他成本_tb.Text), "#,##0")
    End Sub
    Private Sub Set_清單7()
        運費1_dgv.DataSource = Nothing : ds7.Clear()
        運費1_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
        運費1_dgv.ColumnHeadersHeight = 25
        運費1_dgv.AllowUserToAddRows = False
        運費1_dgv.RowTemplate.Height = 22

        PA19 = 業務_cb.Text
        SQL_銷售分析表_運費1()
        da.Fill(ds7) : 運費1_dgv.DataSource = ds7.Tables(0) : conn.Close()
        運費1_dgv.Columns(0).FillWeight = 50 : 運費1_dgv.Columns(1).FillWeight = 100 : 運費1_dgv.Columns(2).FillWeight = 100
        For I As Integer = 0 To 2 : 運費1_dgv.Columns(I).ReadOnly = True : Next
        運費1_dgv.Columns("運費").DefaultCellStyle.Format = "#,##0"
        運費1_dgv.Columns("運費").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
        運費1_dgv.Columns("運費").HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
        運費1_dgv.Columns("送貨地點").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
        運費1_dgv.Columns("送貨地點").HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
        運費1_dgv.Columns("項次").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
        運費1_dgv.Columns("項次").HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
        Chart2.Series.Clear()
        Chart2.Series.Add("送貨地點") : Chart2.Series("送貨地點").ChartType = SeriesChartType.Pie
        Chart2.Series("送貨地點").IsValueShownAsLabel = True
        Chart2.Series("送貨地點").IsVisibleInLegend = True
        Chart2.Series("送貨地點").IsXValueIndexed = True
        For i As Integer = 0 To 運費1_dgv.Rows.Count - 1
            運費1_dgv("項次", i).Value = i + 1
            Chart2.Series("送貨地點").Points.AddXY(運費1_dgv.Rows(i).Cells("送貨地點").Value.ToString, Format(運費1_dgv.Rows(i).Cells("運費").Value, "#,##0"))
        Next
    End Sub
    Private Sub Set_清單8()
        稅金1_dgv.DataSource = Nothing : ds8.Clear()
        稅金1_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
        稅金1_dgv.ColumnHeadersHeight = 25
        稅金1_dgv.AllowUserToAddRows = False
        稅金1_dgv.RowTemplate.Height = 22

        PA19 = 業務_cb.Text
        SQL_銷售分析表_稅金1()
        da.Fill(ds8) : 稅金1_dgv.DataSource = ds8.Tables(0) : conn.Close()
        稅金1_dgv.Columns(0).FillWeight = 50 : 稅金1_dgv.Columns(1).FillWeight = 100 : 稅金1_dgv.Columns(2).FillWeight = 100
        For I As Integer = 0 To 2 : 稅金1_dgv.Columns(I).ReadOnly = True : Next
        稅金1_dgv.Columns("稅金").DefaultCellStyle.Format = "#,##0"
        稅金1_dgv.Columns("稅金").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
        稅金1_dgv.Columns("稅金").HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
        稅金1_dgv.Columns("項次").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
        稅金1_dgv.Columns("項次").HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
        稅金1_dgv.Columns("業務").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
        稅金1_dgv.Columns("業務").HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
        Chart3.Series.Clear()
        Chart3.Series.Add("業務") : Chart3.Series("業務").ChartType = SeriesChartType.Pie
        Chart3.Series("業務").IsValueShownAsLabel = True
        Chart3.Series("業務").IsVisibleInLegend = True
        Chart3.Series("業務").IsXValueIndexed = True
        For i As Integer = 0 To 稅金1_dgv.Rows.Count - 1
            稅金1_dgv("項次", i).Value = i + 1
            Chart3.Series("業務").Points.AddXY(稅金1_dgv.Rows(i).Cells("業務").Value.ToString, Format(稅金1_dgv.Rows(i).Cells("稅金").Value, "#,##0"))
        Next
    End Sub
    Private Sub Set_清單9()
        銷售明細1_dgv.DataSource = Nothing : ds9.Clear()
        銷售明細1_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
        銷售明細1_dgv.ColumnHeadersHeight = 25
        銷售明細1_dgv.AllowUserToAddRows = False
        銷售明細1_dgv.RowTemplate.Height = 22

        PA19 = 業務_cb.Text
        SQL_銷售分析表_物料明細1()
        da.Fill(ds9) : 銷售明細1_dgv.DataSource = ds9.Tables(0) : conn.Close()
        銷售明細1_dgv.Columns(0).FillWeight = 50 : 銷售明細1_dgv.Columns(1).FillWeight = 100 : 銷售明細1_dgv.Columns(2).FillWeight = 100
        For I As Integer = 0 To 2 : 銷售明細1_dgv.Columns(I).ReadOnly = True : Next
        銷售明細1_dgv.Columns("銷售").DefaultCellStyle.Format = "#,##0"
        銷售明細1_dgv.Columns("銷售").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
        銷售明細1_dgv.Columns("銷售").HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
        銷售明細1_dgv.Columns("項次").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
        銷售明細1_dgv.Columns("項次").HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
        銷售明細1_dgv.Columns("業務").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
        銷售明細1_dgv.Columns("業務").HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
        Chart4.Series.Clear()
        Chart4.Series.Add("業務") : Chart4.Series("業務").ChartType = SeriesChartType.Pie
        Chart4.Series("業務").IsValueShownAsLabel = True
        Chart4.Series("業務").IsVisibleInLegend = True
        Chart4.Series("業務").IsXValueIndexed = True
        For i As Integer = 0 To 銷售明細1_dgv.Rows.Count - 1
            銷售明細1_dgv("項次", i).Value = i + 1
            Chart4.Series("業務").Points.AddXY(銷售明細1_dgv.Rows(i).Cells("業務").Value.ToString, Format(銷售明細1_dgv.Rows(i).Cells("銷售").Value, "#,##0"))
        Next
    End Sub
    Private Sub Set_清單10()
        銷售它項1_dgv.DataSource = Nothing : ds10.Clear()
        銷售它項1_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
        銷售它項1_dgv.ColumnHeadersHeight = 25
        銷售它項1_dgv.AllowUserToAddRows = False
        銷售它項1_dgv.RowTemplate.Height = 22

        PA19 = 業務_cb.Text
        SQL_銷售分析表_它項明細1()
        da.Fill(ds10) : 銷售它項1_dgv.DataSource = ds10.Tables(0) : conn.Close()
        銷售它項1_dgv.Columns(0).FillWeight = 50 : 銷售它項1_dgv.Columns(1).FillWeight = 100 : 銷售它項1_dgv.Columns(2).FillWeight = 100
        For I As Integer = 0 To 2 : 銷售它項1_dgv.Columns(I).ReadOnly = True : Next
        銷售它項1_dgv.Columns("它項收支").DefaultCellStyle.Format = "#,##0"
        銷售它項1_dgv.Columns("它項收支").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
        銷售它項1_dgv.Columns("它項收支").HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
        銷售它項1_dgv.Columns("銷售它項").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
        銷售它項1_dgv.Columns("銷售它項").HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
        銷售它項1_dgv.Columns("項次").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
        銷售它項1_dgv.Columns("項次").HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
        Chart5.Series.Clear() : Chart5.ChartAreas(0).AxisX.Minimum = 0
        Chart5.Series.Add("它項收支")
        Chart5.Series("它項收支").ChartType = SeriesChartType.Column
        For i As Integer = 0 To 銷售它項1_dgv.Rows.Count - 1
            銷售它項1_dgv("項次", i).Value = i + 1
            If i >= 20 Then : Exit For : Else
                Chart5.Series("它項收支").Points.AddXY(銷售它項1_dgv.Rows(i).Cells("銷售它項").Value.ToString, 銷售它項1_dgv.Rows(i).Cells("它項收支").Value.ToString)
            End If
        Next
    End Sub
    Private Sub Set_清單11()
        銷售備註1_dgv.DataSource = Nothing : ds11.Clear()
        銷售備註1_dgv.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing
        銷售備註1_dgv.ColumnHeadersHeight = 25
        銷售備註1_dgv.AllowUserToAddRows = False
        銷售備註1_dgv.RowTemplate.Height = 22

        PA19 = 業務_cb.Text
        SQL_銷售分析表_銷售備註1()
        da.Fill(ds11) : 銷售備註1_dgv.DataSource = ds11.Tables(0) : conn.Close()
        銷售備註1_dgv.Columns(0).FillWeight = 50 : 銷售備註1_dgv.Columns(1).FillWeight = 100 : 銷售備註1_dgv.Columns(2).FillWeight = 100
        For I As Integer = 0 To 2 : 銷售備註1_dgv.Columns(I).ReadOnly = True : Next
        銷售備註1_dgv.Columns("其他收支").DefaultCellStyle.Format = "#,##0"
        銷售備註1_dgv.Columns("其他收支").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
        銷售備註1_dgv.Columns("其他收支").HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
        銷售備註1_dgv.Columns("項次").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
        銷售備註1_dgv.Columns("項次").HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
        銷售備註1_dgv.Columns("業務").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
        銷售備註1_dgv.Columns("業務").HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
        Chart6.Series.Clear() : Chart6.ChartAreas(0).AxisX.Minimum = 0
        Chart6.Series.Add("其他收支")
        Chart6.Series("其他收支").ChartType = SeriesChartType.Column
        For i As Integer = 0 To 銷售備註1_dgv.Rows.Count - 1
            銷售備註1_dgv("項次", i).Value = i + 1
            If i >= 20 Then : Exit For : Else
                Chart6.Series("其他收支").Points.AddXY(銷售備註1_dgv.Rows(i).Cells("業務").Value.ToString, 銷售備註1_dgv.Rows(i).Cells("其他收支").Value.ToString)
            End If
        Next
    End Sub
    Private Sub 銷售分析表_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Me.MdiParent = YD_ERP_SYS : Me.WindowState = 2 : Me.AutoScroll = True
        中間距_ch.Checked = True '--------------------控件隱藏、操作許可設定與其他基本顯示設定
        依開單日期_ch.Checked = False : 依交貨日期_ch.Checked = True : 報表_bt.Enabled = False : 圖表_bt.Enabled = True : Panel1.Visible = True : Panel2.Visible = False
        開始日期_dtp.Value = Today() : 結束日期_dtp.Value = Today()
        日期格式()
        首次開啟 = True
        If YD_ERP_SYS.Size.Width > 1440 And YD_ERP_SYS.Size.Height > 900 Then
            字體_NUD.Value = 9
        ElseIf YD_ERP_SYS.Size.Width <= 1440 And YD_ERP_SYS.Size.Height <= 900 Then
            字體_NUD.Value = 8
        End If
    End Sub
    Private Sub 銷售分析表_SizeChanged(sender As Object, e As EventArgs) Handles MyBase.SizeChanged
        If YD_ERP_SYS.Size.Width > 1440 And YD_ERP_SYS.Size.Height > 900 Then
            字體_NUD.Value = 9
        ElseIf YD_ERP_SYS.Size.Width <= 1440 And YD_ERP_SYS.Size.Height <= 900 Then
            字體_NUD.Value = 8
        End If
    End Sub
    Dim 已超出 As Boolean
    Private Sub 銷售明細_dgv_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles 銷售明細_dgv.MouseUp
        If 銷售明細_dgv.SelectedCells.Count = 1 Then : 已超出 = False : End If
        If 銷售明細_dgv.SelectedCells.Count > 0 Then
            If 銷售明細_dgv.SelectedCells(0).ColumnIndex = 13 Then
                If 已超出 = False Then
                    Dim x As Double = 0
                    For i As Integer = 0 To 銷售明細_dgv.SelectedCells.Count - 1
                        x += Val(銷售明細_dgv.Rows(銷售明細_dgv.SelectedCells.Item(i).RowIndex).Cells(銷售明細_dgv.SelectedCells.Item(i).ColumnIndex).Value)
                    Next i : YD_ERP_SYS.合計_TSSL.Text = "合計 : " & Strings.Format(x, "#,##0")
                Else : YD_ERP_SYS.合計_TSSL.Text = "合計 : " & Strings.Format(0, "#,##0") : End If
            Else : 已超出 = True : YD_ERP_SYS.合計_TSSL.Text = "合計 : " & Strings.Format(0, "#,##0")
            End If
        End If
        'If 銷售明細_dgv.SelectedCells.Count = 1 Then : MsgBox(銷售明細_dgv.SelectedCells(0).ColumnIndex & "  " & 銷售明細_dgv.SelectedCells(0).RowIndex) : End If
    End Sub
    Private Sub 銷售它項_dgv_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles 銷售它項_dgv.MouseUp
        If 銷售它項_dgv.SelectedCells.Count = 1 Then : 已超出 = False : End If
        If 銷售它項_dgv.SelectedCells.Count > 0 Then
            If 銷售它項_dgv.SelectedCells(0).ColumnIndex >= 10 And 銷售它項_dgv.SelectedCells(0).ColumnIndex <= 11 Then
                If 已超出 = False Then
                    Dim x As Double = 0
                    For i As Integer = 0 To 銷售它項_dgv.SelectedCells.Count - 1
                        x += Val(銷售它項_dgv.Rows(銷售它項_dgv.SelectedCells.Item(i).RowIndex).Cells(銷售它項_dgv.SelectedCells.Item(i).ColumnIndex).Value)
                    Next i : YD_ERP_SYS.合計_TSSL.Text = "合計 : " & Strings.Format(x, "#,##0")
                Else : YD_ERP_SYS.合計_TSSL.Text = "合計 : " & Strings.Format(0, "#,##0") : End If
            Else : 已超出 = True : YD_ERP_SYS.合計_TSSL.Text = "合計 : " & Strings.Format(0, "#,##0")
            End If
        End If
        'If 銷售它項_dgv.SelectedCells.Count = 1 Then : MsgBox(銷售它項_dgv.SelectedCells(0).ColumnIndex & "  " & 銷售它項_dgv.SelectedCells(0).RowIndex) : End If
    End Sub
    Private Sub 銷售備註_dgv_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles 銷售備註_dgv.MouseUp
        If 銷售備註_dgv.SelectedCells.Count = 1 Then : 已超出 = False : End If
        If 銷售備註_dgv.SelectedCells.Count > 0 Then
            If 銷售備註_dgv.SelectedCells(0).ColumnIndex >= 3 And 銷售備註_dgv.SelectedCells(0).ColumnIndex <= 4 Then
                If 已超出 = False Then
                    Dim x As Double = 0
                    For i As Integer = 0 To 銷售備註_dgv.SelectedCells.Count - 1
                        x += Val(銷售備註_dgv.Rows(銷售備註_dgv.SelectedCells.Item(i).RowIndex).Cells(銷售備註_dgv.SelectedCells.Item(i).ColumnIndex).Value)
                    Next i : YD_ERP_SYS.合計_TSSL.Text = "合計 : " & Strings.Format(x, "#,##0")
                Else : YD_ERP_SYS.合計_TSSL.Text = "合計 : " & Strings.Format(0, "#,##0") : End If
            Else : 已超出 = True : YD_ERP_SYS.合計_TSSL.Text = "合計 : " & Strings.Format(0, "#,##0")
            End If
        End If
        'If 銷售備註_dgv.SelectedCells.Count = 1 Then : MsgBox(銷售備註_dgv.SelectedCells(0).ColumnIndex & "  " & 銷售備註_dgv.SelectedCells(0).RowIndex) : End If
    End Sub
    Private Sub 稅金_dgv_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles 稅金_dgv.MouseUp
        'If 稅金_dgv.SelectedCells.Count = 1 Then : MsgBox(稅金_dgv.SelectedCells(0).ColumnIndex & "  " & 稅金_dgv.SelectedCells(0).RowIndex) : End If
        If 稅金_dgv.SelectedCells.Count = 1 Then : 已超出 = False : End If
        If 稅金_dgv.SelectedCells.Count > 0 Then
            If 稅金_dgv.SelectedCells(0).ColumnIndex = 2 Then
                If 已超出 = False Then
                    Dim x As Double = 0
                    For i As Integer = 0 To 稅金_dgv.SelectedCells.Count - 1
                        x += Val(稅金_dgv.Rows(稅金_dgv.SelectedCells.Item(i).RowIndex).Cells(稅金_dgv.SelectedCells.Item(i).ColumnIndex).Value)
                    Next i : YD_ERP_SYS.合計_TSSL.Text = "合計 : " & Strings.Format(x, "#,##0")
                Else : YD_ERP_SYS.合計_TSSL.Text = "合計 : " & Strings.Format(0, "#,##0") : End If
            Else : 已超出 = True : YD_ERP_SYS.合計_TSSL.Text = "合計 : " & Strings.Format(0, "#,##0")
            End If
        End If
    End Sub
    Private Sub 運費_dgv_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles 運費_dgv.MouseUp
        'If 運費_dgv.SelectedCells.Count = 1 Then : MsgBox(運費_dgv.SelectedCells(0).ColumnIndex & "  " & 運費_dgv.SelectedCells(0).RowIndex) : End If
        If 運費_dgv.SelectedCells.Count = 1 Then : 已超出 = False : End If
        If 運費_dgv.SelectedCells.Count > 0 Then
            If 運費_dgv.SelectedCells(0).ColumnIndex = 3 Then
                If 已超出 = False Then
                    Dim x As Double = 0
                    For i As Integer = 0 To 運費_dgv.SelectedCells.Count - 1
                        x += Val(運費_dgv.Rows(運費_dgv.SelectedCells.Item(i).RowIndex).Cells(運費_dgv.SelectedCells.Item(i).ColumnIndex).Value)
                    Next i : YD_ERP_SYS.合計_TSSL.Text = "合計 : " & Strings.Format(x, "#,##0")
                Else : YD_ERP_SYS.合計_TSSL.Text = "合計 : " & Strings.Format(0, "#,##0") : End If
            Else : 已超出 = True : YD_ERP_SYS.合計_TSSL.Text = "合計 : " & Strings.Format(0, "#,##0")
            End If
        End If
    End Sub
    Private Sub 廠商彙總_dgv_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles 廠商彙總_dgv.MouseUp
        'If 廠商彙總_dgv.SelectedCells.Count = 1 Then : MsgBox(廠商彙總_dgv.SelectedCells(0).ColumnIndex & "  " & 廠商彙總_dgv.SelectedCells(0).RowIndex) : End If
        If 廠商彙總_dgv.SelectedCells.Count = 1 Then : 已超出 = False : End If
        If 廠商彙總_dgv.SelectedCells.Count > 0 Then
            If 廠商彙總_dgv.SelectedCells(0).ColumnIndex = 3 Then
                If 已超出 = False Then
                    Dim x As Double = 0
                    For i As Integer = 0 To 廠商彙總_dgv.SelectedCells.Count - 1
                        x += Val(廠商彙總_dgv.Rows(廠商彙總_dgv.SelectedCells.Item(i).RowIndex).Cells(廠商彙總_dgv.SelectedCells.Item(i).ColumnIndex).Value)
                    Next i : YD_ERP_SYS.合計_TSSL.Text = "合計 : " & Strings.Format(x, "#,##0")
                Else : YD_ERP_SYS.合計_TSSL.Text = "合計 : " & Strings.Format(0, "#,##0") : End If
            Else : 已超出 = True : YD_ERP_SYS.合計_TSSL.Text = "合計 : " & Strings.Format(0, "#,##0")
            End If
        End If
    End Sub
    Private Sub 銷售明細1_dgv_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles 銷售明細1_dgv.MouseUp
        'If 銷售明細1_dgv.SelectedCells.Count = 1 Then : MsgBox(銷售明細1_dgv.SelectedCells(0).ColumnIndex & "  " & 銷售明細1_dgv.SelectedCells(0).RowIndex) : End If
        If 銷售明細1_dgv.SelectedCells.Count = 1 Then : 已超出 = False : End If
        If 銷售明細1_dgv.SelectedCells.Count > 0 Then
            If 銷售明細1_dgv.SelectedCells(0).ColumnIndex = 2 Then
                If 已超出 = False Then
                    Dim x As Double = 0
                    For i As Integer = 0 To 銷售明細1_dgv.SelectedCells.Count - 1
                        x += Val(銷售明細1_dgv.Rows(銷售明細1_dgv.SelectedCells.Item(i).RowIndex).Cells(銷售明細1_dgv.SelectedCells.Item(i).ColumnIndex).Value)
                    Next i : YD_ERP_SYS.合計_TSSL.Text = "合計 : " & Strings.Format(x, "#,##0")
                Else : YD_ERP_SYS.合計_TSSL.Text = "合計 : " & Strings.Format(0, "#,##0") : End If
            Else : 已超出 = True : YD_ERP_SYS.合計_TSSL.Text = "合計 : " & Strings.Format(0, "#,##0")
            End If
        End If
    End Sub
    Private Sub 稅金1_dgv_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles 稅金1_dgv.MouseUp
        'If 稅金1_dgv.SelectedCells.Count = 1 Then : MsgBox(稅金1_dgv.SelectedCells(0).ColumnIndex & "  " & 稅金1_dgv.SelectedCells(0).RowIndex) : End If
        If 稅金1_dgv.SelectedCells.Count = 1 Then : 已超出 = False : End If
        If 稅金1_dgv.SelectedCells.Count > 0 Then
            If 稅金1_dgv.SelectedCells(0).ColumnIndex = 2 Then
                If 已超出 = False Then
                    Dim x As Double = 0
                    For i As Integer = 0 To 稅金1_dgv.SelectedCells.Count - 1
                        x += Val(稅金1_dgv.Rows(稅金1_dgv.SelectedCells.Item(i).RowIndex).Cells(稅金1_dgv.SelectedCells.Item(i).ColumnIndex).Value)
                    Next i : YD_ERP_SYS.合計_TSSL.Text = "合計 : " & Strings.Format(x, "#,##0")
                Else : YD_ERP_SYS.合計_TSSL.Text = "合計 : " & Strings.Format(0, "#,##0") : End If
            Else : 已超出 = True : YD_ERP_SYS.合計_TSSL.Text = "合計 : " & Strings.Format(0, "#,##0")
            End If
        End If
    End Sub
    Private Sub 銷售它項1_dgv_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles 銷售它項1_dgv.MouseUp
        'If 銷售它項1_dgv.SelectedCells.Count = 1 Then : MsgBox(銷售它項1_dgv.SelectedCells(0).ColumnIndex & "  " & 銷售它項1_dgv.SelectedCells(0).RowIndex) : End If
        If 銷售它項1_dgv.SelectedCells.Count = 1 Then : 已超出 = False : End If
        If 銷售它項1_dgv.SelectedCells.Count > 0 Then
            If 銷售它項1_dgv.SelectedCells(0).ColumnIndex = 2 Then
                If 已超出 = False Then
                    Dim x As Double = 0
                    For i As Integer = 0 To 銷售它項1_dgv.SelectedCells.Count - 1
                        x += Val(銷售它項1_dgv.Rows(銷售它項1_dgv.SelectedCells.Item(i).RowIndex).Cells(銷售它項1_dgv.SelectedCells.Item(i).ColumnIndex).Value)
                    Next i : YD_ERP_SYS.合計_TSSL.Text = "合計 : " & Strings.Format(x, "#,##0")
                Else : YD_ERP_SYS.合計_TSSL.Text = "合計 : " & Strings.Format(0, "#,##0") : End If
            Else : 已超出 = True : YD_ERP_SYS.合計_TSSL.Text = "合計 : " & Strings.Format(0, "#,##0")
            End If
        End If
    End Sub
    Private Sub 銷售備註1_dgv_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles 銷售備註1_dgv.MouseUp
        'If 銷售備註1_dgv.SelectedCells.Count = 1 Then : MsgBox(銷售備註1_dgv.SelectedCells(0).ColumnIndex & "  " & 銷售備註1_dgv.SelectedCells(0).RowIndex) : End If
        If 銷售備註1_dgv.SelectedCells.Count = 1 Then : 已超出 = False : End If
        If 銷售備註1_dgv.SelectedCells.Count > 0 Then
            If 銷售備註1_dgv.SelectedCells(0).ColumnIndex = 2 Then
                If 已超出 = False Then
                    Dim x As Double = 0
                    For i As Integer = 0 To 銷售備註1_dgv.SelectedCells.Count - 1
                        x += Val(銷售備註1_dgv.Rows(銷售備註1_dgv.SelectedCells.Item(i).RowIndex).Cells(銷售備註1_dgv.SelectedCells.Item(i).ColumnIndex).Value)
                    Next i : YD_ERP_SYS.合計_TSSL.Text = "合計 : " & Strings.Format(x, "#,##0")
                Else : YD_ERP_SYS.合計_TSSL.Text = "合計 : " & Strings.Format(0, "#,##0") : End If
            Else : 已超出 = True : YD_ERP_SYS.合計_TSSL.Text = "合計 : " & Strings.Format(0, "#,##0")
            End If
        End If
    End Sub
    Private Sub 運費1_dgv_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles 運費1_dgv.MouseUp
        'If 運費1_dgv.SelectedCells.Count = 1 Then : MsgBox(運費1_dgv.SelectedCells(0).ColumnIndex & "  " & 運費1_dgv.SelectedCells(0).RowIndex) : End If
        If 運費1_dgv.SelectedCells.Count = 1 Then : 已超出 = False : End If
        If 運費1_dgv.SelectedCells.Count > 0 Then
            If 運費1_dgv.SelectedCells(0).ColumnIndex = 2 Then
                If 已超出 = False Then
                    Dim x As Double = 0
                    For i As Integer = 0 To 運費1_dgv.SelectedCells.Count - 1
                        x += Val(運費1_dgv.Rows(運費1_dgv.SelectedCells.Item(i).RowIndex).Cells(運費1_dgv.SelectedCells.Item(i).ColumnIndex).Value)
                    Next i : YD_ERP_SYS.合計_TSSL.Text = "合計 : " & Strings.Format(x, "#,##0")
                Else : YD_ERP_SYS.合計_TSSL.Text = "合計 : " & Strings.Format(0, "#,##0") : End If
            Else : 已超出 = True : YD_ERP_SYS.合計_TSSL.Text = "合計 : " & Strings.Format(0, "#,##0")
            End If
        End If
    End Sub
    Private Sub 日期格式()
        If 會計月_ch.Checked = True Then
            '-------------日期一----------------------------------------------------------------------------------------
            DTP = Strings.Left(Format(開始日期_dtp.Value, "yyyy/MM/dd"), 8) & "01" : 開始日期_dtp.Value = DTP
            開始日期_dtp.Value = 開始日期_dtp.Value.AddMonths(-1)
            DTP = Strings.Left(Format(開始日期_dtp.Value, "yyyy/MM/dd"), 8) & "26" : 開始日期_dtp.Value = DTP
            '-------------日期二----------------------------------------------------------------------------------------
            DTP = Strings.Left(Format(結束日期_dtp.Value, "yyyy/MM/dd"), 8) & "25" : 結束日期_dtp.Value = DTP
        Else
            '-------------日期一----------------------------------------------------------------------------------------
            開始日期_dtp.Value = 開始日期_dtp.Value.AddMonths(1)
            DTP = Strings.Left(Format(開始日期_dtp.Value, "yyyy/MM/dd"), 8) & "01" : 開始日期_dtp.Value = DTP
            '-------------日期二----------------------------------------------------------------------------------------
            DTP = Strings.Left(Strings.Format(結束日期_dtp.Value, "yyyy/MM/dd"), 8) & "01" : 結束日期_dtp.Value = DTP
            結束日期_dtp.Value = 結束日期_dtp.Value.AddMonths(1) : 結束日期_dtp.Value = 結束日期_dtp.Value.AddDays(-1)
        End If
    End Sub
    Private Sub 窄間距_ch_CheckedChanged(sender As Object, e As EventArgs) Handles 小間距_ch.Click
        小間距_ch.Checked = True : 中間距_ch.Checked = False : 大間距_ch.Checked = False
        Set_清單4()
    End Sub
    Private Sub 中間距_ch_CheckedChanged(sender As Object, e As EventArgs) Handles 中間距_ch.Click
        小間距_ch.Checked = False : 中間距_ch.Checked = True : 大間距_ch.Checked = False
        Set_清單4()
    End Sub
    Private Sub 大間距_ch_CheckedChanged(sender As Object, e As EventArgs) Handles 大間距_ch.Click
        小間距_ch.Checked = False : 中間距_ch.Checked = False : 大間距_ch.Checked = True
        Set_清單4()
    End Sub
    Private Sub 上個月_bt_Click(sender As Object, e As EventArgs) Handles 上個月_bt.Click
        If 會計月_ch.Checked = True Then
            中間日期_dtp.Value = 中間日期_dtp.Value.AddMonths(-1)
            開始日期_dtp.Value = 中間日期_dtp.Value
            結束日期_dtp.Value = 中間日期_dtp.Value
        Else
            中間日期_dtp.Value = 中間日期_dtp.Value.AddMonths(-1)
            開始日期_dtp.Value = 中間日期_dtp.Value.AddMonths(-1)
            結束日期_dtp.Value = 中間日期_dtp.Value
        End If : 日期格式()
    End Sub
    Private Sub 下個月_bt_Click(sender As Object, e As EventArgs) Handles 下個月_bt.Click
        If 會計月_ch.Checked = True Then
            中間日期_dtp.Value = 中間日期_dtp.Value.AddMonths(1)
            開始日期_dtp.Value = 中間日期_dtp.Value
            結束日期_dtp.Value = 中間日期_dtp.Value
        Else
            中間日期_dtp.Value = 中間日期_dtp.Value.AddMonths(1)
            開始日期_dtp.Value = 中間日期_dtp.Value.AddMonths(-1)
            結束日期_dtp.Value = 中間日期_dtp.Value
        End If : 日期格式()
    End Sub
    Private Sub 會計月_CheckedChanged(sender As Object, e As EventArgs) Handles 會計月_ch.Click
        會計月_ch.Checked = True : 一般月_ch.Checked = False : 日期格式()
    End Sub
    Private Sub 一般月_CheckedChanged(sender As Object, e As EventArgs) Handles 一般月_ch.Click
        會計月_ch.Checked = False : 一般月_ch.Checked = True : 日期格式()
    End Sub
    Private Sub 開始日期_dtp_ValueChanged(sender As Object, e As EventArgs) Handles 開始日期_dtp.ValueChanged
        Set_清單1() : Set_清單2() : Set_清單3() : Set_清單4() : Set_清單5() : Set_清單6() : Set_合記計算()
    End Sub
    Private Sub 結束日期_dtp_ValueChanged(sender As Object, e As EventArgs) Handles 結束日期_dtp.ValueChanged
        Set_清單1() : Set_清單2() : Set_清單3() : Set_清單4() : Set_清單5() : Set_清單6() : Set_合記計算()
    End Sub
    Private Sub 業務_cb_SelectedIndexChanged(sender As Object, e As EventArgs) Handles 業務_cb.SelectedIndexChanged
        Set_清單1() : Set_清單2() : Set_清單3() : Set_清單4() : Set_清單5() : Set_清單6() : Set_合記計算()
    End Sub
    Private Sub 銷售明細_dgv_RowPostPaint(ByVal sender As Object, ByVal e As DataGridViewRowPostPaintEventArgs) Handles 銷售明細_dgv.RowPostPaint
        Dim linePen As New Pen(Color.Blue, 2)
        If e.RowIndex = 銷售明細_dgv.Rows.Count - 1 Then : Exit Sub : Else
            If 銷售明細_dgv("單號", e.RowIndex).Value.ToString <> 銷售明細_dgv("單號", e.RowIndex + 1).Value.ToString Then
                Dim startX As Integer = IIf(銷售明細_dgv.RowHeadersVisible, 銷售明細_dgv.RowHeadersWidth, 0) : Dim startY As Integer = e.RowBounds.Top + e.RowBounds.Height - 1
                Dim endX As Integer = startX + 銷售明細_dgv.Columns.GetColumnsWidth(DataGridViewElementStates.Visible) - 銷售明細_dgv.HorizontalScrollingOffset
                e.Graphics.DrawLine(linePen, startX, startY, endX, startY) : Exit Sub
            End If
        End If
    End Sub
    Private Sub 依開單日期_ch_CheckedChanged(sender As Object, e As EventArgs) Handles 依開單日期_ch.Click
        依開單日期_ch.Checked = True : 依交貨日期_ch.Checked = False : Set_清單1() : Set_清單2() : Set_清單3() : Set_清單4() : Set_清單5() : Set_清單6() : Set_合記計算()
    End Sub
    Private Sub 依交貨日期_ch_CheckedChanged(sender As Object, e As EventArgs) Handles 依交貨日期_ch.Click
        依開單日期_ch.Checked = False : 依交貨日期_ch.Checked = True : Set_清單1() : Set_清單2() : Set_清單3() : Set_清單4() : Set_清單5() : Set_清單6() : Set_合記計算()
    End Sub
    Private Sub 重新整理_tsm_Click(sender As Object, e As EventArgs) Handles 重新整理_tsm.Click
        Set_清單1() : Set_清單2() : Set_清單3() : Set_清單4() : Set_清單5() : Set_清單6() : Set_合記計算()
    End Sub
    Private Sub 字體_NUD_ValueChanged(sender As Object, e As EventArgs) Handles 字體_NUD.ValueChanged
        廠商彙總_dgv.RowsDefaultCellStyle.Font = New Font("微軟正黑體", 字體_NUD.Value)
        銷售明細_dgv.RowsDefaultCellStyle.Font = New Font("微軟正黑體", 字體_NUD.Value)
        銷售明細1_dgv.RowsDefaultCellStyle.Font = New Font("微軟正黑體", 字體_NUD.Value)
        運費_dgv.RowsDefaultCellStyle.Font = New Font("微軟正黑體", 字體_NUD.Value)
        運費1_dgv.RowsDefaultCellStyle.Font = New Font("微軟正黑體", 字體_NUD.Value)
        銷售它項_dgv.RowsDefaultCellStyle.Font = New Font("微軟正黑體", 字體_NUD.Value)
        銷售它項1_dgv.RowsDefaultCellStyle.Font = New Font("微軟正黑體", 字體_NUD.Value)
        稅金_dgv.RowsDefaultCellStyle.Font = New Font("微軟正黑體", 字體_NUD.Value)
        稅金1_dgv.RowsDefaultCellStyle.Font = New Font("微軟正黑體", 字體_NUD.Value)
        銷售備註_dgv.RowsDefaultCellStyle.Font = New Font("微軟正黑體", 字體_NUD.Value)
        銷售備註1_dgv.RowsDefaultCellStyle.Font = New Font("微軟正黑體", 字體_NUD.Value)
    End Sub
    Private Sub 報表_bt_Click(sender As Object, e As EventArgs) Handles 報表_bt.Click
        報表_bt.Enabled = False : 圖表_bt.Enabled = True : Panel1.Visible = True : Panel2.Visible = False
    End Sub
    Private Sub 圖表_bt_Click(sender As Object, e As EventArgs) Handles 圖表_bt.Click
        圖表_bt.Enabled = False : 報表_bt.Enabled = True : Panel1.Visible = False : Panel2.Visible = True
    End Sub
End Class