You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
408 lines
14 KiB
408 lines
14 KiB
Public Class PatientAbrechnung
|
|
|
|
#Region "Properties"
|
|
Dim m_patientnr As Integer
|
|
Property PatientNr As Integer
|
|
Get
|
|
Return m_patientnr
|
|
End Get
|
|
Set(value As Integer)
|
|
Try
|
|
If value = 0 Then Exit Property
|
|
m_patientnr = value
|
|
Fill_Stammdaten()
|
|
Get_Data()
|
|
Catch ex As Exception
|
|
log.Writelog("PatientAbrechnung: PatientNr Set: " + ex.Message, clsLog.Logtype.ApplError)
|
|
Dim a As Integer = 1
|
|
End Try
|
|
End Set
|
|
End Property
|
|
|
|
Dim m_haschanges As Boolean
|
|
Property HasChanges As Boolean
|
|
Get
|
|
Return m_haschanges
|
|
End Get
|
|
Set(value As Boolean)
|
|
m_haschanges = value
|
|
End Set
|
|
End Property
|
|
|
|
#End Region
|
|
|
|
#Region "Deklarationen"
|
|
Dim DB As New clsDB
|
|
Dim log As New clsLog
|
|
Dim FormReadonly As Boolean = False
|
|
Dim WithEvents evh As Generic_Event_Handler = Globals.EVH
|
|
|
|
#End Region
|
|
|
|
#Region "Closing / Check_Changes"
|
|
|
|
''' <summary>
|
|
''' Prüfung, ob Datenänderungen vorgenommen wurden.
|
|
''' </summary>
|
|
''' <remarks></remarks>
|
|
Private Function Check_Changes() As Boolean
|
|
If Me.FormReadonly Then
|
|
Return True
|
|
Exit Function
|
|
End If
|
|
Dim msgres As MsgBoxResult
|
|
If Me.HasChanges Then
|
|
msgres = MsgBox("Daten wurden verändert. Wollen Sie die Änderungen speichern", vbYesNo + vbQuestion)
|
|
Select Case msgres
|
|
Case MsgBoxResult.Yes
|
|
Save_Data()
|
|
Return True
|
|
Case MsgBoxResult.Cancel
|
|
Return False
|
|
Case MsgBoxResult.No
|
|
Me.HasChanges = False
|
|
Return True
|
|
End Select
|
|
Else
|
|
Return True
|
|
End If
|
|
End Function
|
|
|
|
#End Region
|
|
|
|
#Region "Eventhandler ChangeEreignisse"
|
|
''' <summary>
|
|
''' Allg Eventhandler für Chanage-Ereignise festlegen
|
|
''' </summary>
|
|
''' <param name="Container"></param>
|
|
''' <remarks></remarks>
|
|
Private Sub AddChanges(ByVal Container As Control)
|
|
Dim l As New List(Of Control)
|
|
Me.GetControl(Me, "*", l)
|
|
Dim evh As EventHandler = AddressOf ChangesMade
|
|
For Each c As Control In l
|
|
If TypeOf c Is TextBox Then
|
|
Dim ctl As TextBox = c
|
|
AddHandler ctl.TextChanged, evh
|
|
End If
|
|
If TypeOf c Is MaskedTextBox Then
|
|
Dim ctl As MaskedTextBox = c
|
|
AddHandler ctl.TextChanged, evh
|
|
End If
|
|
If TypeOf c Is ComboBox Then
|
|
Dim ctl As ComboBox = c
|
|
AddHandler ctl.SelectedValueChanged, evh
|
|
End If
|
|
If TypeOf c Is RichTextBox Then
|
|
Dim ctl As RichTextBox = c
|
|
AddHandler ctl.TextChanged, evh
|
|
End If
|
|
If TypeOf c Is CheckBox Then
|
|
If c.Name <> "cboxNurAktive" Then
|
|
Dim ctl As CheckBox = c
|
|
AddHandler ctl.CheckedChanged, evh
|
|
End If
|
|
End If
|
|
If TypeOf c Is DateTimePicker Then
|
|
Dim ctl As DateTimePicker = c
|
|
AddHandler ctl.ValueChanged, evh
|
|
End If
|
|
If TypeOf c Is CheckedListBox Then
|
|
Dim ctl As CheckedListBox = c
|
|
AddHandler ctl.ItemCheck, AddressOf ChecketListBoxChange
|
|
End If
|
|
Next
|
|
End Sub
|
|
''' <summary>
|
|
''' Envent-Handler für Change-Ereignisse
|
|
''' </summary>
|
|
''' <param name="sender"></param>
|
|
''' <param name="e"></param>
|
|
''' <remarks></remarks>
|
|
Private Sub ChangesMade(ByVal sender As Object, ByVal e As System.EventArgs)
|
|
Me.HasChanges = True
|
|
Dim objtype As System.Type = sender.GetType
|
|
If objtype.Name = "MaskedTextBox" Then
|
|
Dim o As MaskedTextBox = sender
|
|
If o.Text = "01.01.1900" Then o.Text = " . . "
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub ChecketListBoxChange(ByVal sender As Object, ByVal e As System.Windows.Forms.ItemCheckEventArgs)
|
|
Me.HasChanges = True
|
|
End Sub
|
|
|
|
|
|
''' <summary>
|
|
''' Sucht in den Base-Controls sämtliche Controls mit dem Namen in "Key" (Wildcards * möglich) und listet
|
|
''' die gefundnen Controls in der Liste L zur weiteren Bearbeitung
|
|
''' </summary>
|
|
''' <param name="BaseControl">Base-Contrlo (z.B. aktuelles Formular</param>
|
|
''' <param name="Key">Schlüssel welcher gesucht werden soll</param>
|
|
''' <param name="L">Liste der gefundenen Objekte</param>
|
|
''' <returns>True wenn eines oder mehr Controls gefunden wurden, false wenn kein Control gefunden wurde.
|
|
''' </returns>
|
|
''' <remarks></remarks>
|
|
Private Function GetControl(ByVal BaseControl As Control, ByVal Key As String, ByRef L As List(Of Control), Optional ByVal ReturnAtFirstElement As Boolean = False) As Boolean
|
|
If L Is Nothing Then L = New List(Of Control)
|
|
Dim Gut As Boolean
|
|
Dim ReturnFlag As Boolean = False
|
|
If Key IsNot Nothing Then Key = Key.ToLower
|
|
|
|
If BaseControl.HasChildren = True Then
|
|
For Each ctl As Control In BaseControl.Controls
|
|
Gut = False
|
|
If Key Is Nothing Then
|
|
Gut = True
|
|
Else
|
|
If ctl.Name.Length >= Key.Length Then
|
|
Key = Key.ToLower
|
|
If Key.StartsWith("*") Then
|
|
If Key.Substring(1) = ctl.Name.ToLower.Substring(ctl.Name.Length - (Key.Length - 1), Key.Length - 1) Then Gut = True
|
|
ElseIf Key.EndsWith("*") Then
|
|
If Key.Substring(0, Key.Length - 1) = ctl.Name.ToLower.Substring(0, Key.Length - 1) Then Gut = True
|
|
Else
|
|
If Key = ctl.Name.ToLower Then Gut = True
|
|
End If
|
|
End If
|
|
End If
|
|
|
|
If Gut = True Then
|
|
L.Add(ctl)
|
|
If ReturnAtFirstElement = True Then ReturnFlag = True
|
|
End If
|
|
If ReturnFlag = False Then
|
|
Call GetControl(ctl, Key, L)
|
|
End If
|
|
Next
|
|
End If
|
|
|
|
If L.Count - 1 > -1 Then
|
|
Return True
|
|
Else
|
|
Return False
|
|
End If
|
|
End Function
|
|
#End Region
|
|
|
|
#Region "Daten_Laden"
|
|
|
|
Public Sub Fill_Stammdaten()
|
|
Me.cbboxNrRGTyp.Table = "RGTyp"
|
|
Me.cbboxNrRGTyp.Displaymember = "BezD"
|
|
Me.cbboxNrRGTyp.Valuemember = "nrrgtyp"
|
|
|
|
Me.cbboxESTyp.Table = "ESTyp"
|
|
Me.cbboxESTyp.Displaymember = "estyp"
|
|
Me.cbboxESTyp.Valuemember = "nrestyp"
|
|
|
|
Me.cbboxzazRecallTyp.Table = "RecallTyp"
|
|
Me.cbboxzazRecallTyp.Displaymember = "RecallTyp"
|
|
Me.cbboxzazRecallTyp.Valuemember = "nrrecalltyp"
|
|
|
|
Me.cbboxnrbehandler.Dataselection = DB.Get_SQL(2)
|
|
Me.cbboxnrbehandler.Table = "Behandler"
|
|
Me.cbboxnrbehandler.Displaymember = "Name"
|
|
Me.cbboxnrbehandler.Valuemember = "nrprivat"
|
|
|
|
Me.cbboxNrGesVertreter.Dataselection = DB.Get_SQL(3)
|
|
Me.cbboxNrGesVertreter.Table = "GesVertreter"
|
|
Me.cbboxNrGesVertreter.Displaymember = "Name"
|
|
Me.cbboxNrGesVertreter.Valuemember = "nrprivat"
|
|
|
|
Me.cbboxNrGarant.Dataselection = DB.Get_SQL(4)
|
|
Me.cbboxNrGarant.Table = "Garant"
|
|
Me.cbboxNrGarant.Displaymember = "Name"
|
|
Me.cbboxNrGarant.Valuemember = "nrprivat"
|
|
|
|
Me.cbboxNRVS.Dataselection = DB.Get_SQL(5)
|
|
Me.cbboxNRVS.Table = "Versicherung"
|
|
Me.cbboxNRVS.Displaymember = "Firmenname"
|
|
Me.cbboxNRVS.Valuemember = "nrfirma"
|
|
|
|
Me.cbboxNRKK.Dataselection = DB.Get_SQL(6)
|
|
Me.cbboxNRKK.Table = "Krankenkasse"
|
|
Me.cbboxNRKK.Displaymember = "Firmenname"
|
|
Me.cbboxNRKK.Valuemember = "nrfirma"
|
|
|
|
Me.CBBOXNRIV.Dataselection = DB.Get_SQL(7)
|
|
Me.CBBOXNRIV.Table = "IVStelle"
|
|
Me.CBBOXNRIV.Displaymember = "Firmenname"
|
|
Me.CBBOXNRIV.Valuemember = "nrfirma"
|
|
|
|
Me.CBBOXNRFs.Dataselection = DB.Get_SQL(8)
|
|
Me.CBBOXNRFs.Table = "Fürsorgestelle"
|
|
Me.CBBOXNRFs.Displaymember = "Firmenname"
|
|
Me.CBBOXNRFs.Valuemember = "nrfirma"
|
|
|
|
Me.cbboxnrhausarzt.Dataselection = DB.Get_SQL(13)
|
|
Me.cbboxnrhausarzt.Table = "Hausarzt"
|
|
Me.cbboxnrhausarzt.Displaymember = "Name"
|
|
Me.cbboxnrhausarzt.Valuemember = "nrprivat"
|
|
|
|
Me.cbboxnrzahnarzt.Dataselection = DB.Get_SQL(14)
|
|
Me.cbboxnrzahnarzt.Table = "Zahnarzt"
|
|
Me.cbboxnrzahnarzt.Displaymember = "Name"
|
|
Me.cbboxnrzahnarzt.Valuemember = "nrprivat"
|
|
|
|
End Sub
|
|
|
|
|
|
|
|
|
|
Sub Get_Data()
|
|
DB.Get_Tabledata("privat", " where nrprivat=" + Me.PatientNr.ToString)
|
|
Dim r As DataRow = DB.dsDaten.Tables(0).Rows(0)
|
|
|
|
Get_Data_Controls(Me, r)
|
|
AddChanges(Me)
|
|
Me.HasChanges = False
|
|
End Sub
|
|
|
|
Sub Get_Data_Controls(ByVal ictl As Control, ByRef R As DataRow)
|
|
|
|
For Each ctl As Control In ictl.Controls
|
|
|
|
If ctl.Controls.Count = 0 Or (ctl.Controls.Count = 1 And Microsoft.VisualBasic.Left(UCase(ctl.Name), 5) = "CBBOX") Then
|
|
get_data_for_control(ctl, R)
|
|
Else
|
|
Get_Data_Controls(ctl, R)
|
|
End If
|
|
Next
|
|
End Sub
|
|
|
|
Sub get_data_for_control(ByRef ctl As Control, ByRef R As DataRow)
|
|
|
|
|
|
For Each c As DataColumn In DB.dsDaten.Tables(0).Columns
|
|
Try
|
|
If UCase(ctl.Name) = "TXT" + UCase(c.ColumnName) Then
|
|
ctl.Text = R(c.ColumnName)
|
|
Exit For
|
|
End If
|
|
If UCase(ctl.Name) = "CBBOX" + UCase(c.ColumnName) Then
|
|
If UCase(c.ColumnName) = "NRFS" Then
|
|
|
|
End If
|
|
Dim ct As MyCombobox
|
|
Dim o As Object = ctl
|
|
Try
|
|
o.SelectedValue = R(c.ColumnName)
|
|
Catch
|
|
o.selectedvalue = -1
|
|
End Try
|
|
|
|
Exit For
|
|
End If
|
|
If UCase(ctl.Name) = "DT" + UCase(c.ColumnName) Then
|
|
Dim dt As DateTimePicker
|
|
dt = ctl
|
|
dt.Value = R(c.ColumnName)
|
|
Exit For
|
|
End If
|
|
If UCase(ctl.Name) = "CHK" + UCase(c.ColumnName) Then
|
|
Dim dt As CheckBox
|
|
dt = ctl
|
|
Try
|
|
dt.Checked = R(c.ColumnName)
|
|
Exit For
|
|
Catch
|
|
dt.Checked = False
|
|
End Try
|
|
End If
|
|
Catch ex As Exception
|
|
MsgBox(ex.Message + " / " + ctl.Name + " / " + R(c.ColumnName))
|
|
End Try
|
|
|
|
Next
|
|
|
|
End Sub
|
|
|
|
#End Region
|
|
|
|
#Region "Daten speichern"
|
|
|
|
Public Sub Save_Data()
|
|
DB.Get_Tabledata("privat", " where nrprivat=" + Me.PatientNr.ToString)
|
|
Dim r As DataRow = DB.dsDaten.Tables(0).Rows(0)
|
|
|
|
Save_Data_Controls(Me, r)
|
|
r("Mutiert_am") = Now
|
|
r("mutierer") = Globals.ActUser
|
|
DB.Update_Data()
|
|
Me.HasChanges = False
|
|
End Sub
|
|
|
|
Sub Save_Data_Controls(ByVal ictl As Control, ByRef r As DataRow)
|
|
|
|
For Each ctl As Control In ictl.Controls
|
|
|
|
If ctl.Controls.Count = 0 Or (ctl.Controls.Count = 1 And Microsoft.VisualBasic.Left(UCase(ctl.Name), 5) = "CBBOX") Then
|
|
Save_Data_for_Control(ctl, r)
|
|
Else
|
|
Save_Data_Controls(ctl, r)
|
|
|
|
End If
|
|
Next
|
|
End Sub
|
|
|
|
Sub Save_Data_for_Control(ByRef ctl As Control, ByRef r As DataRow)
|
|
Dim ctlname As String
|
|
Dim colname As String
|
|
ctlname = ctl.Name
|
|
Try
|
|
For Each c As DataColumn In DB.dsDaten.Tables(0).Columns
|
|
colname = c.ColumnName
|
|
If UCase(ctl.Name) = "TXT" + UCase(c.ColumnName) Then
|
|
r(c.ColumnName) = ctl.Text
|
|
Exit For
|
|
End If
|
|
If UCase(ctl.Name) = "CBBOX" + UCase(c.ColumnName) Then
|
|
Dim ct As MyCombobox
|
|
Dim o As Object = ctl
|
|
Try
|
|
If o.selectedvalue Is System.DBNull.Value Or o.selectedvalue Is Nothing Then
|
|
r(c.ColumnName) = -1
|
|
Else
|
|
r(c.ColumnName) = o.selectedvalue
|
|
End If
|
|
Catch ex As Exception
|
|
r(c.ColumnName) = -1
|
|
End Try
|
|
Exit For
|
|
End If
|
|
If UCase(ctl.Name) = "DT" + UCase(c.ColumnName) Then
|
|
Dim dt As DateTimePicker
|
|
dt = ctl
|
|
r(c.ColumnName) = dt.Value
|
|
Exit For
|
|
End If
|
|
If UCase(ctl.Name) = "CHK" + UCase(c.ColumnName) Then
|
|
Dim dt As CheckBox
|
|
dt = ctl
|
|
r(c.ColumnName) = dt.Checked
|
|
Exit For
|
|
End If
|
|
Next
|
|
|
|
Catch ex As Exception
|
|
log.Writelog("Privatdetails: Get_Data: " + ctlname + " / " + colname + " " + ex.Message, clsLog.Logtype.ApplError)
|
|
End Try
|
|
|
|
|
|
End Sub
|
|
|
|
|
|
|
|
|
|
|
|
#End Region
|
|
|
|
|
|
Private Sub evh_PatSaved(Nr As Integer) Handles evh.PatSaved
|
|
If Nr = Me.PatientNr Then
|
|
Me.Save_Data()
|
|
End If
|
|
End Sub
|
|
End Class
|