267 lines
9.4 KiB
VB.net
267 lines
9.4 KiB
VB.net
Imports VERAG_PROG_ALLGEMEIN
|
|
|
|
Public Class ustCntlUSTV_ErstattungPosition
|
|
Public UStV_ERS As VERAG_PROG_ALLGEMEIN.cUStVErstattungPositionen = Nothing
|
|
Public UstV_AN As cUSTVAntrag
|
|
|
|
Dim sql As New VERAG_PROG_ALLGEMEIN.SQL
|
|
Dim kdnr = ""
|
|
|
|
Public Event EV_PREV()
|
|
Public Event EV_NEXT()
|
|
Public Event CHANGED(UStV_ERS)
|
|
Dim gridAktiv = False
|
|
Dim txtChanged As Boolean = False
|
|
Private Sub btnBildAuf_Click(sender As Object, e As EventArgs) Handles btnBildAuf.Click
|
|
RaiseEvent EV_PREV()
|
|
End Sub
|
|
|
|
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
|
|
RaiseEvent EV_NEXT()
|
|
End Sub
|
|
|
|
Sub reset()
|
|
txtBelegDatum._value = ""
|
|
txtBelegNr._value = ""
|
|
|
|
txtGuDatum._value = ""
|
|
txtGuNr._value = ""
|
|
|
|
txtBerufungsdatum._value = ""
|
|
txtBerufungshoehe._value = ""
|
|
txtBerurunfgrund._value = ""
|
|
|
|
txtUmrechnungskurs._value = 1
|
|
txtUSTBetrag._value = 0
|
|
txtUSTBetragEUR._value = 0
|
|
txtBemerkung.Text = ""
|
|
lblAenderungsdatum.Text = "-"
|
|
|
|
End Sub
|
|
|
|
Sub setValues(UstV_AN_ As cUSTVAntrag, Optional UStV_ERS As VERAG_PROG_ALLGEMEIN.cUStVErstattungPositionen = Nothing, Optional kdNr As Integer = -1)
|
|
|
|
UstV_AN = UstV_AN_
|
|
|
|
If UStV_ERS Is Nothing Then Exit Sub
|
|
|
|
Me.UStV_ERS = UStV_ERS
|
|
Me.kdnr = kdNr
|
|
|
|
txtBelegDatum._value = If(UStV_ERS.Belegdatum, "")
|
|
txtBelegNr._value = If(UStV_ERS.Belegnummer, "")
|
|
txtGuDatum._value = If(UStV_ERS.GutschriftsDatum, "")
|
|
txtGuNr._value = If(UStV_ERS.GutschriftsNr, "")
|
|
txtBerufungsdatum._value = If(UStV_ERS.Berufungsdatum, "")
|
|
txtBerurunfgrund._value = If(UStV_ERS.Berufungsgrund, "")
|
|
txtBerufungshoehe._value = If(UStV_ERS.Berufungshöhe, "")
|
|
|
|
lblSachbearbeiter.Text = If(UStV_ERS.UStVEr_Sachbearbeiter, "")
|
|
If UStV_ERS.UStVEr_Zeitstempel IsNot Nothing Then lblAenderungsdatum.Text = CDate(UStV_ERS.UStVEr_Zeitstempel).ToString("dd.MM.yyyy HH:mm")
|
|
|
|
txtUSTBetrag.Text = If(UStV_ERS.UStVEr_USteuerbetrag, "")
|
|
txtUmrechnungskurs.Text = If(UStV_ERS.UStVEr_Umrechnungskurs, "")
|
|
txtUSTBetragEUR.Text = If(UStV_ERS.UStVEr_USteuerbetragEUR, "")
|
|
txtBemerkung.Text = If(UStV_ERS.Bemerkung, "")
|
|
|
|
If UStV_ERS.UStVEr_daId IsNot Nothing AndAlso UStV_ERS.UStVEr_daId > 0 Then
|
|
scanSonstigesErst.INIT_daId(UStV_ERS.UStVEr_daId)
|
|
Else
|
|
scanSonstigesErst.INIT(kdNr, "MDM", "MDM_DATEN", "USTVERS_" & UStV_ERS.UStVAn_ID & "_" & UStV_ERS.UStVEr_interneNr)
|
|
End If
|
|
|
|
|
|
|
|
|
|
End Sub
|
|
|
|
Sub getValues(ByRef UStV_ERS As cUStVErstattungPositionen, ByRef save As Boolean)
|
|
|
|
If UStV_ERS Is Nothing Then
|
|
UStV_ERS = New VERAG_PROG_ALLGEMEIN.cUStVErstattungPositionen()
|
|
UStV_ERS.UStVEr_ID = UstV_AN.getMaxPosNrErst
|
|
UStV_ERS.UStVEr_interneNr = UstV_AN.getMaxinternePosNrErst
|
|
End If
|
|
|
|
UStV_ERS.UStVEr_Sachbearbeiter = VERAG_PROG_ALLGEMEIN.cAllgemein.USRKURZNAME
|
|
UStV_ERS.UStVEr_Zeitstempel = Now
|
|
UStV_ERS.UStVAn_ID = UstV_AN.UStVAn_ID
|
|
UStV_ERS.Belegnummer = cProgramFunctions.isLeerNothing(txtBelegNr.Text)
|
|
UStV_ERS.GutschriftsNr = cProgramFunctions.isLeerNothing(txtGuNr.Text)
|
|
UStV_ERS.Bemerkung = cProgramFunctions.isLeerNothing(txtBemerkung.Text)
|
|
UStV_ERS.Berufungsgrund = cProgramFunctions.isLeerNothing(txtBerurunfgrund.Text)
|
|
|
|
UStV_ERS.UStVEr_USteuerbetrag = cProgramFunctions.isLeerNothingDbl(txtUSTBetrag.Text)
|
|
|
|
UStV_ERS.UStVEr_USteuerbetragEUR = cProgramFunctions.isLeerNothingDbl(txtUSTBetragEUR.Text)
|
|
|
|
UStV_ERS.Berufungshöhe = cProgramFunctions.isLeerNothingDbl(txtBerufungshoehe.Text)
|
|
|
|
UStV_ERS.UStVEr_Umrechnungskurs = cProgramFunctions.isLeerNothingDbl(txtUmrechnungskurs.Text)
|
|
|
|
|
|
If txtBelegDatum.Text <> "" AndAlso IsDate(txtBelegDatum.Text) Then
|
|
UStV_ERS.Belegdatum = txtBelegDatum._value
|
|
Else
|
|
UStV_ERS.Belegdatum = Nothing
|
|
End If
|
|
|
|
|
|
If txtGuDatum.Text <> "" AndAlso IsDate(txtGuDatum.Text) Then
|
|
UStV_ERS.GutschriftsDatum = txtGuDatum.Text
|
|
Else
|
|
UStV_ERS.GutschriftsDatum = Nothing
|
|
End If
|
|
|
|
If txtBerufungsdatum.Text <> "" AndAlso IsDate(txtBerufungsdatum.Text) Then
|
|
UStV_ERS.Berufungsdatum = txtBerufungsdatum.Text
|
|
Else
|
|
UStV_ERS.Berufungsdatum = Nothing
|
|
End If
|
|
|
|
|
|
End Sub
|
|
|
|
Private Sub ustCntlUSTV_AntragPosition_KeyDown(sender As Object, e As PreviewKeyDownEventArgs) Handles Me.PreviewKeyDown
|
|
If e.KeyValue = Keys.PageDown Then
|
|
RaiseEvent EV_NEXT()
|
|
End If
|
|
If e.KeyValue = Keys.PageUp Then
|
|
RaiseEvent EV_PREV()
|
|
End If
|
|
End Sub
|
|
|
|
Function save()
|
|
Dim setSave As Boolean = True
|
|
getValues(UStV_ERS, setSave)
|
|
'MsgBox("TEST")
|
|
If setSave Then Return UStV_ERS.SAVE
|
|
Return False
|
|
End Function
|
|
|
|
Private Sub txtBestellung_TextChanged(sender As Object, e As EventArgs) Handles txtGuDatum.TextChanged, txtBelegDatum.TextChanged, txtBelegNr.TextChanged, txtUSTBetrag.TextChanged, txtUmrechnungskurs.TextChanged, txtUSTBetragEUR.TextChanged
|
|
|
|
If Not VERAG_PROG_ALLGEMEIN.cBerechtignunen.CHECK_BERECHTIGUNG_bool("MDM_USTVA_bearbeiten", Me.FindForm) Then Exit Sub
|
|
|
|
End Sub
|
|
|
|
Sub values_changed()
|
|
lblSachbearbeiter.Text = VERAG_PROG_ALLGEMEIN.cAllgemein.USRKURZNAME
|
|
lblAenderungsdatum.Text = Now.ToString("dd.MM.yyyy HH:mm")
|
|
' If e.Column.ColumnName = "Sachbearbeiter" Or e.Column.ColumnName = "Änderungsdatum" Then Exit Sub
|
|
If save() Then RaiseEvent CHANGED(UStV_ERS.UStVEr_ID)
|
|
End Sub
|
|
|
|
|
|
Private Sub txtUSTBetrag_PreviewKeyDown(sender As Object, e As PreviewKeyDownEventArgs) Handles txtUSTBetrag.PreviewKeyDown, txtUSTBetragEUR.PreviewKeyDown, txtBelegDatum.PreviewKeyDown, txtBelegNr.PreviewKeyDown, txtBemerkung.PreviewKeyDown, txtBerufungsdatum.PreviewKeyDown, txtBerufungshoehe.PreviewKeyDown, txtGuNr.PreviewKeyDown
|
|
If Not VERAG_PROG_ALLGEMEIN.cBerechtignunen.CHECK_BERECHTIGUNG_bool("MDM_USTVAErstattung_bearbeiten", Me.FindForm) Then Exit Sub
|
|
|
|
If Me.FindForm IsNot Nothing Then
|
|
|
|
' Eingabeprüfung
|
|
If e.KeyValue = 9 Then
|
|
|
|
lblWarning.Text = ""
|
|
|
|
|
|
If sender Is txtUSTBetrag Then
|
|
|
|
If IsNumeric(txtUSTBetrag.Text) AndAlso IsNumeric(txtUmrechnungskurs.Text) Then
|
|
txtUSTBetragEUR.Text = Math.Floor((txtUSTBetrag.Text / txtUmrechnungskurs.Text) * 100 + 0.5) / 100
|
|
txtChanged = True
|
|
End If
|
|
|
|
ElseIf sender Is txtUSTBetragEUR Then
|
|
|
|
If IsNumeric(txtUSTBetragEUR.Text) AndAlso IsNumeric(txtUSTBetrag.Text) Then
|
|
|
|
If txtUSTBetrag.Text = 0 AndAlso txtUSTBetragEUR.Text = 0 Then
|
|
txtUmrechnungskurs.Text = 1
|
|
Else
|
|
txtUmrechnungskurs.Text = txtUSTBetrag.Text / txtUSTBetragEUR.Text
|
|
End If
|
|
|
|
|
|
txtChanged = True
|
|
End If
|
|
|
|
ElseIf sender Is txtBelegDatum Then
|
|
|
|
If txtBelegDatum.Text <> "" Then
|
|
txtBelegDatum.Text = txtBelegDatum.Text.Replace("-", ".")
|
|
End If
|
|
txtChanged = True
|
|
|
|
ElseIf sender Is txtBerufungsdatum Then
|
|
|
|
If txtBerufungsdatum.Text <> "" AndAlso IsDate(txtBerufungsdatum.Text) Then
|
|
txtBerufungsdatum.Text = txtBerufungsdatum.Text.Replace("-", ".")
|
|
End If
|
|
txtChanged = True
|
|
|
|
ElseIf sender Is txtGuDatum Then
|
|
|
|
If txtGuDatum.Text <> "" Then
|
|
txtGuDatum.Text = txtGuDatum.Text.Replace("-", ".")
|
|
End If
|
|
txtChanged = True
|
|
|
|
|
|
ElseIf sender Is txtBemerkung Then
|
|
|
|
txtBemerkung.Text = txtBemerkung.Text
|
|
|
|
txtChanged = True
|
|
|
|
ElseIf sender Is txtBelegNr Then
|
|
|
|
txtBelegNr.Text = txtBelegNr.Text
|
|
|
|
txtChanged = True
|
|
|
|
ElseIf sender Is txtGuNr Then
|
|
|
|
txtGuNr.Text = txtGuNr.Text
|
|
|
|
txtChanged = True
|
|
|
|
|
|
ElseIf sender Is txtBerufungshoehe Then
|
|
|
|
If txtBerufungshoehe.Text IsNot Nothing AndAlso IsNumeric(txtBerufungshoehe.Text) Then
|
|
txtBerufungshoehe.Text = CDbl(txtBerufungshoehe.Text)
|
|
End If
|
|
|
|
txtChanged = True
|
|
|
|
End If
|
|
|
|
End If
|
|
|
|
If txtChanged Then
|
|
values_changed()
|
|
txtChanged = False
|
|
End If
|
|
|
|
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Private Sub scanSonstiges_FileAdded(id As String, path As String, name As String) Handles scanSonstigesErst.FileAdded
|
|
getValues(UStV_ERS, True)
|
|
UStV_ERS.UStVEr_daId = id
|
|
If UStV_ERS.SAVE() Then
|
|
scanSonstigesErst.INIT_daId(UStV_ERS.UStVEr_daId)
|
|
RaiseEvent CHANGED(UStV_ERS.UStVEr_ID)
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub scanSonstiges_FileDeleted() Handles scanSonstigesErst.FileDeleted
|
|
getValues(UStV_ERS, True)
|
|
UStV_ERS.UStVEr_daId = Nothing
|
|
If UStV_ERS.SAVE() Then RaiseEvent CHANGED(UStV_ERS.UStVEr_ID)
|
|
End Sub
|
|
|
|
End Class
|