合同代码编写

'撰写人:王德田
'撰写日期:2007-9-20
'功能:合同
Imports System.Data.SqlClient
Imports System.Data
Public Class frm_SN
Inherits System.Web.UI.Page
Public Enum State
增加 = 1
修改 = 2
End Enum

#Region " Web 窗体设计器生成的代码 "

'该调用是 Web 窗体设计器所必需的。
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

End Sub
Protected WithEvents BtnSave As System.Web.UI.WebControls.Button
Protected WithEvents BtnCancel As System.Web.UI.WebControls.Button
Protected WithEvents BtnSavePrint As System.Web.UI.WebControls.Button
Protected WithEvents BtnDelete As System.Web.UI.WebControls.Button
Protected WithEvents BtnGz As System.Web.UI.WebControls.Button
Protected WithEvents BtnCancelGZ As System.Web.UI.WebControls.Button
Protected WithEvents BtnCheckYes As System.Web.UI.WebControls.Button
Protected WithEvents BtnCheckNo As System.Web.UI.WebControls.Button
Protected WithEvents BtnCancelCheck As System.Web.UI.WebControls.Button
Protected WithEvents ddlcompany As System.Web.UI.WebControls.DropDownList
Protected WithEvents ddlcp As System.Web.UI.WebControls.DropDownList
Protected WithEvents BtnPrint As System.Web.UI.HtmlControls.HtmlInputButton
Protected WithEvents txttp_y As System.Web.UI.WebControls.TextBox
Protected WithEvents txttp_m As System.Web.UI.WebControls.TextBox
Protected WithEvents txttp_d As System.Web.UI.WebControls.TextBox
Protected WithEvents txttp_dd As System.Web.UI.WebControls.TextBox
Protected WithEvents txttp_jf As System.Web.UI.WebControls.TextBox
Protected WithEvents txttp_cp As System.Web.UI.WebControls.TextBox
Protected WithEvents txttp_jfgtr As System.Web.UI.WebControls.TextBox
Protected WithEvents txttp_yf As System.Web.UI.WebControls.TextBox
Protected WithEvents txttp_yfgtr As System.Web.UI.WebControls.TextBox
Protected WithEvents xw_rmb As System.Web.UI.WebControls.TextBox
Protected WithEvents cxzc_sj As System.Web.UI.WebControls.TextBox
Protected WithEvents cxzc_fs As System.Web.UI.WebControls.TextBox
Protected WithEvents cxzc_rmb As System.Web.UI.WebControls.TextBox
Protected WithEvents cxzp_pl As System.Web.UI.WebControls.TextBox
Protected WithEvents cxzp_sl As System.Web.UI.WebControls.TextBox
Protected WithEvents cxzp_rmb As System.Web.UI.WebControls.TextBox
Protected WithEvents ztzz_sc As System.Web.UI.WebControls.TextBox
Protected WithEvents ztzz_wz As System.Web.UI.WebControls.TextBox
Protected WithEvents ztzz_rmb As System.Web.UI.WebControls.TextBox
Protected WithEvents lhbg_rmb As System.Web.UI.WebControls.TextBox
Protected WithEvents dq_sl As System.Web.UI.WebControls.TextBox
Protected WithEvents dq_rmb As System.Web.UI.WebControls.TextBox
Protected WithEvents tf_sl As System.Web.UI.WebControls.TextBox
Protected WithEvents tf_rmb As System.Web.UI.WebControls.TextBox
Protected WithEvents ly_sl As System.Web.UI.WebControls.TextBox
Protected WithEvents ly_rmb As System.Web.UI.WebControls.TextBox
Protected WithEvents hf_sl As System.Web.UI.WebControls.TextBox
Protected WithEvents hf_rmb As System.Web.UI.WebControls.TextBox
Protected WithEvents gm_sl As System.Web.UI.WebControls.TextBox
Protected WithEvents gm_rmb As System.Web.UI.WebControls.TextBox
Protected WithEvents qq_sl As System.Web.UI.WebControls.TextBox
Protected WithEvents qq_rmb As System.Web.UI.WebControls.TextBox
Protected WithEvents kp_sl As System.Web.UI.WebControls.TextBox
Protected WithEvents kp_rmb As System.Web.UI.WebControls.TextBox
Protected WithEvents qthd_sl As System.Web.UI.WebControls.TextBox
Protected WithEvents qthd_rmb As System.Web.UI.WebControls.TextBox
Protected WithEvents txtbh As System.Web.UI.WebControls.TextBox
Protected WithEvents xwf_pl As System.Web.UI.WebControls.TextBox
Protected WithEvents xwf_wz As System.Web.UI.WebControls.TextBox
Protected WithEvents menu_tb As System.Web.UI.HtmlControls.HtmlTable
Protected WithEvents dt_sl As System.Web.UI.WebControls.TextBox
Protected WithEvents dt_rmb As System.Web.UI.WebControls.TextBox
Protected WithEvents cxhj_yf_dxrmb As System.Web.UI.WebControls.TextBox
Protected WithEvents cxhj_yf_zh As System.Web.UI.WebControls.TextBox
Protected WithEvents cxhj_yf_lhcx As System.Web.UI.WebControls.TextBox
Protected WithEvents cxhj_js_dxrmb As System.Web.UI.WebControls.TextBox
Protected WithEvents cxhj_jf_rmb As System.Web.UI.WebControls.TextBox
Protected WithEvents txt_jzxzl1 As System.Web.UI.WebControls.TextBox
Protected WithEvents txt_jzxzl2 As System.Web.UI.WebControls.TextBox
Protected WithEvents txt_jzxzl3 As System.Web.UI.WebControls.TextBox
Protected WithEvents t_dxsj As System.Web.UI.WebControls.TextBox
Protected WithEvents t_txfs As System.Web.UI.WebControls.TextBox
Protected WithEvents t_sjsk As System.Web.UI.WebControls.TextBox
Protected WithEvents t_cwjbr As System.Web.UI.WebControls.TextBox
Protected WithEvents rbl1 As System.Web.UI.WebControls.RadioButtonList
Protected WithEvents rbl2 As System.Web.UI.WebControls.RadioButtonList
Protected WithEvents rbl3 As System.Web.UI.WebControls.RadioButtonList

'注意: 以下占位符声明是 Web 窗体设计器所必需的。
'不要删除或移动它。
Private designerPlaceholderDeclaration As System.Object

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: 此方法调用是 Web 窗体设计器所必需的
'不要使用代码编辑器修改它。
InitializeComponent()
End Sub

#End Region
#Region "窗体事件"
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'页的用户代码()
PageInit()
getCPB()
'公司绑定
liandong()
If (Request.QueryString("status") Is Nothing) Then

ElseIf (Request.QueryString("status") = "1") Then
viewstate("state") = State.增加
Dim gmname As String = Request.QueryString("cdep")
Dim billcode As String = Request.QueryString("billcode")
Me.txtbh.Text = billcode


ElseIf (Request.QueryString("status") = "2") Then
viewstate("state") = State.修改
setEditForm(Request.QueryString("htcode"))


End If
End Sub

'保存
Private Sub BtnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnSave.Click
Try
If (Convert.ToString(viewstate("state")) = State.增加) Then
add()
ElseIf (Convert.ToString(viewstate("state")) = State.修改) Then
Upd()
End If
Cls_common.ShowErrMessage("保存成功")
Catch ex As Exception
Response.Write(Cls_common.ShowErrMessage(ex.Message))
End Try

End Sub
'删除合同
Private Sub BtnDelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnDelete.Click
Try
deletesub()
Cls_common.ShowErrMessage("删除成功")
Catch ex As Exception
Response.Write(Cls_common.ShowErrMessage(ex.Message))
End Try
End Sub
'取消操作
Private Sub BtnCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnCancel.Click
Response.Write("<script language=javascript>history.go(-1)</script>")
End Sub
'打印合同
Private Sub BtnSavePrint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnSavePrint.Click
Dim sql As String = "update sn_ht set iPrint=iPrint+1 where txtbh=@txtbh"
Dim cmd As SqlCommand = New SqlCommand
cmd.Parameters.Add(New SqlParameter("@txtbh", txtbh.Text))
cmd.CommandText = sql
Cls_common.ExecUpdateSQL(cmd)
End Sub
'盖章操作
Private Sub BtnCheckYes_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnCheckYes.Click

Try
GaiZhangSub()
Catch ex As Exception
Response.Write(Cls_common.ShowErrMessage(ex.Message))
End Try
End Sub
'取消操作
Private Sub BtnCancelGZ_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnCancelGZ.Click
Try
QuXiaoGaiSub()
Catch ex As Exception
Response.Write(Cls_common.ShowErrMessage(ex.Message))
End Try
End Sub
#End Region
#Region "函数体"
'窗体初始化
Public Sub PageInit()
Me.ddlcp.Attributes("onchange") = "document.getElementById('txttp_cp').value=this.options[this.selectedIndex].text"
Me.ddlcompany.Attributes("onchange") = "document.getElementById('txttp_jf').value=this.options[this.selectedIndex].text"
End Sub

'添加

Public Sub add()
Dim user As Cls_User = Session("user")
Dim sql As String = "insert into sn_ht(cUser,txtbh,cGHcode,txttp_y,txttp_m,txttp_d,txttp_dd,ddlcompany,ddlcp,txttp_jfgtr,txttp_yf,txttp_yfgtr,xwf_pl,xwf_wz,xw_rmb,cxzc_sj,cxzc_fs,cxzc_rmb,cxzp_pl,cxzp_sl,cxzp_rmb,ztzz_sc,ztzz_wz,ztzz_rmb,lhbg_rmb,dt_sl,dt_rmb,dq_sl,dq_rmb,tf_sl,tf_rmb,ly_sl,ly_rmb,hf_sl,hf_rmb,gm_sl,gm_rmb,qq_sl,qq_rmb,kp_sl,kp_rmb,qthd_sl,qthd_rmb,t_dxsj,t_txfs,t_sjsk,t_cwjbr,datenow,txt_jzxzl1,txt_jzxzl2,txt_jzxzl3,rbl1,rbl2,rbl3) values(@cUser,@txtbh,@cGHcode,@txttp_y,@txttp_m,@txttp_d,@txttp_dd,@ddlcompany,@ddlcp,@txttp_jfgtr,@txttp_yf,@txttp_yfgtr,@xwf_pl,@xwf_wz,@xw_rmb,@cxzc_sj,@cxzc_fs,@cxzc_rmb,@cxzp_pl,@cxzp_sl,@cxzp_rmb,@ztzz_sc,@ztzz_wz,@ztzz_rmb,@lhbg_rmb,@dt_sl,@dt_rmb,@dq_sl,@dq_rmb,@tf_sl,@tf_rmb,@ly_sl,@ly_rmb,@hf_sl,@hf_rmb,@gm_sl,@gm_rmb,@qq_sl,@qq_rmb,@kp_sl,@kp_rmb,@qthd_sl,@qthd_rmb,@t_dxsj,@t_txfs,@t_sjsk,@t_cwjbr,@datenow,@txt_jzxzl1,@txt_jzxzl2,@txt_jzxzl3,@rbl1,@rbl2,@rbl3)"
Dim cmd As SqlCommand = New SqlCommand
cmd.Parameters.Add(New SqlParameter("@cUser", user.cUserName))
cmd.Parameters.Add(New SqlParameter("@txtbh", txtbh.Text))
cmd.Parameters.Add(New SqlParameter("@cGHcode", "HT" & txtbh.Text))
cmd.Parameters.Add(New SqlParameter("@txttp_y", txttp_y.Text))
cmd.Parameters.Add(New SqlParameter("@txttp_m", txttp_m.Text))
cmd.Parameters.Add(New SqlParameter("@txttp_d", txttp_d.Text))
cmd.Parameters.Add(New SqlParameter("@txttp_dd", txttp_dd.Text))
cmd.Parameters.Add(New SqlParameter("@ddlcompany", ddlcompany.SelectedValue))
cmd.Parameters.Add(New SqlParameter("@ddlcp", ddlcp.SelectedValue))
cmd.Parameters.Add(New SqlParameter("@txttp_jfgtr", txttp_jfgtr.Text))
cmd.Parameters.Add(New SqlParameter("@txttp_yf", txttp_yf.Text))
cmd.Parameters.Add(New SqlParameter("@txttp_yfgtr", txttp_yfgtr.Text))
cmd.Parameters.Add(New SqlParameter("@xwf_pl", xwf_pl.Text))
cmd.Parameters.Add(New SqlParameter("@xwf_wz", xwf_wz.Text))
cmd.Parameters.Add(New SqlParameter("@xw_rmb", xw_rmb.Text))
cmd.Parameters.Add(New SqlParameter("@cxzc_sj", cxzc_sj.Text))
cmd.Parameters.Add(New SqlParameter("@cxzc_fs", cxzc_fs.Text))
cmd.Parameters.Add(New SqlParameter("@cxzc_rmb", cxzc_rmb.Text))
cmd.Parameters.Add(New SqlParameter("@cxzp_pl", cxzp_pl.Text))
cmd.Parameters.Add(New SqlParameter("@cxzp_sl", cxzp_sl.Text))
cmd.Parameters.Add(New SqlParameter("@cxzp_rmb", cxzp_rmb.Text))
cmd.Parameters.Add(New SqlParameter("@ztzz_sc", ztzz_sc.Text))
cmd.Parameters.Add(New SqlParameter("@ztzz_wz", ztzz_wz.Text))
cmd.Parameters.Add(New SqlParameter("@ztzz_rmb", ztzz_rmb.Text))
cmd.Parameters.Add(New SqlParameter("@lhbg_rmb", lhbg_rmb.Text))
cmd.Parameters.Add(New SqlParameter("@dt_sl", dt_sl.Text))
cmd.Parameters.Add(New SqlParameter("@dt_rmb", dt_rmb.Text))
cmd.Parameters.Add(New SqlParameter("@dq_sl", dq_sl.Text))
cmd.Parameters.Add(New SqlParameter("@dq_rmb", dq_rmb.Text))
cmd.Parameters.Add(New SqlParameter("@tf_sl", tf_sl.Text))
cmd.Parameters.Add(New SqlParameter("@tf_rmb", tf_rmb.Text))
cmd.Parameters.Add(New SqlParameter("@ly_sl", ly_sl.Text))
cmd.Parameters.Add(New SqlParameter("@ly_rmb", ly_rmb.Text))
cmd.Parameters.Add(New SqlParameter("@hf_sl", hf_sl.Text))
cmd.Parameters.Add(New SqlParameter("@hf_rmb", hf_rmb.Text))
cmd.Parameters.Add(New SqlParameter("@gm_sl", gm_sl.Text))
cmd.Parameters.Add(New SqlParameter("@gm_rmb", gm_rmb.Text))
cmd.Parameters.Add(New SqlParameter("@qq_sl", qq_sl.Text))
cmd.Parameters.Add(New SqlParameter("@qq_rmb", qq_rmb.Text))
cmd.Parameters.Add(New SqlParameter("@kp_sl", kp_sl.Text))
cmd.Parameters.Add(New SqlParameter("@kp_rmb", kp_rmb.Text))
cmd.Parameters.Add(New SqlParameter("@qthd_sl", qthd_sl.Text))
cmd.Parameters.Add(New SqlParameter("@qthd_rmb", qthd_rmb.Text))
cmd.Parameters.Add(New SqlParameter("@t_dxsj", t_dxsj.Text))
cmd.Parameters.Add(New SqlParameter("@t_txfs", t_txfs.Text))
cmd.Parameters.Add(New SqlParameter("@t_sjsk", t_sjsk.Text))
cmd.Parameters.Add(New SqlParameter("@t_cwjbr", t_cwjbr.Text))
cmd.Parameters.Add(New SqlParameter("@datenow", DateTime.Now.ToString()))
cmd.Parameters.Add(New SqlParameter("@txt_jzxzl1", txt_jzxzl1.Text))
cmd.Parameters.Add(New SqlParameter("@txt_jzxzl2", txt_jzxzl2.Text))
cmd.Parameters.Add(New SqlParameter("@txt_jzxzl3", txt_jzxzl3.Text))
cmd.Parameters.Add(New SqlParameter("@rbl1", rbl1.SelectedValue))
cmd.Parameters.Add(New SqlParameter("@rbl2", rbl2.SelectedValue))
cmd.Parameters.Add(New SqlParameter("@rbl3", rbl3.SelectedValue))

cmd.CommandText = sql
Cls_common.ExecUpdateSQL(cmd)
cmd.Parameters.Clear()
sql = "update t_wlkff_bill set bht=1,chtcode=@chtcode,chttypecode=@chttypecode where cbillcode=@cbillcode"
cmd.Parameters.Add(New SqlParameter("@chtcode", "HT" & txtbh.Text))
cmd.Parameters.Add(New SqlParameter("@chttypecode", "02"))
cmd.Parameters.Add(New SqlParameter("@cbillcode", txtbh.Text))
cmd.CommandText = sql
Cls_common.ExecUpdateSQL(cmd)

End Sub
'修改
Public Sub Upd()
Dim sql As String = "update sn_ht set txttp_y=@txttp_y,txttp_m=@txttp_m,txttp_d=@txttp_d,txttp_dd=@txttp_dd,ddlcompany=@ddlcompany,ddlcp=@ddlcp,txttp_jfgtr=@txttp_jfgtr,txttp_yf=@txttp_yf,txttp_yfgtr=@txttp_yfgtr,xwf_pl=@xwf_pl,xwf_wz=@xwf_wz,xw_rmb=@xw_rmb,cxzc_sj=@cxzc_sj,cxzc_fs=@cxzc_fs,cxzc_rmb=@cxzc_rmb,cxzp_pl=@cxzp_pl,cxzp_sl=@cxzp_sl,cxzp_rmb=@cxzp_rmb,ztzz_sc=@ztzz_sc,ztzz_wz=@ztzz_wz,ztzz_rmb=@ztzz_rmb,lhbg_rmb=@lhbg_rmb,dt_sl=@dt_sl,dt_rmb=@dt_rmb,dq_sl=@dq_sl,dq_rmb=@dq_rmb,tf_sl=@tf_sl,tf_rmb=@tf_rmb,ly_sl=@ly_sl,ly_rmb=@ly_rmb,hf_sl=@hf_sl,hf_rmb=@hf_rmb,gm_sl=@gm_sl,gm_rmb=@gm_rmb,qq_sl=@qq_sl,qq_rmb=@qq_rmb,kp_sl=@kp_sl,kp_rmb=@kp_rmb,qthd_sl=@qthd_sl,qthd_rmb=@qthd_rmb,t_dxsj=@t_dxsj,t_txfs=@t_txfs,t_sjsk=@t_sjsk,t_cwjbr=@t_cwjbr,txt_jzxzl1=@txt_jzxzl1,txt_jzxzl2=@txt_jzxzl2,txt_jzxzl3=@txt_jzxzl3,rbl1=@rbl1,rbl2=@rbl2,rbl3=@rbl3 where txtbh=@txtbh"
Dim cmd As SqlCommand = New SqlCommand
cmd.Parameters.Add(New SqlParameter("@txtbh", txtbh.Text))
cmd.Parameters.Add(New SqlParameter("@txttp_y", txttp_y.Text))
cmd.Parameters.Add(New SqlParameter("@txttp_m", txttp_m.Text))
cmd.Parameters.Add(New SqlParameter("@txttp_d", txttp_d.Text))
cmd.Parameters.Add(New SqlParameter("@txttp_dd", txttp_dd.Text))
cmd.Parameters.Add(New SqlParameter("@ddlcompany", ddlcompany.SelectedValue))
cmd.Parameters.Add(New SqlParameter("@ddlcp", ddlcp.SelectedValue))
cmd.Parameters.Add(New SqlParameter("@txttp_jfgtr", txttp_jfgtr.Text))
cmd.Parameters.Add(New SqlParameter("@txttp_yf", txttp_yf.Text))
cmd.Parameters.Add(New SqlParameter("@txttp_yfgtr", txttp_yfgtr.Text))
cmd.Parameters.Add(New SqlParameter("@xwf_pl", xwf_pl.Text))
cmd.Parameters.Add(New SqlParameter("@xwf_wz", xwf_wz.Text))
cmd.Parameters.Add(New SqlParameter("@xw_rmb", xw_rmb.Text))
cmd.Parameters.Add(New SqlParameter("@cxzc_sj", cxzc_sj.Text))
cmd.Parameters.Add(New SqlParameter("@cxzc_fs", cxzc_fs.Text))
cmd.Parameters.Add(New SqlParameter("@cxzc_rmb", cxzc_rmb.Text))
cmd.Parameters.Add(New SqlParameter("@cxzp_pl", cxzp_pl.Text))
cmd.Parameters.Add(New SqlParameter("@cxzp_sl", cxzp_sl.Text))
cmd.Parameters.Add(New SqlParameter("@cxzp_rmb", cxzp_rmb.Text))
cmd.Parameters.Add(New SqlParameter("@ztzz_sc", ztzz_sc.Text))
cmd.Parameters.Add(New SqlParameter("@ztzz_wz", ztzz_wz.Text))
cmd.Parameters.Add(New SqlParameter("@ztzz_rmb", ztzz_rmb.Text))
cmd.Parameters.Add(New SqlParameter("@lhbg_rmb", lhbg_rmb.Text))
cmd.Parameters.Add(New SqlParameter("@dt_sl", dt_sl.Text))
cmd.Parameters.Add(New SqlParameter("@dt_rmb", dt_rmb.Text))
cmd.Parameters.Add(New SqlParameter("@dq_sl", dq_sl.Text))
cmd.Parameters.Add(New SqlParameter("@dq_rmb", dq_rmb.Text))
cmd.Parameters.Add(New SqlParameter("@tf_sl", tf_sl.Text))
cmd.Parameters.Add(New SqlParameter("@tf_rmb", tf_rmb.Text))
cmd.Parameters.Add(New SqlParameter("@ly_sl", ly_sl.Text))
cmd.Parameters.Add(New SqlParameter("@ly_rmb", ly_rmb.Text))
cmd.Parameters.Add(New SqlParameter("@hf_sl", hf_sl.Text))
cmd.Parameters.Add(New SqlParameter("@hf_rmb", hf_rmb.Text))
cmd.Parameters.Add(New SqlParameter("@gm_sl", gm_sl.Text))
cmd.Parameters.Add(New SqlParameter("@gm_rmb", gm_rmb.Text))
cmd.Parameters.Add(New SqlParameter("@qq_sl", qq_sl.Text))
cmd.Parameters.Add(New SqlParameter("@qq_rmb", qq_rmb.Text))
cmd.Parameters.Add(New SqlParameter("@kp_sl", kp_sl.Text))
cmd.Parameters.Add(New SqlParameter("@kp_rmb", kp_rmb.Text))
cmd.Parameters.Add(New SqlParameter("@qthd_sl", qthd_sl.Text))
cmd.Parameters.Add(New SqlParameter("@qthd_rmb", qthd_rmb.Text))
cmd.Parameters.Add(New SqlParameter("@t_dxsj", t_dxsj.Text))
cmd.Parameters.Add(New SqlParameter("@t_txfs", t_txfs.Text))
cmd.Parameters.Add(New SqlParameter("@t_sjsk", t_sjsk.Text))
cmd.Parameters.Add(New SqlParameter("@t_cwjbr", t_cwjbr.Text))
cmd.Parameters.Add(New SqlParameter("@txt_jzxzl1", txt_jzxzl1.Text))
cmd.Parameters.Add(New SqlParameter("@txt_jzxzl2", txt_jzxzl2.Text))
cmd.Parameters.Add(New SqlParameter("@txt_jzxzl3", txt_jzxzl3.Text))
cmd.Parameters.Add(New SqlParameter("@rbl1", rbl1.SelectedValue))
cmd.Parameters.Add(New SqlParameter("@rbl2", rbl2.SelectedValue))
cmd.Parameters.Add(New SqlParameter("@rbl3", rbl3.SelectedValue))
cmd.CommandText = sql
Cls_common.ExecUpdateSQL(cmd)
End Sub
''删除
Public Sub deletesub()
Dim sql As String = "delete from sn_ht where txtbh=@txtbh"
Dim cmd As SqlCommand = New SqlCommand
cmd.Parameters.Add(New SqlParameter("@txtbh", txtbh.Text))
cmd.CommandText = sql
Cls_common.ExecUpdateSQL(cmd)
End Sub
Public Sub GaiZhangSub()
Dim user As Cls_User = Session("user")
Dim sql As String = "update sn_ht set bgzmark=1,cgzuser=@cgzuser,dgzdate1=getdate() where txtbh=@txtbh"
Dim cmd As SqlCommand = New SqlCommand
cmd.Parameters.Add(New SqlParameter("@txtbh", txtbh.Text))
cmd.Parameters.Add(New SqlParameter("@cgzuser", user.cUserName))
cmd.CommandText = sql
Cls_common.ExecUpdateSQL(cmd)

End Sub
Public Sub QuXiaoGaiSub()
Dim sql As String = "update sn_ht set gz=0,cgzuser=null,dgzdate1=null where txtbh=@txtbh"
Dim cmd As SqlCommand = New SqlCommand
cmd.Parameters.Add(New SqlParameter("@txtbh", txtbh.Text))
cmd.CommandText = sql
Cls_common.ExecUpdateSQL(cmd)
End Sub
'部门帮定
Private Sub getCPB()
ddlcp.DataSource = Cls_common.ExecQuerySQL("select cdepcode,cdepname from t_department where ilevel = 2 " & _
" union all select 'all','全系列' " & _
" order by cdepcode")
ddlcp.DataBind()
End Sub
'公司绑定
Private Sub liandong()
Dim cdep As String = Request.QueryString("cdep")
'Response.Write(cdep)
If cdep Is Nothing Then
Exit Sub
End If
Dim sql As String = String.Format("select c.* from t_department a,t_wlkff_Dep_Account b,t_wlkff_Account c where a.ilevel=3 and a.cDepname<>'商流出帐'and a.cdepcode=b.cdepcode and b.cAccountCode=c.cAccountCode and a.cdepname='{0}' order by b.caccountcode", cdep)
Dim dtcom As DataTable = Cls_common.ExecQuerySQL(sql)
Me.ddlcompany.DataSource = dtcom
Me.ddlcompany.DataTextField = "CAccountName"
Me.ddlcompany.DataValueField = "cAccountCode"
Me.ddlcompany.DataBind()
End Sub
Public Sub setEditForm(ByVal str As String)
Dim sql As String = "select * from sn_ht where txtbh='" & str & "'"
Dim dttemp As DataTable = Cls_common.ExecQuerySQL(sql)
If dttemp.Rows.Count < 1 Then

Else
Dim drtemp As DataRow = dttemp.Rows(0)
txttp_y.Text = Convert.ToString(drtemp("txttp_y"))
txttp_m.Text = Convert.ToString(drtemp("txttp_m"))
txttp_d.Text = Convert.ToString(drtemp("txttp_d"))
txttp_dd.Text = Convert.ToString(drtemp("txttp_dd"))
ddlcompany.SelectedValue = Convert.ToString(drtemp("ddlcompany"))
ddlcp.SelectedValue = Convert.ToString(drtemp("ddlcp"))
txttp_jfgtr.Text = Convert.ToString(drtemp("txttp_jfgtr"))
txttp_yf.Text = Convert.ToString(drtemp("txttp_yf"))
txttp_yfgtr.Text = Convert.ToString(drtemp("txttp_yfgtr"))
xwf_pl.Text = Convert.ToString(drtemp("xwf_pl"))
xwf_wz.Text = Convert.ToString(drtemp("xwf_wz"))
xw_rmb.Text = Convert.ToString(drtemp("xw_rmb"))
cxzc_sj.Text = Convert.ToString(drtemp("cxzc_sj"))
cxzc_fs.Text = Convert.ToString(drtemp("cxzc_fs"))
cxzc_rmb.Text = Convert.ToString(drtemp("cxzc_rmb"))
cxzp_pl.Text = Convert.ToString(drtemp("cxzp_pl"))
cxzp_sl.Text = Convert.ToString(drtemp("cxzp_sl"))
cxzp_rmb.Text = Convert.ToString(drtemp("cxzp_rmb"))
ztzz_sc.Text = Convert.ToString(drtemp("ztzz_sc"))
ztzz_wz.Text = Convert.ToString(drtemp("ztzz_wz"))
ztzz_rmb.Text = Convert.ToString(drtemp("ztzz_rmb"))
lhbg_rmb.Text = Convert.ToString(drtemp("lhbg_rmb"))
dt_sl.Text = Convert.ToString(drtemp("dt_sl"))
dt_rmb.Text = Convert.ToString(drtemp("dt_rmb"))
dq_sl.Text = Convert.ToString(drtemp("dq_sl"))
dq_rmb.Text = Convert.ToString(drtemp("dq_rmb"))
tf_sl.Text = Convert.ToString(drtemp("tf_sl"))
tf_rmb.Text = Convert.ToString(drtemp("tf_rmb"))
ly_sl.Text = Convert.ToString(drtemp("ly_sl"))
ly_rmb.Text = Convert.ToString(drtemp("ly_rmb"))
hf_sl.Text = Convert.ToString(drtemp("hf_sl"))
hf_rmb.Text = Convert.ToString(drtemp("hf_rmb"))
gm_sl.Text = Convert.ToString(drtemp("gm_sl"))
gm_rmb.Text = Convert.ToString(drtemp("gm_rmb"))
qq_sl.Text = Convert.ToString(drtemp("qq_sl"))
qq_rmb.Text = Convert.ToString(drtemp("qq_rmb"))
kp_sl.Text = Convert.ToString(drtemp("kp_sl"))
kp_rmb.Text = Convert.ToString(drtemp("kp_rmb"))
qthd_sl.Text = Convert.ToString(drtemp("qthd_sl"))
qthd_rmb.Text = Convert.ToString(drtemp("qthd_rmb"))
t_dxsj.Text = Convert.ToString(drtemp("t_dxsj"))
t_txfs.Text = Convert.ToString(drtemp("t_txfs"))
t_sjsk.Text = Convert.ToString(drtemp("t_sjsk"))
t_cwjbr.Text = Convert.ToString(drtemp("t_cwjbr"))
txt_jzxzl1.Text = Convert.ToString(drtemp("txt_jzxzl1"))
txt_jzxzl2.Text = Convert.ToString(drtemp("txt_jzxzl2"))
txt_jzxzl3.Text = Convert.ToString(drtemp("txt_jzxzl3"))
rbl1.SelectedValue = Convert.ToString(drtemp("rbl1"))
rbl2.SelectedValue = Convert.ToString(drtemp("rbl2"))
rbl3.SelectedValue = Convert.ToString(drtemp("rbl3"))
End If
End Sub

#End Region


Private Sub BtnGz_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnGz.Click

End Sub
End Class

你可能感兴趣的:(JavaScript,sql,UI,Web,qq)