frmMdqueryes.vb
上传用户:wj57717022
上传日期:2014-12-16
资源大小:4093k
文件大小:12k
- Public Class frmMdqueryes
- Inherits System.Windows.Forms.Form
- Public lsweb As New jxcmanage
- #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 Panel1 As System.Windows.Forms.Panel
- Friend WithEvents btnJs As System.Windows.Forms.Button
- Friend WithEvents btnQuery As System.Windows.Forms.Button
- Friend WithEvents btnqueryall As System.Windows.Forms.Button
- Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox
- Friend WithEvents txtmedtype As System.Windows.Forms.ComboBox
- Friend WithEvents Label4 As System.Windows.Forms.Label
- Friend WithEvents txtmedname As System.Windows.Forms.TextBox
- Friend WithEvents Label3 As System.Windows.Forms.Label
- Friend WithEvents txtendtime As System.Windows.Forms.DateTimePicker
- Friend WithEvents txtbegintime As System.Windows.Forms.DateTimePicker
- Friend WithEvents Label2 As System.Windows.Forms.Label
- Friend WithEvents Label1 As System.Windows.Forms.Label
- Friend WithEvents Panel2 As System.Windows.Forms.Panel
- Friend WithEvents dgview As System.Windows.Forms.DataGrid
- Friend WithEvents Button1 As System.Windows.Forms.Button
- <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
- Me.Panel1 = New System.Windows.Forms.Panel
- Me.Button1 = New System.Windows.Forms.Button
- Me.btnJs = New System.Windows.Forms.Button
- Me.btnQuery = New System.Windows.Forms.Button
- Me.btnqueryall = New System.Windows.Forms.Button
- Me.GroupBox1 = New System.Windows.Forms.GroupBox
- Me.txtmedtype = New System.Windows.Forms.ComboBox
- Me.Label4 = New System.Windows.Forms.Label
- Me.txtmedname = New System.Windows.Forms.TextBox
- Me.Label3 = New System.Windows.Forms.Label
- Me.txtendtime = New System.Windows.Forms.DateTimePicker
- Me.txtbegintime = New System.Windows.Forms.DateTimePicker
- Me.Label2 = New System.Windows.Forms.Label
- Me.Label1 = New System.Windows.Forms.Label
- Me.Panel2 = New System.Windows.Forms.Panel
- Me.dgview = New System.Windows.Forms.DataGrid
- Me.Panel1.SuspendLayout()
- Me.GroupBox1.SuspendLayout()
- Me.Panel2.SuspendLayout()
- CType(Me.dgview, System.ComponentModel.ISupportInitialize).BeginInit()
- Me.SuspendLayout()
- '
- 'Panel1
- '
- Me.Panel1.Controls.Add(Me.Button1)
- Me.Panel1.Controls.Add(Me.btnJs)
- Me.Panel1.Controls.Add(Me.btnQuery)
- Me.Panel1.Controls.Add(Me.btnqueryall)
- Me.Panel1.Dock = System.Windows.Forms.DockStyle.Right
- Me.Panel1.Location = New System.Drawing.Point(388, 87)
- Me.Panel1.Name = "Panel1"
- Me.Panel1.Size = New System.Drawing.Size(72, 272)
- Me.Panel1.TabIndex = 15
- '
- 'Button1
- '
- Me.Button1.Dock = System.Windows.Forms.DockStyle.Top
- Me.Button1.FlatStyle = System.Windows.Forms.FlatStyle.Popup
- Me.Button1.Location = New System.Drawing.Point(0, 72)
- Me.Button1.Name = "Button1"
- Me.Button1.Size = New System.Drawing.Size(72, 24)
- Me.Button1.TabIndex = 6
- Me.Button1.Text = "打印"
- '
- 'btnJs
- '
- Me.btnJs.Dock = System.Windows.Forms.DockStyle.Top
- Me.btnJs.FlatStyle = System.Windows.Forms.FlatStyle.Popup
- Me.btnJs.Location = New System.Drawing.Point(0, 48)
- Me.btnJs.Name = "btnJs"
- Me.btnJs.Size = New System.Drawing.Size(72, 24)
- Me.btnJs.TabIndex = 5
- Me.btnJs.Text = "每日结算"
- '
- 'btnQuery
- '
- Me.btnQuery.Dock = System.Windows.Forms.DockStyle.Top
- Me.btnQuery.FlatStyle = System.Windows.Forms.FlatStyle.Popup
- Me.btnQuery.Location = New System.Drawing.Point(0, 24)
- Me.btnQuery.Name = "btnQuery"
- Me.btnQuery.Size = New System.Drawing.Size(72, 24)
- Me.btnQuery.TabIndex = 4
- Me.btnQuery.Text = "条件查询"
- Me.btnQuery.TextAlign = System.Drawing.ContentAlignment.TopCenter
- '
- 'btnqueryall
- '
- Me.btnqueryall.Dock = System.Windows.Forms.DockStyle.Top
- Me.btnqueryall.FlatStyle = System.Windows.Forms.FlatStyle.Popup
- Me.btnqueryall.Location = New System.Drawing.Point(0, 0)
- Me.btnqueryall.Name = "btnqueryall"
- Me.btnqueryall.Size = New System.Drawing.Size(72, 24)
- Me.btnqueryall.TabIndex = 3
- Me.btnqueryall.Text = "全部查询"
- Me.btnqueryall.TextAlign = System.Drawing.ContentAlignment.TopCenter
- '
- 'GroupBox1
- '
- Me.GroupBox1.Controls.Add(Me.txtmedtype)
- Me.GroupBox1.Controls.Add(Me.Label4)
- Me.GroupBox1.Controls.Add(Me.txtmedname)
- Me.GroupBox1.Controls.Add(Me.Label3)
- Me.GroupBox1.Controls.Add(Me.txtendtime)
- Me.GroupBox1.Controls.Add(Me.txtbegintime)
- Me.GroupBox1.Controls.Add(Me.Label2)
- Me.GroupBox1.Controls.Add(Me.Label1)
- Me.GroupBox1.Dock = System.Windows.Forms.DockStyle.Top
- Me.GroupBox1.Location = New System.Drawing.Point(0, 0)
- Me.GroupBox1.Name = "GroupBox1"
- Me.GroupBox1.Size = New System.Drawing.Size(460, 87)
- Me.GroupBox1.TabIndex = 14
- Me.GroupBox1.TabStop = False
- '
- 'txtmedtype
- '
- Me.txtmedtype.Location = New System.Drawing.Point(234, 50)
- Me.txtmedtype.Name = "txtmedtype"
- Me.txtmedtype.Size = New System.Drawing.Size(102, 20)
- Me.txtmedtype.TabIndex = 10
- '
- 'Label4
- '
- Me.Label4.AutoSize = True
- Me.Label4.Location = New System.Drawing.Point(180, 56)
- Me.Label4.Name = "Label4"
- Me.Label4.Size = New System.Drawing.Size(60, 17)
- Me.Label4.TabIndex = 6
- Me.Label4.Text = "药品类别:"
- '
- 'txtmedname
- '
- Me.txtmedname.Location = New System.Drawing.Point(60, 50)
- Me.txtmedname.Name = "txtmedname"
- Me.txtmedname.Size = New System.Drawing.Size(102, 21)
- Me.txtmedname.TabIndex = 5
- Me.txtmedname.Text = ""
- '
- 'Label3
- '
- Me.Label3.AutoSize = True
- Me.Label3.Location = New System.Drawing.Point(6, 56)
- Me.Label3.Name = "Label3"
- Me.Label3.Size = New System.Drawing.Size(60, 17)
- Me.Label3.TabIndex = 4
- Me.Label3.Text = "药品名称:"
- '
- 'txtendtime
- '
- Me.txtendtime.Location = New System.Drawing.Point(234, 16)
- Me.txtendtime.Name = "txtendtime"
- Me.txtendtime.Size = New System.Drawing.Size(102, 21)
- Me.txtendtime.TabIndex = 3
- Me.txtendtime.Value = New Date(2006, 2, 23, 0, 0, 0, 0)
- '
- 'txtbegintime
- '
- Me.txtbegintime.Location = New System.Drawing.Point(60, 16)
- Me.txtbegintime.Name = "txtbegintime"
- Me.txtbegintime.Size = New System.Drawing.Size(102, 21)
- Me.txtbegintime.TabIndex = 2
- Me.txtbegintime.Value = New Date(2006, 2, 23, 0, 0, 0, 0)
- '
- 'Label2
- '
- Me.Label2.AutoSize = True
- Me.Label2.Location = New System.Drawing.Point(176, 24)
- Me.Label2.Name = "Label2"
- Me.Label2.Size = New System.Drawing.Size(60, 17)
- Me.Label2.TabIndex = 1
- Me.Label2.Text = "结束日期:"
- '
- 'Label1
- '
- Me.Label1.AutoSize = True
- Me.Label1.Location = New System.Drawing.Point(8, 24)
- Me.Label1.Name = "Label1"
- Me.Label1.Size = New System.Drawing.Size(60, 17)
- Me.Label1.TabIndex = 0
- Me.Label1.Text = "开始日期:"
- '
- 'Panel2
- '
- Me.Panel2.Controls.Add(Me.dgview)
- Me.Panel2.Dock = System.Windows.Forms.DockStyle.Fill
- Me.Panel2.Location = New System.Drawing.Point(0, 87)
- Me.Panel2.Name = "Panel2"
- Me.Panel2.Size = New System.Drawing.Size(388, 272)
- Me.Panel2.TabIndex = 16
- '
- 'dgview
- '
- Me.dgview.DataMember = ""
- Me.dgview.Dock = System.Windows.Forms.DockStyle.Fill
- Me.dgview.HeaderForeColor = System.Drawing.SystemColors.ControlText
- Me.dgview.Location = New System.Drawing.Point(0, 0)
- Me.dgview.Name = "dgview"
- Me.dgview.Size = New System.Drawing.Size(388, 272)
- Me.dgview.TabIndex = 14
- '
- 'frmMdqueryes
- '
- Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
- Me.ClientSize = New System.Drawing.Size(460, 359)
- Me.Controls.Add(Me.Panel2)
- Me.Controls.Add(Me.Panel1)
- Me.Controls.Add(Me.GroupBox1)
- Me.Name = "frmMdqueryes"
- Me.Text = "frmMdqueryes"
- Me.Panel1.ResumeLayout(False)
- Me.GroupBox1.ResumeLayout(False)
- Me.Panel2.ResumeLayout(False)
- CType(Me.dgview, System.ComponentModel.ISupportInitialize).EndInit()
- Me.ResumeLayout(False)
- End Sub
- #End Region
- Private Sub btnQuery_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnQuery.Click
- Dim strmedname, strmedtype, strquery As String
- If txtmedname.Text = "" Then
- strmedname = ""
- Else
- strmedname = " and 药品名称='" & txtmedname.Text & "'"
- End If
- If txtmedtype.Text = "" Then
- strmedtype = ""
- Else
- strmedtype = " and substring(药品编号,1,1)='" & txtmedtype.Text.Substring(0, 1) & "'"
- End If
- Dim strsql As String
- strsql = " where substring(票号,1,2)in('ls','th') and 日期 between '" & txtbegintime.Value & "' and '" & txtendtime.Value & "'" & strmedname & strmedtype
- strquery = "select * from wz_ck" & strsql
-
- lsweb.runSql(strquery)
- Dim dslocal As DataSet
- dslocal = lsweb.runSql(strquery)
- dgview.DataSource = dslocal.Tables(0).DefaultView
- End Sub
- Private Sub btnqueryall_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnqueryall.Click
- Dim strsql, strquery As String
- strsql = " where substring(票号,1,2)in('ls','th')"
- strquery = "select * from wz_ck" & strsql
- lsweb.runSql(strquery)
- Dim dslocal As DataSet
- dslocal = lsweb.runSql(strquery)
- dgview.DataSource = dslocal.Tables(0).DefaultView
- End Sub
- Private Sub btnJs_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnJs.Click
- Dim strquery, strsql As String
- strquery = " and 日期='" & Today().ToShortDateString & "'"
- strsql = "select 销售员,(select sum(数量) from wz_ck where substring(票号,1,2)='ls'" & strquery & ") as 销售数量,(select avg(单价) from wz_ck where substring(票号,1,2)='ls'" & strquery & ") as 销售单价,(select sum(数量)*avg(单价) from wz_ck where substring(票号,1,2)='ls'" & strquery & ") as 销售金额,(select sum(数量) from wz_ck where substring(票号,1,2)='lt'" & strquery & ") as 退货数量,(select avg(单价) from wz_ck where substring(票号,1,2)='lt'" & strquery & ") as 退货单价,(select sum(数量)*avg(单价) from wz_ck where substring(票号,1,2)='lt'" & strquery & ") as 退货金额,(select sum(毛利) from wz_ck where substring(票号,1,2) in ('lt','ls')" & strquery & ") as 毛利 from wz_ck group by 销售员"
- lsweb.runSql(strsql)
- Dim dslocal As DataSet
- dslocal = lsweb.runSql(strsql)
- dgview.DataSource = dslocal.Tables(0).DefaultView
- End Sub
- Private Sub frmMdqueryes_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
- txtbegintime.Value = Today.ToString
- txtendtime.Value = Today.ToString
- End Sub
- End Class