Rss & SiteMap
Foxtable(狐表) http://www.foxtable.com
Dim dr1,dr2,dr3 As DataRow
Dim ld As Date
Dim str1,str2,str3,str4,str5,str6,mk As string
Dim r As integer
str1 = e.form.Controls("ComboBox3").Value
str2 = e.form.Controls("TextBox19").Value
str3 = e.form.Controls("TextBox7").Value
str4 = date.today
str5 = e.form.Controls("TextBox18").Value
str6 = e.form.controls("TextBox17").Value
if str1 is nothing then
msgbox("请选择出院患者住院号!",64,"提示")
Else
if str6 is nothing then
msgbox("此患者未办理出院申请!",64,"提示")
Else
dr1 = DataTables("住院登记").Find("住院号 = '"& str1 &"'")
If dr1("出院结账") = True Then
msgbox("此患者已出院结账!",64,"提示")
Else
dr1("出院结账") = True
dr2 = DataTables("出院结账").Find("住院ID = '"& str2 &"'")
If dr2 IsNot nothing Then
msgbox("已存在相同结账记录,请联系管理员修正程序!",64,"提示")
Else
Dim cmd As New SQLcommand
cmd.C
cmd.CommandText = "Insert Into 出院结账 (住院号, 住院ID, 姓名,结账日期,入院日期) Values('" & str1 & "', '" & str2 & "', '" & str3 & "', '" & str4 & "', '" & str5 & "')"
cmd.ExecuteNonQuery()
DataTables("出院结账").Load()
Dim dtb As New DataTableBuilder("清单0")
dtb.AddDef("住院ID", GetType(String), 32)
dtb.AddDef("类别", GetType(String), 32)
dtb.AddDef("项目", GetType(String), 32)
dtb.AddDef("规格", GetType(String), 32)
dtb.AddDef("单位", GetType(String), 32)
dtb.AddDef("单价", GetType(Double))
dtb.AddDef("用量", GetType(Double))
dtb.AddDef("小计", GetType(Double))
dtb.Build()
Dim Cz As DataTable = DataTables("长嘱")
Dim Lz As DataTable = DataTables("临嘱")
mk = "[住院ID] = '" & str2 & "'"
dim f As New Filler
f.SourceTable = Cz
f.SourceCols = "住院ID,类别,项目,规格,单位,单价,总用量,金额"
f.DataTable = DataTables("清单0")
f.DataCols = "住院ID,类别,项目,规格,单位,单价,用量,小计"
f.Filter = mk
f.Fill()
f.SourceTable = Lz
f.SourceCols = "住院ID,类别,项目,规格,单位,单价,用量,小计"
f.DataTable = DataTables("清单0") '指定数据接收表
f.DataCols = "住院ID,类别,项目,规格,单位,单价,用量,小计"
f.Filter = mk
f.Fill()
Dim dst0 As WinForm.DataList = e.Form.Controls("DataList5")
dst0.DataTable = DataTables("清单0")
dst0.Build()
dr3 = DataTables("出院结账").Find("住院ID = '"& str2 &"'")
r = Tables("出院结账").FindRow(dr3)
Dim ColNames() As String = {"西药","中成药","中草药","床位","诊查","检查","护理","治疗","手术","检验","其他","特需服务","其他"}
For Each ColName As String In ColNames
Tables("出院结账").Rows(r)(ColName) = DataTables("清单0").Compute("sum(小计)","[类别] = '" & ColName & "'")+0
Next
For Each dt As DataTable In DataTables
dt.Save()
Next
if MessageBox.Show("'"& str3 &"'结账成功,打印fa piao吗?","提示",MessageBoxButtons.OKCancel,MessageBoxIcon.Question) = 1
Forms("fa piao打印").Open
end if
'生成在院患者情况列表
cmd.CommandText = "Select 入院日期,住院号,姓名,性别,年龄,入院诊断,费用类别,出院诊断,出院申请 From [住院登记] where 出院结账 = false"
Dim dst As WinForm.DataList = e.Form.Controls("DataList3")
dst.DataTable = cmd.ExecuteReader()
dst.Build()
End If
End If
End If
End If
如果安装了VB2005 ,找个能输入代码的地方,复制进去,他回自动帮你整理格式.
整理完毕后复制回来就行.
如果嫌麻烦,自己可以在不同嵌套的层次前按TAB
强烈支持!!!真的很有用,对初学者来讲.
初学者本来就不熟,写着写着连自己都看不明白了...因为太乱..
该打,到现在才说这话。
该打,到现在才说这话。
这个好