258 lines
8.1 KiB
VB.net
258 lines
8.1 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 = ""
|
|
|
|
|
|
|
|
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, "")
|
|
|
|
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_ERS.getMaxPosNr()
|
|
End If
|
|
|
|
UStV_ERS.UStVEr_Sachbearbeiter = VERAG_PROG_ALLGEMEIN.cAllgemein.USRKURZNAME
|
|
UStV_ERS.UStVEr_Zeitstempel = Now
|
|
UStV_ERS.UStVAn_ID = UstV_AN.UStVAn_ID
|
|
|
|
|
|
If txtBelegNr.Text <> "" Then
|
|
UStV_ERS.Belegnummer = txtBelegNr.Text
|
|
Else
|
|
save = False
|
|
End If
|
|
|
|
If txtBelegDatum.Text <> "" AndAlso IsDate(txtBelegDatum.Text) Then
|
|
UStV_ERS.Belegdatum = txtBelegDatum._value
|
|
Else
|
|
save = False
|
|
End If
|
|
|
|
If txtUSTBetrag.Text <> "" Then
|
|
UStV_ERS.UStVEr_USteuerbetrag = txtUSTBetrag.Text.Replace(",", ".")
|
|
Else
|
|
save = False
|
|
End If
|
|
|
|
If txtUSTBetragEUR.Text <> "" Then
|
|
UStV_ERS.UStVEr_USteuerbetragEUR = txtUSTBetragEUR.Text.Replace(",", ".")
|
|
Else
|
|
save = False
|
|
End If
|
|
|
|
If txtGuDatum.Text <> "" Then
|
|
UStV_ERS.GutschriftsDatum = txtGuDatum.Text
|
|
End If
|
|
|
|
If Not txtUmrechnungskurs.Text = "" Then
|
|
If txtUmrechnungskurs.Text <> "" Then
|
|
UStV_ERS.UStVEr_Umrechnungskurs = txtUmrechnungskurs.Text.Replace(",", ".")
|
|
End If
|
|
Else
|
|
save = False
|
|
End If
|
|
|
|
If txtGuDatum.Text <> "" Then
|
|
UStV_ERS.GutschriftsDatum = txtGuDatum.Text
|
|
End If
|
|
|
|
If txtGuNr.Text <> "" Then
|
|
UStV_ERS.GutschriftsNr = txtGuNr.Text
|
|
End If
|
|
|
|
|
|
|
|
If txtBemerkung.Text <> "" Then
|
|
UStV_ERS.Bemerkung = txtBemerkung.Text
|
|
End If
|
|
|
|
If txtBerufungsdatum.Text <> "" Then
|
|
UStV_ERS.Berufungsdatum = txtBerufungsdatum.Text
|
|
End If
|
|
|
|
|
|
If txtBerufungshoehe.Text <> "" Then
|
|
UStV_ERS.Berufungshöhe = txtBerufungshoehe.Text
|
|
End If
|
|
|
|
If txtBerurunfgrund.Text <> "" Then
|
|
UStV_ERS.Berufungsgrund = txtBerurunfgrund.Text
|
|
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, txtUmrechnungskurs.PreviewKeyDown
|
|
If Not VERAG_PROG_ALLGEMEIN.cBerechtignunen.CHECK_BERECHTIGUNG_bool("MDM_USTVA_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 Or sender Is txtUSTBetragEUR Or sender Is txtUmrechnungskurs Then
|
|
|
|
If txtUSTBetrag.Text = "" Then
|
|
lblWarning.Text = "Bitte Umsatzsteuerbetrag eingeben."
|
|
Exit Sub
|
|
End If
|
|
|
|
End If
|
|
|
|
|
|
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
|
|
|
|
'so herum nicht umrechnen!!!!
|
|
'If IsNumeric(txtUSTBetragEUR._value) AndAlso IsNumeric(txtUmrechnungskurs._value) Then
|
|
' txtUSTBetrag.Text = Math.Floor((txtUSTBetragEUR._value * txtUmrechnungskurs._value) * 100 + 0.5) / 100
|
|
' 'values_changed()
|
|
'End If
|
|
|
|
|
|
If IsNumeric(txtUSTBetragEUR.Text) AndAlso IsNumeric(txtUSTBetrag.Text) Then
|
|
|
|
Dim zahl1 = txtUSTBetragEUR.Text / txtUSTBetrag.Text
|
|
|
|
txtUmrechnungskurs.Text = zahl1
|
|
txtChanged = True
|
|
End If
|
|
|
|
ElseIf sender Is txtUmrechnungskurs Then
|
|
|
|
|
|
If IsNumeric(txtUSTBetrag.Text) AndAlso IsNumeric(txtUmrechnungskurs._value) Then
|
|
txtUSTBetragEUR.Text = Math.Floor((txtUSTBetrag.Text / txtUmrechnungskurs.Text) * 100 + 0.5) / 100
|
|
txtChanged = True
|
|
End If
|
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
End If
|
|
|
|
If txtChanged Then
|
|
values_changed()
|
|
txtChanged = False
|
|
End If
|
|
|
|
|
|
End If
|
|
|
|
End Sub
|
|
|
|
|
|
End Class
|