📄 baodao.aspx.vb
字号:
Imports System.Data.SqlClient
Imports system.configuration
Imports System.Web.Configuration
Imports System.Data
Imports System.Drawing
Partial Class baodao
Inherits System.Web.UI.Page
Public pulic As New pulic1
Public Shared stats As String
'Public Shared ReadOnly Property UserInteractive() As Boolean
Protected Sub setFields()
'建立命令字段
GridView1.AutoGenerateColumns = False
Dim selectField As New CommandField()
selectField.ButtonType = ButtonType.Link
selectField.ShowSelectButton = True '显示选择按钮
selectField.SelectText = "选择"
selectField.HeaderText = "按钮"
selectField.ItemStyle.Wrap = False
'建立数据绑定字段
Dim employeeidField As New BoundField()
employeeidField.DataField = "nsrname" '指定数据来源字段
employeeidField.HeaderText = "纳税人名称" '设置字段头名称
'employeeidField.SortExpression = "nsrid" '指定排序字段名称
employeeidField.ItemStyle.Wrap = True
'employeeidField.ItemStyle.HorizontalAlign = HorizontalAlign.Center
'将字段加入到GridView
GridView1.Columns.Add(selectField)
GridView1.Columns.Add(employeeidField)
GridView1.DataBind()
End Sub
Protected Sub gviewEmployees_SelectedIndexChanging(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewSelectEventArgs) Handles GridView1.SelectedIndexChanging
Session("name") = GridView1.Rows(e.NewSelectedIndex).Cells(1).Text
chuli()
End Sub
Protected Sub chuli()
System.Threading.Thread.Sleep(700)
Dim name As String = Session("name")
Dim cmd2 As New String("select nsrid from nsrinf where nsrname='" & name & "'")
Dim id As String = pulic.Scalar(cmd2)
Session("id") = id
Dim cmd3 As New String("select distinct nsrname as 纳税人名称,nsrid as 纳税人编号,skkid as 税控卡编号 from nsrinf where nsrid='" & id & "'")
Dim myReader As SqlDataReader = pulic.execute(cmd3)
While myReader.Read()
TextBox3.Text = (myReader.GetString(0))
TextBox4.Text = (myReader.GetString(1))
TextBox5.Text = (myReader.GetString(2))
End While
myReader.Close()
Dim grid3 = "select bd_rjy.nsrid as 纳税人编号,bd_rjy.riqi as 开票日期,bd_rjy.ok as 正常票金额,bd_rjy.fei as 退票金额,bd_rjy.fp_ok as 正常发票数,bd_rjy.fp_tui as 退票数,bd_rjy.fp_fei as 废票数 FROM bd_rjy WHERE (bd_rjy.nsrid =" + TextBox4.Text + ")"
Session("grid3") = grid3
Dim c3 As SqlDataReader = pulic.execute(grid3)
If c3.HasRows Then
GridView3.Visible = True
pulic.selectcommand(GridView3, sql3, grid3)
GridView3.AllowSorting = True
GridView3.AllowPaging = True
GridView3.DataBind()
End If
Dim grid2 = "SELECT bd_rjy.nsrid AS 纳税人编号, bd_rjy.riqi AS 开票日期, bd_rjy.fp_ok AS 正常发票数, bd_rjy.fp_tui AS 退票数, bd_rjy.fp_fei AS 废票数, bd_rjy.ok1 AS 税种1正常票金额, bd_rjy.fei1 AS 税种1退票金额, bd_rjy.ok2 AS 税种2正常票金额, bd_rjy.fei2 AS 税种2退票金额, bd_rjy.ok3 AS 税种3正常票金额, bd_rjy.fei3 AS 税种3退票金额, bd_rjy.ok4 AS 税种4正常票金额, bd_rjy.fei4 AS 税种4退票金额, bd_rjy.ok5 AS 税种5正常票金额, bd_rjy.fei5 AS 税种5退票金额, bd_rjy.ok6 AS 税种6正常票金额, bd_rjy.fei6 AS 税种6退票金额 FROM bd_rjy WHERE (bd_rjy.nsrid =" + TextBox4.Text + ")"
Session("grid2") = grid2
Dim c2 As SqlDataReader = pulic.execute(grid2)
If c2.HasRows Then
GridView2.Visible = True
pulic.selectcommand(GridView2, (sql2), grid2)
GridView2.AllowPaging = True
GridView2.AllowSorting = True
GridView2.DataBind()
End If
If (c3.HasRows = False) And (c2.HasRows = False) Then
MsgBox("无统计数据!", 0, "提示:")
Session("grid2") = ""
Session("grid3") = ""
GridView3.DataSourceID = ""
GridView3.DataBind()
GridView2.DataSource = ""
GridView2.DataBind()
End If
c3.Close() : c2.Close()
End Sub
Protected Sub rdoCar_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles rdoCar.SelectedIndexChanged
For I As Integer = 0 To rdoCar.Items.Count - 1
If rdoCar.Items(I).Selected Then
MultiView2.ActiveViewIndex = CType(rdoCar.Items(I).Value, Int16)
End If
Next
End Sub
Protected Sub GridView2_Sorting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewSortEventArgs) Handles GridView2.Sorting
GridView2.AllowSorting = True
GridView2.AllowPaging = True
End Sub
Protected Sub GridView3_Sorting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewSortEventArgs) Handles GridView3.Sorting
GridView3.AllowSorting = True
GridView3.AllowPaging = True
End Sub
Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click
Response.Redirect("index.aspx")
End Sub
Protected Sub chushihua()
Label9.Visible = False
GridView1.SelectedRowStyle.Reset()
Session("grid2") = ""
Session("grid3") = ""
GridView1.DataSourceID = ""
' GridView1.DataSource = ""
GridView2.DataSourceID = ""
GridView2.AllowSorting = False
GridView2.Visible = False
GridView3.DataSourceID = ""
GridView3.AllowSorting = False
GridView3.Visible = False
TextBox3.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""
End Sub
Protected Sub DisplayPageNo(ByVal gridview)
If gridview.datasourceid <> "" Then
Dim bottonPagerNo3 As New Label()
Dim bottonPagerRow As GridViewRow = gridview.BottomPagerRow
bottonPagerNo3.Text = "目前所在页码(" & (gridview.PageIndex & 1) & "/" & gridview.PageCount & ")"
If gridview.PageCount <> "1" Then
bottonPagerRow.Cells(0).Controls.Add(bottonPagerNo3)
Else
Exit Sub
End If
' bottonPagerRow.Cells(0).Controls.Add(bottonPagerNo3)
End If
End Sub
Protected Sub gridview2_DataBound(ByVal sender As Object, ByVal e As System.EventArgs) Handles GridView2.DataBound
DisplayPageNo(GridView2)
End Sub
Protected Sub gridview3_databound(ByVal sender As Object, ByVal e As System.EventArgs) Handles GridView3.DataBound
DisplayPageNo(GridView3)
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If (Not IsPostBack) Then
setFields()
stats = "yes"
chushihua()
End If
' pulic.xianshi(GridView1)
If Session("grid2") <> "" Or Session("grid3") <> "" Then
pulic.selectcommand(GridView2, sql2, Session("grid2"))
pulic.selectcommand(GridView3, sql3, Session("grid3"))
Else
GridView2.DataSourceID = ""
GridView3.DataSourceID = ""
End If
End Sub
Protected Sub GridView2_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)
End Sub
Protected Sub Button1_Click1(ByVal sender As Object, ByVal e As System.EventArgs)
chushihua()
Dim grid1 = ""
If Session("s") = "" Then
grid1 = "select distinct nsrinf.nsrname,nsrinf.nsrid from nsrinf,shezhi,bd_rjy where (nsrinf.nsrid=shezhi.nsrid) and (nsrinf.nsrid=bd_rjy.nsrid) and (bd_rjy.bdsign=1 or bd_rjy.rsign=1) and (shezhi.bd_jg is not null )"
Else
grid1 = "select distinct nsrinf.nsrname,nsrinf.nsrid from nsrinf,shezhi,bd_rjy where (nsrinf.nsrid=shezhi.nsrid) and (nsrinf.nsrid=bd_rjy.nsrid) and (bd_rjy.bdsign=1 or bd_rjy.rsign=1) and (shezhi.bd_jg is not null ) and " & Session("s")
End If
If TextBox1.Text <> "" Then
grid1 = grid1 + " and ( nsrinf.nsrname like '%" + TextBox1.Text().Trim + "%' )"
End If
If TextBox2.Text <> "" Then
grid1 = grid1 + " and (nsrinf.nsrid like '%" + TextBox2.Text().Trim + "%')"
End If
grid1 = grid1 + " order by nsrinf.nsrid"
System.Threading.Thread.Sleep(800)
Dim BAO As SqlDataReader = pulic.execute(grid1)
If BAO.HasRows Then
pulic.selectcommand(GridView1, sql1, grid1)
' GridView1.DataSource = BAO
GridView1.AllowSorting = True
GridView1.AllowPaging = True
GridView1.DataBind()
Else
Label9.Text = "提示:无匹配信息"
Label9.Visible = True
' MsgBox("演示警告对话框", MsgBoxStyle.Exclamation Or MsgBoxStyle.OkCancel Or MsgBoxStyle.DefaultButton1, "警告")
TextBox1.Text = ""
TextBox2.Text = ""
stats = "no"
End If
BAO.Close()
End Sub
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -