www.pudn.com > SalesManager.rar > frmConAdd.vb
Imports System.Data.OleDb
Public Class frmConAdd
Inherits System.Windows.Forms.Form
#Region " Windows 窗体设计器生成的代码 "
Public Sub New()
MyBase.New()
'该调用是 Windows 窗体设计器所必需的。
InitializeComponent()
'在 InitializeComponent() 调用之后添加任何初始化
End Sub
'窗体重写 dispose 以清理组件列表。
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Windows 窗体设计器所必需的
Private components As System.ComponentModel.IContainer
'注意: 以下过程是 Windows 窗体设计器所必需的
'可以使用 Windows 窗体设计器修改此过程。
'不要使用代码编辑器修改它。
Friend WithEvents btnReset As System.Windows.Forms.Button
Friend WithEvents btnAdd As System.Windows.Forms.Button
Friend WithEvents PictureBox1 As System.Windows.Forms.PictureBox
Friend WithEvents GroupBox2 As System.Windows.Forms.GroupBox
Friend WithEvents btnStockTempDelete As System.Windows.Forms.Button
Friend WithEvents Label60 As System.Windows.Forms.Label
Friend WithEvents Label58 As System.Windows.Forms.Label
Friend WithEvents btnStockTempAdd As System.Windows.Forms.Button
Friend WithEvents nudStockNumber As System.Windows.Forms.NumericUpDown
Friend WithEvents btnConCustomerView As System.Windows.Forms.Button
Friend WithEvents cbConCustomer As System.Windows.Forms.ComboBox
Friend WithEvents cbConType As System.Windows.Forms.ComboBox
Friend WithEvents cbConPaytype As System.Windows.Forms.ComboBox
Friend WithEvents labConCustomerLevel As System.Windows.Forms.Label
Friend WithEvents Label56 As System.Windows.Forms.Label
Friend WithEvents cbStockProname As System.Windows.Forms.ComboBox
Friend WithEvents dgCon As System.Windows.Forms.DataGrid
Friend WithEvents txtConInprice As System.Windows.Forms.TextBox
Friend WithEvents Label44 As System.Windows.Forms.Label
Friend WithEvents Label45 As System.Windows.Forms.Label
Friend WithEvents Label46 As System.Windows.Forms.Label
Friend WithEvents Label47 As System.Windows.Forms.Label
Friend WithEvents Label48 As System.Windows.Forms.Label
Friend WithEvents Label49 As System.Windows.Forms.Label
Friend WithEvents txtStockPrice As System.Windows.Forms.TextBox
Friend WithEvents txtConID As System.Windows.Forms.TextBox
Friend WithEvents Label50 As System.Windows.Forms.Label
Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox
Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents btnCancel As System.Windows.Forms.Button
Friend WithEvents txtConSum As System.Windows.Forms.TextBox
Friend WithEvents dtpCon As System.Windows.Forms.DateTimePicker
Friend WithEvents myDs As System.Data.DataSet
Friend WithEvents dbTableStyleStockTemp As System.Windows.Forms.DataGridTableStyle
Friend WithEvents pname As System.Windows.Forms.DataGridTextBoxColumn
Friend WithEvents price As System.Windows.Forms.DataGridTextBoxColumn
Friend WithEvents tindex As System.Windows.Forms.DataGridTextBoxColumn
Friend WithEvents tnumber As System.Windows.Forms.DataGridTextBoxColumn
Private Sub InitializeComponent()
Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(frmConAdd))
Me.btnReset = New System.Windows.Forms.Button
Me.btnAdd = New System.Windows.Forms.Button
Me.PictureBox1 = New System.Windows.Forms.PictureBox
Me.GroupBox2 = New System.Windows.Forms.GroupBox
Me.dgCon = New System.Windows.Forms.DataGrid
Me.dbTableStyleStockTemp = New System.Windows.Forms.DataGridTableStyle
Me.tindex = New System.Windows.Forms.DataGridTextBoxColumn
Me.pname = New System.Windows.Forms.DataGridTextBoxColumn
Me.tnumber = New System.Windows.Forms.DataGridTextBoxColumn
Me.price = New System.Windows.Forms.DataGridTextBoxColumn
Me.btnStockTempDelete = New System.Windows.Forms.Button
Me.btnStockTempAdd = New System.Windows.Forms.Button
Me.Label56 = New System.Windows.Forms.Label
Me.txtConInprice = New System.Windows.Forms.TextBox
Me.txtConSum = New System.Windows.Forms.TextBox
Me.Label60 = New System.Windows.Forms.Label
Me.txtStockPrice = New System.Windows.Forms.TextBox
Me.nudStockNumber = New System.Windows.Forms.NumericUpDown
Me.cbStockProname = New System.Windows.Forms.ComboBox
Me.Label44 = New System.Windows.Forms.Label
Me.Label45 = New System.Windows.Forms.Label
Me.Label46 = New System.Windows.Forms.Label
Me.Label58 = New System.Windows.Forms.Label
Me.btnConCustomerView = New System.Windows.Forms.Button
Me.cbConCustomer = New System.Windows.Forms.ComboBox
Me.cbConType = New System.Windows.Forms.ComboBox
Me.cbConPaytype = New System.Windows.Forms.ComboBox
Me.labConCustomerLevel = New System.Windows.Forms.Label
Me.Label47 = New System.Windows.Forms.Label
Me.Label48 = New System.Windows.Forms.Label
Me.Label49 = New System.Windows.Forms.Label
Me.txtConID = New System.Windows.Forms.TextBox
Me.Label50 = New System.Windows.Forms.Label
Me.GroupBox1 = New System.Windows.Forms.GroupBox
Me.dtpCon = New System.Windows.Forms.DateTimePicker
Me.TextBox1 = New System.Windows.Forms.TextBox
Me.Label1 = New System.Windows.Forms.Label
Me.btnCancel = New System.Windows.Forms.Button
Me.myDs = New System.Data.DataSet
Me.GroupBox2.SuspendLayout()
CType(Me.dgCon, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.nudStockNumber, System.ComponentModel.ISupportInitialize).BeginInit()
Me.GroupBox1.SuspendLayout()
CType(Me.myDs, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'btnReset
'
Me.btnReset.Location = New System.Drawing.Point(444, 312)
Me.btnReset.Name = "btnReset"
Me.btnReset.Size = New System.Drawing.Size(60, 24)
Me.btnReset.TabIndex = 108
Me.btnReset.Text = "重置(&R)"
'
'btnAdd
'
Me.btnAdd.Location = New System.Drawing.Point(376, 312)
Me.btnAdd.Name = "btnAdd"
Me.btnAdd.Size = New System.Drawing.Size(60, 24)
Me.btnAdd.TabIndex = 107
Me.btnAdd.Text = "添加(&A)"
'
'PictureBox1
'
Me.PictureBox1.Image = CType(resources.GetObject("PictureBox1.Image"), System.Drawing.Image)
Me.PictureBox1.Location = New System.Drawing.Point(12, 12)
Me.PictureBox1.Name = "PictureBox1"
Me.PictureBox1.Size = New System.Drawing.Size(140, 316)
Me.PictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage
Me.PictureBox1.TabIndex = 106
Me.PictureBox1.TabStop = False
'
'GroupBox2
'
Me.GroupBox2.Controls.Add(Me.dgCon)
Me.GroupBox2.Controls.Add(Me.btnStockTempDelete)
Me.GroupBox2.Controls.Add(Me.btnStockTempAdd)
Me.GroupBox2.Controls.Add(Me.Label56)
Me.GroupBox2.Controls.Add(Me.txtConInprice)
Me.GroupBox2.Controls.Add(Me.txtConSum)
Me.GroupBox2.Controls.Add(Me.Label60)
Me.GroupBox2.Controls.Add(Me.txtStockPrice)
Me.GroupBox2.Controls.Add(Me.nudStockNumber)
Me.GroupBox2.Controls.Add(Me.cbStockProname)
Me.GroupBox2.Controls.Add(Me.Label44)
Me.GroupBox2.Controls.Add(Me.Label45)
Me.GroupBox2.Controls.Add(Me.Label46)
Me.GroupBox2.Location = New System.Drawing.Point(168, 152)
Me.GroupBox2.Name = "GroupBox2"
Me.GroupBox2.Size = New System.Drawing.Size(408, 153)
Me.GroupBox2.TabIndex = 105
Me.GroupBox2.TabStop = False
Me.GroupBox2.Text = "订单信息"
'
'dgCon
'
Me.dgCon.BackgroundColor = System.Drawing.Color.FromArgb(CType(239, Byte), CType(243, Byte), CType(255, Byte))
Me.dgCon.CaptionVisible = False
Me.dgCon.DataMember = ""
Me.dgCon.HeaderForeColor = System.Drawing.SystemColors.ControlText
Me.dgCon.Location = New System.Drawing.Point(8, 44)
Me.dgCon.Name = "dgCon"
Me.dgCon.ReadOnly = True
Me.dgCon.Size = New System.Drawing.Size(272, 100)
Me.dgCon.TabIndex = 123
Me.dgCon.TableStyles.AddRange(New System.Windows.Forms.DataGridTableStyle() {Me.dbTableStyleStockTemp})
'
'dbTableStyleStockTemp
'
Me.dbTableStyleStockTemp.DataGrid = Me.dgCon
Me.dbTableStyleStockTemp.GridColumnStyles.AddRange(New System.Windows.Forms.DataGridColumnStyle() {Me.tindex, Me.pname, Me.tnumber, Me.price})
Me.dbTableStyleStockTemp.HeaderForeColor = System.Drawing.SystemColors.ControlText
Me.dbTableStyleStockTemp.MappingName = "stocktemp"
Me.dbTableStyleStockTemp.RowHeaderWidth = 30
'
'tindex
'
Me.tindex.Format = ""
Me.tindex.FormatInfo = Nothing
Me.tindex.HeaderText = "索引"
Me.tindex.MappingName = "tindex"
Me.tindex.Width = 32
'
'pname
'
Me.pname.Format = ""
Me.pname.FormatInfo = Nothing
Me.pname.HeaderText = "产品名称"
Me.pname.MappingName = "proname"
Me.pname.Width = 70
'
'tnumber
'
Me.tnumber.Format = ""
Me.tnumber.FormatInfo = Nothing
Me.tnumber.HeaderText = "数量"
Me.tnumber.MappingName = "tnumber"
Me.tnumber.Width = 55
'
'price
'
Me.price.Format = ""
Me.price.FormatInfo = Nothing
Me.price.HeaderText = "单价"
Me.price.MappingName = "price"
Me.price.Width = 55
'
'btnStockTempDelete
'
Me.btnStockTempDelete.BackColor = System.Drawing.SystemColors.Control
Me.btnStockTempDelete.FlatStyle = System.Windows.Forms.FlatStyle.Popup
Me.btnStockTempDelete.Location = New System.Drawing.Point(344, 120)
Me.btnStockTempDelete.Name = "btnStockTempDelete"
Me.btnStockTempDelete.Size = New System.Drawing.Size(56, 24)
Me.btnStockTempDelete.TabIndex = 137
Me.btnStockTempDelete.Text = "删除(&T)"
'
'btnStockTempAdd
'
Me.btnStockTempAdd.BackColor = System.Drawing.SystemColors.Control
Me.btnStockTempAdd.FlatStyle = System.Windows.Forms.FlatStyle.Popup
Me.btnStockTempAdd.Location = New System.Drawing.Point(284, 120)
Me.btnStockTempAdd.Name = "btnStockTempAdd"
Me.btnStockTempAdd.Size = New System.Drawing.Size(56, 24)
Me.btnStockTempAdd.TabIndex = 132
Me.btnStockTempAdd.Text = "添加(&A)"
'
'Label56
'
Me.Label56.Font = New System.Drawing.Font("宋体", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.Label56.ForeColor = System.Drawing.SystemColors.ControlText
Me.Label56.Location = New System.Drawing.Point(284, 52)
Me.Label56.Name = "Label56"
Me.Label56.Size = New System.Drawing.Size(48, 16)
Me.Label56.TabIndex = 125
Me.Label56.Text = "折扣率:"
'
'txtConInprice
'
Me.txtConInprice.AutoSize = False
Me.txtConInprice.Location = New System.Drawing.Point(352, 48)
Me.txtConInprice.MaxLength = 10
Me.txtConInprice.Name = "txtConInprice"
Me.txtConInprice.Size = New System.Drawing.Size(48, 18)
Me.txtConInprice.TabIndex = 122
Me.txtConInprice.Text = ""
Me.txtConInprice.TextAlign = System.Windows.Forms.HorizontalAlignment.Right
'
'txtConSum
'
Me.txtConSum.AutoSize = False
Me.txtConSum.Location = New System.Drawing.Point(284, 96)
Me.txtConSum.MaxLength = 10
Me.txtConSum.Name = "txtConSum"
Me.txtConSum.Size = New System.Drawing.Size(116, 18)
Me.txtConSum.TabIndex = 112
Me.txtConSum.Text = ""
Me.txtConSum.TextAlign = System.Windows.Forms.HorizontalAlignment.Right
'
'Label60
'
Me.Label60.Font = New System.Drawing.Font("宋体", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.Label60.ForeColor = System.Drawing.SystemColors.ControlText
Me.Label60.Location = New System.Drawing.Point(284, 80)
Me.Label60.Name = "Label60"
Me.Label60.Size = New System.Drawing.Size(64, 16)
Me.Label60.TabIndex = 135
Me.Label60.Text = "交易金额:"
'
'txtStockPrice
'
Me.txtStockPrice.AutoSize = False
Me.txtStockPrice.Location = New System.Drawing.Point(320, 20)
Me.txtStockPrice.MaxLength = 10
Me.txtStockPrice.Name = "txtStockPrice"
Me.txtStockPrice.Size = New System.Drawing.Size(80, 18)
Me.txtStockPrice.TabIndex = 115
Me.txtStockPrice.Text = ""
Me.txtStockPrice.TextAlign = System.Windows.Forms.HorizontalAlignment.Right
'
'nudStockNumber
'
Me.nudStockNumber.Location = New System.Drawing.Point(208, 20)
Me.nudStockNumber.Maximum = New Decimal(New Integer() {100000, 0, 0, 0})
Me.nudStockNumber.Minimum = New Decimal(New Integer() {1, 0, 0, 0})
Me.nudStockNumber.Name = "nudStockNumber"
Me.nudStockNumber.Size = New System.Drawing.Size(76, 21)
Me.nudStockNumber.TabIndex = 131
Me.nudStockNumber.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
Me.nudStockNumber.ThousandsSeparator = True
Me.nudStockNumber.Value = New Decimal(New Integer() {1, 0, 0, 0})
'
'cbStockProname
'
Me.cbStockProname.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
Me.cbStockProname.Location = New System.Drawing.Point(72, 20)
Me.cbStockProname.Name = "cbStockProname"
Me.cbStockProname.Size = New System.Drawing.Size(96, 20)
Me.cbStockProname.TabIndex = 124
'
'Label44
'
Me.Label44.Font = New System.Drawing.Font("宋体", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.Label44.ForeColor = System.Drawing.SystemColors.ControlText
Me.Label44.Location = New System.Drawing.Point(284, 24)
Me.Label44.Name = "Label44"
Me.Label44.Size = New System.Drawing.Size(40, 16)
Me.Label44.TabIndex = 121
Me.Label44.Text = "单价:"
'
'Label45
'
Me.Label45.Font = New System.Drawing.Font("宋体", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.Label45.ForeColor = System.Drawing.SystemColors.ControlText
Me.Label45.Location = New System.Drawing.Point(172, 24)
Me.Label45.Name = "Label45"
Me.Label45.Size = New System.Drawing.Size(36, 16)
Me.Label45.TabIndex = 120
Me.Label45.Text = "数量:"
'
'Label46
'
Me.Label46.Font = New System.Drawing.Font("宋体", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.Label46.ForeColor = System.Drawing.SystemColors.ControlText
Me.Label46.Location = New System.Drawing.Point(8, 24)
Me.Label46.Name = "Label46"
Me.Label46.Size = New System.Drawing.Size(64, 16)
Me.Label46.TabIndex = 119
Me.Label46.Text = "产品名称:"
'
'Label58
'
Me.Label58.Font = New System.Drawing.Font("宋体", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.Label58.ForeColor = System.Drawing.SystemColors.ControlText
Me.Label58.Location = New System.Drawing.Point(176, 104)
Me.Label58.Name = "Label58"
Me.Label58.Size = New System.Drawing.Size(64, 16)
Me.Label58.TabIndex = 133
Me.Label58.Text = "签订日期:"
'
'btnConCustomerView
'
Me.btnConCustomerView.BackColor = System.Drawing.SystemColors.Control
Me.btnConCustomerView.FlatStyle = System.Windows.Forms.FlatStyle.Popup
Me.btnConCustomerView.Location = New System.Drawing.Point(244, 68)
Me.btnConCustomerView.Name = "btnConCustomerView"
Me.btnConCustomerView.Size = New System.Drawing.Size(88, 24)
Me.btnConCustomerView.TabIndex = 130
Me.btnConCustomerView.Text = "查看客户信息"
'
'cbConCustomer
'
Me.cbConCustomer.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
Me.cbConCustomer.Location = New System.Drawing.Point(72, 72)
Me.cbConCustomer.Name = "cbConCustomer"
Me.cbConCustomer.Size = New System.Drawing.Size(96, 20)
Me.cbConCustomer.TabIndex = 129
'
'cbConType
'
Me.cbConType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
Me.cbConType.Items.AddRange(New Object() {"采购", "销售"})
Me.cbConType.Location = New System.Drawing.Point(72, 44)
Me.cbConType.Name = "cbConType"
Me.cbConType.Size = New System.Drawing.Size(96, 20)
Me.cbConType.TabIndex = 128
'
'cbConPaytype
'
Me.cbConPaytype.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
Me.cbConPaytype.Items.AddRange(New Object() {"现金支付", "银行转帐", "股权转让", "其他方式"})
Me.cbConPaytype.Location = New System.Drawing.Point(72, 100)
Me.cbConPaytype.Name = "cbConPaytype"
Me.cbConPaytype.Size = New System.Drawing.Size(96, 20)
Me.cbConPaytype.TabIndex = 127
'
'labConCustomerLevel
'
Me.labConCustomerLevel.Font = New System.Drawing.Font("宋体", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.labConCustomerLevel.ForeColor = System.Drawing.SystemColors.ControlText
Me.labConCustomerLevel.Location = New System.Drawing.Point(176, 76)
Me.labConCustomerLevel.Name = "labConCustomerLevel"
Me.labConCustomerLevel.Size = New System.Drawing.Size(60, 16)
Me.labConCustomerLevel.TabIndex = 126
Me.labConCustomerLevel.Text = "★★☆☆"
'
'Label47
'
Me.Label47.Font = New System.Drawing.Font("宋体", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.Label47.ForeColor = System.Drawing.SystemColors.ControlText
Me.Label47.Location = New System.Drawing.Point(8, 76)
Me.Label47.Name = "Label47"
Me.Label47.Size = New System.Drawing.Size(64, 16)
Me.Label47.TabIndex = 118
Me.Label47.Text = "合同对象:"
'
'Label48
'
Me.Label48.Font = New System.Drawing.Font("宋体", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.Label48.ForeColor = System.Drawing.SystemColors.ControlText
Me.Label48.Location = New System.Drawing.Point(8, 104)
Me.Label48.Name = "Label48"
Me.Label48.Size = New System.Drawing.Size(64, 16)
Me.Label48.TabIndex = 117
Me.Label48.Text = "付款方式:"
'
'Label49
'
Me.Label49.Font = New System.Drawing.Font("宋体", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.Label49.ForeColor = System.Drawing.SystemColors.ControlText
Me.Label49.Location = New System.Drawing.Point(8, 48)
Me.Label49.Name = "Label49"
Me.Label49.Size = New System.Drawing.Size(64, 16)
Me.Label49.TabIndex = 116
Me.Label49.Text = "合同类型:"
'
'txtConID
'
Me.txtConID.AutoSize = False
Me.txtConID.Location = New System.Drawing.Point(72, 20)
Me.txtConID.MaxLength = 8
Me.txtConID.Name = "txtConID"
Me.txtConID.Size = New System.Drawing.Size(96, 18)
Me.txtConID.TabIndex = 111
Me.txtConID.Text = ""
'
'Label50
'
Me.Label50.Font = New System.Drawing.Font("宋体", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.Label50.ForeColor = System.Drawing.SystemColors.ControlText
Me.Label50.Location = New System.Drawing.Point(8, 20)
Me.Label50.Name = "Label50"
Me.Label50.Size = New System.Drawing.Size(64, 16)
Me.Label50.TabIndex = 110
Me.Label50.Text = "合同编号:"
'
'GroupBox1
'
Me.GroupBox1.Controls.Add(Me.dtpCon)
Me.GroupBox1.Controls.Add(Me.Label49)
Me.GroupBox1.Controls.Add(Me.txtConID)
Me.GroupBox1.Controls.Add(Me.Label50)
Me.GroupBox1.Controls.Add(Me.Label58)
Me.GroupBox1.Controls.Add(Me.cbConCustomer)
Me.GroupBox1.Controls.Add(Me.cbConType)
Me.GroupBox1.Controls.Add(Me.cbConPaytype)
Me.GroupBox1.Controls.Add(Me.Label47)
Me.GroupBox1.Controls.Add(Me.Label48)
Me.GroupBox1.Controls.Add(Me.btnConCustomerView)
Me.GroupBox1.Controls.Add(Me.labConCustomerLevel)
Me.GroupBox1.Location = New System.Drawing.Point(168, 12)
Me.GroupBox1.Name = "GroupBox1"
Me.GroupBox1.Size = New System.Drawing.Size(408, 132)
Me.GroupBox1.TabIndex = 138
Me.GroupBox1.TabStop = False
Me.GroupBox1.Text = "基本信息"
'
'dtpCon
'
Me.dtpCon.Location = New System.Drawing.Point(244, 100)
Me.dtpCon.Name = "dtpCon"
Me.dtpCon.Size = New System.Drawing.Size(108, 21)
Me.dtpCon.TabIndex = 134
'
'TextBox1
'
Me.TextBox1.AutoSize = False
Me.TextBox1.Location = New System.Drawing.Point(292, 180)
Me.TextBox1.MaxLength = 10
Me.TextBox1.Name = "TextBox1"
Me.TextBox1.Size = New System.Drawing.Size(80, 18)
Me.TextBox1.TabIndex = 115
Me.TextBox1.Text = ""
'
'Label1
'
Me.Label1.Font = New System.Drawing.Font("宋体", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.Label1.ForeColor = System.Drawing.SystemColors.ControlText
Me.Label1.Location = New System.Drawing.Point(248, 184)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(40, 16)
Me.Label1.TabIndex = 121
Me.Label1.Text = "单价:"
'
'btnCancel
'
Me.btnCancel.Location = New System.Drawing.Point(512, 312)
Me.btnCancel.Name = "btnCancel"
Me.btnCancel.Size = New System.Drawing.Size(60, 24)
Me.btnCancel.TabIndex = 139
Me.btnCancel.Text = "关闭(&C)"
'
'myDs
'
Me.myDs.DataSetName = "myDs"
Me.myDs.Locale = New System.Globalization.CultureInfo("zh-CN")
'
'frmConAdd
'
Me.AcceptButton = Me.btnCancel
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
Me.ClientSize = New System.Drawing.Size(590, 343)
Me.Controls.Add(Me.btnCancel)
Me.Controls.Add(Me.btnReset)
Me.Controls.Add(Me.btnAdd)
Me.Controls.Add(Me.PictureBox1)
Me.Controls.Add(Me.GroupBox2)
Me.Controls.Add(Me.GroupBox1)
Me.Controls.Add(Me.TextBox1)
Me.Controls.Add(Me.Label1)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog
Me.MaximizeBox = False
Me.MinimizeBox = False
Me.Name = "frmConAdd"
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent
Me.Text = "合同添加"
Me.GroupBox2.ResumeLayout(False)
CType(Me.dgCon, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.nudStockNumber, System.ComponentModel.ISupportInitialize).EndInit()
Me.GroupBox1.ResumeLayout(False)
CType(Me.myDs, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
End Sub
#End Region
Dim changeAble As Boolean = False
Private Sub frmConAdd_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.txtConID.Enabled = False
Me.txtConID.Text = "自动"
Me.txtConInprice.Enabled = False
Me.txtConSum.Enabled = False
Me.txtConSum.Text = "0"
Me.txtConInprice.Text = "0"
Me.labConCustomerLevel.Text = ""
'获取客户信息
Dim myConn As OleDbConnection = New OleDbConnection(strConn)
Dim myComm As OleDbCommand = New OleDbCommand
myComm.Connection = myConn
myComm.CommandText = "select name from customer"
Dim myReader As OleDbDataReader
myConn.Open()
myReader = myComm.ExecuteReader()
While myReader.Read
cbConCustomer.Items.Add(myReader.GetString(0))
End While
myConn.Close()
'获取成品信息
Dim pmyConn As OleDbConnection = New OleDbConnection(strConn)
Dim pmyComm As OleDbCommand = New OleDbCommand
pmyComm.Connection = pmyConn
pmyComm.CommandText = "select name from product"
Dim pmyReader As OleDbDataReader
pmyConn.Open()
pmyReader = pmyComm.ExecuteReader()
While pmyReader.Read
cbStockProname.Items.Add(pmyReader.GetString(0))
End While
pmyConn.Close()
'删除临时库存记录
Dim tmyConn As OleDbConnection = New OleDbConnection(strConn)
Dim tmyComm As OleDbCommand = New OleDbCommand
tmyComm.Connection = tmyConn
tmyComm.CommandText = "delete * from stocktemp"
tmyConn.Open()
tmyComm.ExecuteNonQuery()
tmyConn.Close()
'初始化订单信息
Dim sqlStr As String = "select tindex,proname,tnumber,price from stocktemp"
Dim conConn As New OleDbConnection(strConn)
Dim conComm As New OleDbCommand(sqlStr, conConn)
Dim myDa As New OleDbDataAdapter
myDa.SelectCommand = conComm
Dim myDs As New DataSet
myDa.Fill(myDs, "stocktemp")
dgCon.DataSource = myDs.Tables("stocktemp")
conConn.Close()
End Sub
Private Sub btnCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCancel.Click
If changeAble = True Then
Dim temp As MsgBoxResult
temp = MsgBox("输入的信息未保存,要关闭吗?", MsgBoxStyle.YesNo, "提示信息:")
If temp = MsgBoxResult.No Then
Exit Sub
Else
End If
Else
Me.Close()
End If
Me.Close()
End Sub
Private Sub btnReset_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnReset.Click
Me.cbConType.SelectedIndex = -1
Me.cbConCustomer.SelectedIndex = -1
Me.cbConPaytype.SelectedIndex = -1
Me.cbStockProname.SelectedIndex = -1
Me.nudStockNumber.Value = 1
Me.txtStockPrice.Text = ""
Me.txtConInprice.Text = "0"
Me.txtConSum.Text = ""
Me.labConCustomerLevel.Text = ""
Me.dtpCon.Value = Date.Today
'删除临时库存记录
Dim tmyConn As OleDbConnection = New OleDbConnection(strConn)
Dim tmyComm As OleDbCommand = New OleDbCommand
tmyComm.Connection = tmyConn
tmyComm.CommandText = "delete * from stocktemp"
tmyConn.Open()
tmyComm.ExecuteNonQuery()
tmyConn.Close()
'初始化订单信息
Dim sqlStr As String = "select tindex,proname,tnumber,price from stocktemp"
Dim conConn As New OleDbConnection(strConn)
Dim conComm As New OleDbCommand(sqlStr, conConn)
Dim myDa As New OleDbDataAdapter
myDa.SelectCommand = conComm
Dim myDs As New DataSet
myDa.Fill(myDs, "stocktemp")
dgCon.DataSource = myDs.Tables("stocktemp")
conConn.Close()
End Sub
Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click
If Me.cbConType.SelectedIndex = -1 Then
MsgBox("合同类型不能为空!", MsgBoxStyle.Information, "提示信息")
Exit Sub
End If
If Me.cbConCustomer.SelectedIndex = -1 Then
MsgBox("合同对象不能为空!", MsgBoxStyle.Information, "提示信息")
Exit Sub
End If
If Me.cbConPaytype.SelectedIndex = -1 Then
MsgBox("付款方式不能为空!", MsgBoxStyle.Information, "提示信息")
Exit Sub
End If
If CDbl(Me.txtConSum.Text) = 0 Then
MsgBox("订单信息不能为空!", MsgBoxStyle.Information, "提示信息")
Exit Sub
End If
'获取合同编号
Dim myConn As OleDbConnection = New OleDbConnection(strConn)
Dim myComm As OleDbCommand = New OleDbCommand
myComm.Connection = myConn
myComm.CommandText = "select max(id) from contract"
Dim myReader As OleDbDataReader
myConn.Open()
Dim maxIDTemp As Long
Dim maxId As Object = myComm.ExecuteScalar()
If maxId Is System.DBNull.Value Then
maxIDTemp = 10000001
Else
Dim strid As String
strid = CStr(maxId)
maxIDTemp = CInt(strid)
maxIDTemp = maxIDTemp + 1
End If
myConn.Close()
'更新合同表
Dim saveComm As OleDbCommand = New OleDbCommand
saveComm.CommandText = "insert into contract (id,ctype,customer,csum,paytype,signdate) values (@id,@ctype,@customer,@csum,@paytype,@signdate)"
saveComm.Connection = myConn
saveComm.Parameters.Add("@id", maxIDTemp)
saveComm.Parameters.Add("@ctype", Me.cbConType.SelectedItem)
saveComm.Parameters.Add("@customer", Me.cbConCustomer.SelectedItem)
saveComm.Parameters.Add("@csum", CDbl(Me.txtConSum.Text))
saveComm.Parameters.Add("@paytype", Me.cbConPaytype.SelectedItem)
saveComm.Parameters.Add("@signdate", Me.dtpCon.Text)
myConn.Open()
Try
saveComm.ExecuteNonQuery()
Catch ex As Exception
MsgBox(Err.Description, MsgBoxStyle.Information)
End Try
myConn.Close()
'更新库存表
Dim tProname As String
Dim tNumber As Long
Dim tPrice As Double
Dim i As Integer
Dim g As Integer
Dim stockTempComm As OleDbCommand = New OleDbCommand
stockTempComm.Connection = myConn
stockTempComm.CommandText = "select count(tindex) from stocktemp"
myConn.Open()
Dim count As Object = stockTempComm.ExecuteScalar()
g = CInt(count)
myConn.Close()
Dim stockComm As OleDbCommand = New OleDbCommand
stockComm.Connection = myConn
stockComm.CommandText = "insert into stock (contract,stype,proname,snumber,price) values (@contract,@stype,@proname,@snumber,@price)"
myConn.Open()
For i = 0 To g - 1
tProname = CStr(dgCon.Item(i, 1))
tNumber = CLng(dgCon.Item(i, 2))
tPrice = CSng(dgCon.Item(i, 3))
stockComm.Parameters.Add("@contract", maxIDTemp)
stockComm.Parameters.Add("@stype", Me.cbConType.SelectedItem)
stockComm.Parameters.Add("@proname", tProname)
stockComm.Parameters.Add("@snumber", tNumber)
stockComm.Parameters.Add("@price", tPrice)
Try
stockComm.ExecuteNonQuery()
Catch ex As Exception
MsgBox(Err.Description)
End Try
stockComm.Parameters.Clear()
Next
myConn.Close()
MsgBox("合同添加成功,合同号为: " & maxIDTemp, MsgBoxStyle.Information, "提示信息")
Me.Close()
End Sub
Private Sub btnConCustomerView_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnConCustomerView.Click
If Me.cbConCustomer.SelectedIndex = -1 Then
Exit Sub
End If
Try
Dim myConn As OleDbConnection = New OleDbConnection(strConn)
Dim myComm As OleDbCommand = New OleDbCommand
myComm.Connection = myConn
myComm.CommandText = "select id,address,phone,banknumber from customer where name = @name"
myComm.Parameters.Add("@name", Me.cbConCustomer.SelectedItem)
Dim myReader As OleDbDataReader
myConn.Open()
Dim tID As Long
Dim tPhone As String
Dim tAddress As String
Dim tBankNumber
myReader = myComm.ExecuteReader()
While myReader.Read
tID = myReader.GetInt32(0)
tAddress = myReader.GetString(1)
tPhone = myReader.GetString(2)
tBankNumber = myReader.GetString(3)
End While
myConn.Close()
MsgBox("客户编号: " & tID & Chr(10) & "客户姓名: " & Me.cbConCustomer.SelectedItem & Chr(10) & "客户电话: " & tPhone & Chr(10) & "客户地址: " & tAddress & Chr(10) & "银行帐号: " & tBankNumber, MsgBoxStyle.Information, "提示信息")
Catch ex As Exception
MsgBox(Err.Description)
End Try
End Sub
Private Sub btnStockTempAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStockTempAdd.Click
If Me.cbStockProname.SelectedIndex = -1 Then
MsgBox("产品名称不能为空!", MsgBoxStyle.Information, "提示信息")
Exit Sub
End If
If Me.txtStockPrice.Text = "" Then
MsgBox("产品单价不能为空!", MsgBoxStyle.Information, "提示信息")
Exit Sub
End If
changeAble = True
stockTemp = stockTemp + 1
Dim myConn As OleDbConnection = New OleDbConnection(strConn)
Dim myComm As OleDbCommand = New OleDbCommand
myComm.Connection = myConn
myComm.CommandText = "insert into stocktemp (tindex,proname,tnumber,price) values (@tindex,@proname,@tnumber,@price)"
myComm.Parameters.Add("@tindex", stockTemp)
myComm.Parameters.Add("@proname", cbStockProname.SelectedItem)
myComm.Parameters.Add("@tnumber", CLng(nudStockNumber.Value))
myComm.Parameters.Add("@price", CSng(txtStockPrice.Text))
myConn.Open()
Try
myComm.ExecuteNonQuery()
Catch ex As Exception
MsgBox("产品重复添加,请查看您输入的信息!", MsgBoxStyle.Information, "提示信息")
End Try
myConn.Close()
'计算交易金额
Dim tNumber As Long
Dim tPrice As Single
Dim tSum As Double = 0
Dim tConn As New OleDbConnection(strConn)
Dim tComm As New OleDbCommand
tComm.Connection = tConn
tComm.CommandText = "select tnumber,price from stocktemp"
Dim tReader As OleDbDataReader
tConn.Open()
tReader = tComm.ExecuteReader
While tReader.Read
tNumber = tReader.GetInt32(0)
tPrice = tReader.GetFloat(1)
tSum = tSum + tNumber * tPrice
End While
Dim tDou As Double = (1 - CSng(txtConInprice.Text)) * tSum
txtConSum.Text = Format(tDou, "0.00")
tConn.Close()
'更新订单信息
Dim sqlStr As String = "select tindex,proname,tnumber,price from stocktemp"
Dim conConn As New OleDbConnection(strConn)
Dim conComm As New OleDbCommand(sqlStr, conConn)
Dim myDa As New OleDbDataAdapter
myDa.SelectCommand = conComm
Dim myDs As New DataSet
myDa.Fill(myDs, "stocktemp")
dgCon.DataSource = myDs.Tables("stocktemp")
conConn.Close()
End Sub
Private Sub txtStockPrice_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtStockPrice.TextChanged
modMain.checkNum(txtStockPrice)
End Sub
Private Sub nudStockNumber_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles nudStockNumber.ValueChanged
If nudStockNumber.Value > 100000 Then
MsgBox("超出数量限定!", MsgBoxStyle.Information, "提示信息")
nudStockNumber.Value = 100000
Else
If nudStockNumber.Value < 1 Then
MsgBox("低于数量限定!", MsgBoxStyle.Information, "提示信息")
nudStockNumber.Value = 1
End If
End If
End Sub
Private Sub cbConCustomer_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbConCustomer.SelectedIndexChanged
If Me.cbConCustomer.SelectedIndex = -1 Then
Exit Sub
End If
changeAble = True
Try
Dim myConn As OleDbConnection = New OleDbConnection(strConn)
Dim myComm As OleDbCommand = New OleDbCommand
myComm.Connection = myConn
myComm.CommandText = "select clevel from customer where name = @name"
Dim myReader As OleDbDataReader
myConn.Open()
myComm.Parameters.Add("@name", cbConCustomer.SelectedItem)
myReader = myComm.ExecuteReader()
While myReader.Read
Me.labConCustomerLevel.Text = myReader.GetString(0)
End While
myConn.Close()
Catch ex As Exception
MsgBox(Err.Description)
End Try
If Me.labConCustomerLevel.Text = "★☆☆☆" Then
Me.txtConInprice.Text = "0.05"
ElseIf Me.labConCustomerLevel.Text = "★★☆☆" Then
Me.txtConInprice.Text = "0.1"
ElseIf Me.labConCustomerLevel.Text = "★★★☆" Then
Me.txtConInprice.Text = "0.15"
ElseIf Me.labConCustomerLevel.Text = "★★★★" Then
Me.txtConInprice.Text = "0.2"
End If
'计算交易金额
Dim tNumber As Long
Dim tPrice As Single
Dim tSum As Double = 0
Dim tConn As New OleDbConnection(strConn)
Dim tComm As New OleDbCommand
tComm.Connection = tConn
tComm.CommandText = "select tnumber,price from stocktemp"
Dim tReader As OleDbDataReader
tConn.Open()
tReader = tComm.ExecuteReader
While tReader.Read
tNumber = tReader.GetInt32(0)
tPrice = tReader.GetFloat(1)
tSum = tSum + tNumber * tPrice
End While
Dim tDou As Double = (1 - CSng(txtConInprice.Text)) * tSum
txtConSum.Text = Format(tDou, "0.00")
tConn.Close()
End Sub
Private Sub btnStockTempDelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStockTempDelete.Click
If dgCon.CurrentRowIndex = -1 Then
Exit Sub
End If
Dim tMsg As MsgBoxResult
Dim numTemp As Integer
numTemp = dgCon.CurrentRowIndex
Dim numTemp2 As Integer
numTemp = dgCon.Item(numTemp, 0)
tMsg = MsgBox("确实要删除索引号为 < " & numTemp & " > 的订单记录?", MsgBoxStyle.YesNo, "提示信息")
If tMsg = MsgBoxResult.No Then
Exit Sub
End If
Dim myConn As OleDbConnection = New OleDbConnection(strConn)
Dim myComm As OleDbCommand = New OleDbCommand
myComm.Connection = myConn
myComm.CommandText = "delete from stocktemp where tindex = @tindex"
myComm.Parameters.Add("@tindex", numTemp)
myConn.Open()
myComm.ExecuteNonQuery()
myConn.Close()
'计算交易金额
Dim tNumber As Long
Dim tPrice As Single
Dim tSum As Double = 0
Dim tConn As New OleDbConnection(strConn)
Dim tComm As New OleDbCommand
tComm.Connection = tConn
tComm.CommandText = "select tnumber,price from stocktemp"
Dim tReader As OleDbDataReader
tConn.Open()
tReader = tComm.ExecuteReader
While tReader.Read
tNumber = tReader.GetInt32(0)
tPrice = tReader.GetFloat(1)
tSum = tSum + tNumber * tPrice
End While
Dim tDou As Double = (1 - CSng(txtConInprice.Text)) * tSum
txtConSum.Text = Format(tDou, "0.00")
tConn.Close()
'更新订单信息
Dim sqlStr As String = "select tindex,proname,tnumber,price from stocktemp"
Dim conConn As New OleDbConnection(strConn)
Dim conComm As New OleDbCommand(sqlStr, conConn)
Dim myDa As New OleDbDataAdapter
myDa.SelectCommand = conComm
Dim myDs As New DataSet
myDa.Fill(myDs, "stocktemp")
dgCon.DataSource = myDs.Tables("stocktemp")
conConn.Close()
End Sub
Private Sub cbConType_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbConType.SelectedIndexChanged
changeAble = True
End Sub
Private Sub cbConPaytype_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbConPaytype.SelectedIndexChanged
changeAble = True
End Sub
Private Sub dtpCon_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles dtpCon.ValueChanged
changeAble = True
End Sub
End Class