Handlingsabsrechnung, Spednich, etc.
This commit is contained in:
@@ -5,12 +5,14 @@ Public Class ustCntlUSTV_AntragPosition
|
||||
Public UStV_Leist As VERAG_PROG_ALLGEMEIN.cUStVLeistender = Nothing
|
||||
Dim sql As New VERAG_PROG_ALLGEMEIN.SQL
|
||||
Public Antrag_LandKz = ""
|
||||
Dim kdnr = ""
|
||||
Public Event EV_PREV()
|
||||
Public Event EV_NEXT()
|
||||
Public Event CHANGED(UStVPo_ID)
|
||||
Dim gridAktiv = False
|
||||
Dim txtChanged As Boolean = False
|
||||
|
||||
Private _kundenNr As Integer
|
||||
Private _gridAktiv As Boolean
|
||||
Private _txtChanged As Boolean
|
||||
|
||||
Dim API As cATEZ_NCTS_IN
|
||||
Private Sub btnBildAuf_Click(sender As Object, e As EventArgs) Handles btnBildAuf.Click
|
||||
RaiseEvent EV_PREV()
|
||||
@@ -46,15 +48,17 @@ Public Class ustCntlUSTV_AntragPosition
|
||||
txtLand.Text = ""
|
||||
txtUIDNr.Text = ""
|
||||
|
||||
gridAktiv = True
|
||||
_gridAktiv = True
|
||||
|
||||
Dim filter As String = "UstV_aktiv = 1"
|
||||
If Antrag_LandKz <> "" AndAlso cbxAntragsfilter.Checked Then
|
||||
filter &= " and left(UstV_Leistender_UstNr,2)='" & Antrag_LandKz & "'"
|
||||
sbLeistender.initSearchBox(Me.FindForm, "[UStV_LeistenderId],[UStV_Leistender], ([UStV_Leistender]) as Leistender,[UstV_Leistender_PLZ] as PLZ, ([UstV_Leistender_Strasse] + ' ' +[UstV_Leistender_StrasseNr]) as Strasse, [UstV_Leistender_Stadt] as Stadt FROM [tblUStVLeistender]", {"UStV_Leistender", "UstV_Leistender_UstNr"}, filter, "UStV_Leistender", "UStV_LeistenderId", "Leistender", "FMZOLL",, 400, 200, {"UStV_Leistender", "UStV_LeistenderId"})
|
||||
Else
|
||||
sbLeistender.initSearchBox(Me.FindForm, "[UStV_LeistenderId],[UStV_Leistender], ([UStV_Leistender]) as Leistender,[UstV_Leistender_PLZ] as PLZ, ([UstV_Leistender_Strasse] + ' ' +[UstV_Leistender_StrasseNr]) as Strasse, [UstV_Leistender_Stadt] as Stadt FROM [tblUStVLeistender]", {"UStV_Leistender", "UstV_Leistender_UstNr"}, filter, "UStV_Leistender", "UStV_LeistenderId", "Leistender", "FMZOLL",, 400, 200, {"UStV_Leistender", "UStV_LeistenderId"})
|
||||
End If
|
||||
InitLeistenderSearchBox()
|
||||
|
||||
'Dim filter As String = "UstV_aktiv = 1"
|
||||
'If Antrag_LandKz <> "" AndAlso cbxAntragsfilter.Checked Then
|
||||
' filter &= " and left(UstV_Leistender_UstNr,2)='" & Antrag_LandKz & "'"
|
||||
' sbLeistender.initSearchBox(Me.FindForm, "[UStV_LeistenderId],[UStV_Leistender], ([UStV_Leistender]) as Leistender,[UstV_Leistender_PLZ] as PLZ, ([UstV_Leistender_Strasse] + ' ' +[UstV_Leistender_StrasseNr]) as Strasse, [UstV_Leistender_Stadt] as Stadt FROM [tblUStVLeistender]", {"UStV_Leistender", "UstV_Leistender_UstNr"}, filter, "UStV_Leistender", "UStV_LeistenderId", "Leistender", "FMZOLL",, 400, 200, {"UStV_Leistender", "UStV_LeistenderId"})
|
||||
'Else
|
||||
' sbLeistender.initSearchBox(Me.FindForm, "[UStV_LeistenderId],[UStV_Leistender], ([UStV_Leistender]) as Leistender,[UstV_Leistender_PLZ] as PLZ, ([UstV_Leistender_Strasse] + ' ' +[UstV_Leistender_StrasseNr]) as Strasse, [UstV_Leistender_Stadt] as Stadt FROM [tblUStVLeistender]", {"UStV_Leistender", "UstV_Leistender_UstNr"}, filter, "UStV_Leistender", "UStV_LeistenderId", "Leistender", "FMZOLL",, 400, 200, {"UStV_Leistender", "UStV_LeistenderId"})
|
||||
'End If
|
||||
|
||||
End Sub
|
||||
|
||||
@@ -62,26 +66,35 @@ Public Class ustCntlUSTV_AntragPosition
|
||||
|
||||
initSchnittstellenNr()
|
||||
|
||||
gridAktiv = False
|
||||
_gridAktiv = False
|
||||
btnLeistenderSave.Visible = False
|
||||
Me.Antrag_LandKz = Antrag_LandKz
|
||||
Me.UStV_POS = UStV_POS
|
||||
Me.kdnr = kdnr
|
||||
Me._kundenNr = kdnr
|
||||
cbxAPI.Checked = If(UStV_POS.UStVPo_Schnittstelle, False)
|
||||
cboSchnittstellennr.changeItem(If(UStV_POS.UStVPo_SchnittstellenNr, ""))
|
||||
txtRgDatum._value = If(UStV_POS.UStVPo_ReDat, "")
|
||||
txtRgNr._value = If(UStV_POS.UStVPo_ReNr, "")
|
||||
lblSachbearbeiter.Text = If(UStV_POS.UStVPo_Sachbearbeiter, "")
|
||||
|
||||
|
||||
If UStV_POS.UStVPo_Zeitstempel IsNot Nothing Then lblAenderungsdatum.Text = CDate(UStV_POS.UStVPo_Zeitstempel).ToString("dd.MM.yyyy HH:mm")
|
||||
cboLeistungsgeber.Text = If(UStV_POS.UStVPo_Leistender, "")
|
||||
txtLeistungsbezeichnung.Text = If(UStV_POS.UStVPo_Leistungsbezeichnung, "")
|
||||
txtUSTBetrag.Text = If(UStV_POS.UStVPo_USteuerbetrag, "")
|
||||
txtUmrechnungskurs.Text = If(UStV_POS.UStVPo_Umrechnungskurs, "")
|
||||
txtUSTBetragEUR.Text = If(UStV_POS.UStVPo_USteuerbetragEUR, "")
|
||||
txtNettobetrag.Text = If(UStV_POS.UStVPo_Nettobetrag, "")
|
||||
txtNettobetragEUR.Text = If(UStV_POS.UStVPo_NettobetragEUR, "")
|
||||
|
||||
|
||||
txtRgDatum._value = ValueOrEmpty(UStV_POS.UStVPo_ReDat)
|
||||
txtRgNr._value = ValueOrEmpty(UStV_POS.UStVPo_ReNr)
|
||||
txtLeistungsbezeichnung.Text = ValueOrEmpty(UStV_POS.UStVPo_Leistungsbezeichnung)
|
||||
txtUSTBetrag.Text = ValueOrEmpty(UStV_POS.UStVPo_USteuerbetrag)
|
||||
txtUmrechnungskurs.Text = ValueOrEmpty(UStV_POS.UStVPo_Umrechnungskurs)
|
||||
txtUSTBetragEUR.Text = ValueOrEmpty(UStV_POS.UStVPo_USteuerbetragEUR)
|
||||
txtNettobetrag.Text = ValueOrEmpty(UStV_POS.UStVPo_Nettobetrag)
|
||||
txtNettobetragEUR.Text = ValueOrEmpty(UStV_POS.UStVPo_NettobetragEUR)
|
||||
lblSachbearbeiter.Text = ValueOrEmpty(UStV_POS.UStVPo_Sachbearbeiter)
|
||||
|
||||
sbLeistender.Text = UStV_Leitender.UStV_Leistender
|
||||
If IsNumeric(UStV_Leitender.UStV_LeistenderId) Then
|
||||
sbLeistender._value = UStV_Leitender.UStV_LeistenderId
|
||||
End If
|
||||
|
||||
sbLeistender_VALUE_CHANGED()
|
||||
loadChangedDSToPanel(UStV_Leitender, True)
|
||||
API = atez_api
|
||||
|
||||
@@ -131,17 +144,9 @@ Public Class ustCntlUSTV_AntragPosition
|
||||
scanUSTVFABest.INIT(kdnr, "KUNDENDATEN", "FA_Bestaetigungen")
|
||||
scanUSTVVollmachten.INIT(kdnr, "KUNDENDATEN", "USTV_Vollmachten")
|
||||
|
||||
Dim filter As String = "UstV_aktiv = 1"
|
||||
If Antrag_LandKz <> "" AndAlso cbxAntragsfilter.Checked Then
|
||||
filter &= " and left(UstV_Leistender_UstNr,2)='" & Antrag_LandKz & "'"
|
||||
sbLeistender.initSearchBox(Me.FindForm, "[UStV_LeistenderId],[UStV_Leistender], ([UStV_Leistender] ) as Leistender,[UstV_Leistender_PLZ] as PLZ, ([UstV_Leistender_Strasse] + ' ' +[UstV_Leistender_StrasseNr]) as Strasse, [UstV_Leistender_Stadt] as Stadt FROM [tblUStVLeistender]", {"UStV_Leistender", "UstV_Leistender_UstNr"}, filter, "UStV_Leistender", "UStV_LeistenderId", "Leistender", "FMZOLL",, 400, 200, {"UStV_Leistender", "UStV_LeistenderId"})
|
||||
Else
|
||||
sbLeistender.initSearchBox(Me.FindForm, "[UStV_LeistenderId],[UStV_Leistender], ([UStV_Leistender]) as Leistender,[UstV_Leistender_PLZ] as PLZ, ([UstV_Leistender_Strasse] + ' ' +[UstV_Leistender_StrasseNr]) as Strasse, [UstV_Leistender_Stadt] as Stadt FROM [tblUStVLeistender]", {"UStV_Leistender", "UstV_Leistender_UstNr"}, filter, "UStV_Leistender", "UStV_LeistenderId", "Leistender", "FMZOLL",, 400, 200, {"UStV_Leistender", "UStV_LeistenderId"})
|
||||
End If
|
||||
InitLeistenderSearchBox()
|
||||
|
||||
'sbLeistender.initSearchBox(Me.FindForm, "[UStV_LeistenderId],[UStV_Leistender], ([UStV_Leistender] + ' ' + isnull([UstV_Leistender_UstNr],'')) as Leistender,[UstV_Leistender_PLZ] as PLZ, ([UstV_Leistender_Strasse] + ' ' +[UstV_Leistender_StrasseNr]) as Strasse, [UstV_Leistender_Stadt] as Stadt FROM [tblUStVLeistender]", {"UStV_Leistender", "UstV_Leistender_UstNr"}, "UstV_aktiv = 1", "UStV_Leistender", "UStV_LeistenderId", "Leistender", "FMZOLL",, 400, 200, {"UStV_Leistender", "UStV_LeistenderId"})
|
||||
|
||||
gridAktiv = True
|
||||
_gridAktiv = True
|
||||
End Sub
|
||||
|
||||
Sub getValues(ByRef UStV_POS As cUStVPositionen, ByRef save As Boolean)
|
||||
@@ -163,27 +168,45 @@ Public Class ustCntlUSTV_AntragPosition
|
||||
lblWarning.Text = "Rechnungsdatum muss ausgefüllt werden."
|
||||
save = False
|
||||
End If
|
||||
If txtUSTBetrag.Text <> "" Then
|
||||
UStV_POS.UStVPo_USteuerbetrag = txtUSTBetrag.Text.Replace(",", ".")
|
||||
Else
|
||||
lblWarning.Text = "UST-Betrag muss ausgefüllt werden."
|
||||
|
||||
|
||||
|
||||
Dim ustBetrag As Decimal
|
||||
|
||||
If Not TryGetDecimal(txtUSTBetrag.Text, ustBetrag) Then
|
||||
lblWarning.Text = "UST-Betrag ist ungültig."
|
||||
save = False
|
||||
End If
|
||||
|
||||
If txtUSTBetragEUR.Text <> "" Then
|
||||
UStV_POS.UStVPo_USteuerbetragEUR = txtUSTBetragEUR.Text.Replace(",", ".")
|
||||
Else
|
||||
UStV_POS.UStVPo_USteuerbetrag = ustBetrag
|
||||
End If
|
||||
|
||||
|
||||
Dim ustBetragEUR As Decimal
|
||||
|
||||
If Not TryGetDecimal(txtUSTBetragEUR.Text, ustBetragEUR) Then
|
||||
lblWarning.Text = "UST-Betrag ist ungültig."
|
||||
save = False
|
||||
Else
|
||||
UStV_POS.UStVPo_USteuerbetragEUR = ustBetragEUR
|
||||
End If
|
||||
|
||||
If txtNettobetrag.Text <> "" Then
|
||||
UStV_POS.UStVPo_Nettobetrag = txtNettobetrag.Text.Replace(",", ".")
|
||||
|
||||
|
||||
Dim Nettobetrag As Decimal
|
||||
|
||||
If TryGetDecimal(txtNettobetrag.Text, Nettobetrag) Then
|
||||
UStV_POS.UStVPo_Nettobetrag = Nettobetrag
|
||||
End If
|
||||
|
||||
If txtNettobetragEUR.Text <> "" Then
|
||||
UStV_POS.UStVPo_NettobetragEUR = txtNettobetragEUR.Text.Replace(",", ".")
|
||||
Dim NettobetragEUR As Decimal
|
||||
|
||||
If TryGetDecimal(txtNettobetragEUR.Text, NettobetragEUR) Then
|
||||
UStV_POS.UStVPo_NettobetragEUR = NettobetragEUR
|
||||
End If
|
||||
|
||||
|
||||
|
||||
|
||||
If txtLeistungsbezeichnung.Text <> "" Then
|
||||
UStV_POS.UStVPo_Leistungsbezeichnung = txtLeistungsbezeichnung.Text
|
||||
Else
|
||||
@@ -192,7 +215,12 @@ Public Class ustCntlUSTV_AntragPosition
|
||||
End If
|
||||
If Not txtUmrechnungskurs.Text = "" Then
|
||||
If txtUmrechnungskurs.Text <> "" Then
|
||||
UStV_POS.UStVPo_Umrechnungskurs = txtUmrechnungskurs.Text.Replace(",", ".")
|
||||
|
||||
Dim Umrechnungskurs As Decimal
|
||||
If TryGetDecimal(txtUmrechnungskurs.Text, Umrechnungskurs) Then
|
||||
UStV_POS.UStVPo_Umrechnungskurs = Umrechnungskurs
|
||||
End If
|
||||
|
||||
End If
|
||||
Else
|
||||
lblWarning.Text = "Umrechnungskurs muss ausgefüllt werden."
|
||||
@@ -214,14 +242,25 @@ Public Class ustCntlUSTV_AntragPosition
|
||||
End If
|
||||
|
||||
UStV_POS.UStVPo_Schnittstelle = cbxAPI.Checked
|
||||
|
||||
UStV_POS.UStVPo_SchnittstellenNr = IIf(cboSchnittstellennr.SelectedItem IsNot Nothing, cboSchnittstellennr._value, -1)
|
||||
|
||||
UStV_POS.UStVPo_SchnittstellenNr = If(cboSchnittstellennr.SelectedItem IsNot Nothing, cboSchnittstellennr._value, -1)
|
||||
UStV_POS.UStVPo_Sachbearbeiter = VERAG_PROG_ALLGEMEIN.cAllgemein.USRKURZNAME
|
||||
UStV_POS.UStVPo_Zeitstempel = Now
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub InitLeistenderSearchBox()
|
||||
|
||||
Dim filter As String = "UstV_aktiv = 1"
|
||||
|
||||
If cbxAntragsfilter.Checked AndAlso Not String.IsNullOrWhiteSpace(Antrag_LandKz) Then
|
||||
filter &= " AND LEFT(UstV_Leistender_UstNr, 2) = '" &
|
||||
Antrag_LandKz.Replace("'", "''") & "'"
|
||||
End If
|
||||
|
||||
sbLeistender.initSearchBox(Me.FindForm, "[UStV_LeistenderId],[UStV_Leistender],[UStV_Leistender] AS Leistender,[UstV_Leistender_PLZ] AS PLZ,([UstV_Leistender_Strasse] + ' ' + [UstV_Leistender_StrasseNr]) AS Strasse,[UstV_Leistender_Stadt] AS Stadt FROM [tblUStVLeistender]", {"UStV_Leistender", "UstV_Leistender_UstNr"}, filter, "UStV_Leistender", "UStV_LeistenderId", "Leistender", "FMZOLL",, 400, 200, {"UStV_Leistender", "UStV_LeistenderId"})
|
||||
|
||||
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()
|
||||
@@ -239,29 +278,59 @@ Public Class ustCntlUSTV_AntragPosition
|
||||
Return False
|
||||
End Function
|
||||
|
||||
Private Sub txtBestellung_TextChanged(sender As Object, e As EventArgs) Handles txtLeistungsbezeichnung.TextChanged, txtRgDatum.TextChanged, txtRgNr.TextChanged, txtUSTBetrag.TextChanged, txtUmrechnungskurs.TextChanged, txtUSTBetragEUR.TextChanged
|
||||
|
||||
If Not VERAG_PROG_ALLGEMEIN.cBerechtignunen.CHECK_BERECHTIGUNG_bool("MDM_USTVA_bearbeiten", Me.FindForm) Then Exit Sub
|
||||
|
||||
If gridAktiv And Me.FindForm IsNot Nothing Then
|
||||
|
||||
'If sender Is txtLieferung Then
|
||||
' If Not PROG.checkSDLNrPartnerKdNr(kdNr, SDLNr) Then MsgBox("Bitte geben Sie die Partner-Kundennummer im Kundenblatt oder im FM-ZOLL ein!")
|
||||
'End If
|
||||
|
||||
If sender Is cboLeistungsgeber AndAlso cboLeistungsgeber.SelectedItem <> "" Then
|
||||
'UStV_POS.UStVPo_Leistender = cboLeistungsgeber.SelectedItem
|
||||
'values_changed()
|
||||
|
||||
Else
|
||||
'txtChanged = True
|
||||
End If
|
||||
Private Shared Function ValueOrEmpty(value As Object) As String
|
||||
If value Is Nothing OrElse IsDBNull(value) Then
|
||||
Return String.Empty
|
||||
End If
|
||||
|
||||
Return Convert.ToString(value)
|
||||
End Function
|
||||
|
||||
Private Function RoundCurrency(value As Decimal) As Decimal
|
||||
|
||||
Return Decimal.Round(value, 2, MidpointRounding.AwayFromZero)
|
||||
End Function
|
||||
|
||||
Private Function TryGetDecimal(text As String, ByRef value As Decimal) As Boolean
|
||||
|
||||
text = text.Trim()
|
||||
|
||||
If text = "" Then
|
||||
Return False
|
||||
End If
|
||||
|
||||
Return Decimal.TryParse(
|
||||
text,
|
||||
Globalization.NumberStyles.Number,
|
||||
Globalization.CultureInfo.CurrentCulture,
|
||||
value
|
||||
)
|
||||
|
||||
End Function
|
||||
|
||||
'Private Sub txtBestellung_TextChanged(sender As Object, e As EventArgs) Handles txtLeistungsbezeichnung.TextChanged, txtRgDatum.TextChanged, txtRgNr.TextChanged, txtUSTBetrag.TextChanged, txtUmrechnungskurs.TextChanged, txtUSTBetragEUR.TextChanged
|
||||
|
||||
' If Not VERAG_PROG_ALLGEMEIN.cBerechtignunen.CHECK_BERECHTIGUNG_bool("MDM_USTVA_bearbeiten", Me.FindForm) Then Exit Sub
|
||||
|
||||
' If _gridAktiv And Me.FindForm IsNot Nothing Then
|
||||
|
||||
' 'If sender Is txtLieferung Then
|
||||
' ' If Not PROG.checkSDLNrPartnerKdNr(kdNr, SDLNr) Then MsgBox("Bitte geben Sie die Partner-Kundennummer im Kundenblatt oder im FM-ZOLL ein!")
|
||||
' 'End If
|
||||
|
||||
' If sender Is cboLeistungsgeber AndAlso cboLeistungsgeber.SelectedItem <> "" Then
|
||||
' 'UStV_POS.UStVPo_Leistender = cboLeistungsgeber.SelectedItem
|
||||
' 'values_changed()
|
||||
|
||||
' Else
|
||||
' 'txtChanged = True
|
||||
' End If
|
||||
' End If
|
||||
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
'End Sub
|
||||
|
||||
Sub values_changed()
|
||||
lblSachbearbeiter.Text = VERAG_PROG_ALLGEMEIN.cAllgemein.USRKURZNAME
|
||||
@@ -307,25 +376,9 @@ Public Class ustCntlUSTV_AntragPosition
|
||||
|
||||
End If
|
||||
|
||||
If Not initial Then
|
||||
'Listener für Änderungen im Detail-Panel
|
||||
If Not adressLoadedByLeistender Then
|
||||
For Each c As Control In pnlAdresse.Controls
|
||||
|
||||
If TypeOf (c) Is TextBox Then
|
||||
AddHandler CType(c, TextBox).TextChanged, AddressOf SomethingChanged
|
||||
End If
|
||||
If TypeOf (c) Is MyComboBox Then
|
||||
AddHandler CType(c, MyComboBox).TextChanged, AddressOf SomethingChanged
|
||||
End If
|
||||
|
||||
|
||||
Next
|
||||
Else
|
||||
btnLeistenderSave.Visible = False
|
||||
End If
|
||||
Else
|
||||
SetAddressChangeHandlers(Not initial AndAlso Not adressLoadedByLeistender)
|
||||
|
||||
If initial OrElse adressLoadedByLeistender Then
|
||||
btnLeistenderSave.Visible = False
|
||||
End If
|
||||
|
||||
@@ -410,10 +463,6 @@ Public Class ustCntlUSTV_AntragPosition
|
||||
End If
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub cboLeistungsgeber_Enter(sender As Object, e As EventArgs) Handles cboLeistungsgeber.Enter
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub cboLeistungsgeber_DropDown(sender As Object, e As EventArgs) Handles cboLeistungsgeber.DropDown
|
||||
@@ -463,179 +512,472 @@ Public Class ustCntlUSTV_AntragPosition
|
||||
End Sub
|
||||
|
||||
Private Sub txtUSTBetrag_PreviewKeyDown(sender As Object, e As PreviewKeyDownEventArgs) Handles txtUSTBetrag.PreviewKeyDown, txtUSTBetragEUR.PreviewKeyDown, txtRgDatum.PreviewKeyDown, txtRgNr.PreviewKeyDown, txtUmrechnungskurs.PreviewKeyDown, sbLeistender.PreviewKeyDown, txtLeistungsbezeichnung.PreviewKeyDown
|
||||
If Not VERAG_PROG_ALLGEMEIN.cBerechtignunen.CHECK_BERECHTIGUNG_bool("MDM_USTVA_bearbeiten", Me.FindForm) Then Exit Sub
|
||||
|
||||
If gridAktiv And Me.FindForm IsNot Nothing Then
|
||||
If e.KeyValue <> Keys.Tab Then Return
|
||||
If Not CanEdit() Then Return
|
||||
If Not _gridAktiv OrElse Me.FindForm Is Nothing Then Return
|
||||
|
||||
' Eingabeprüfung
|
||||
If e.KeyValue = 9 Then
|
||||
lblWarning.Text = ""
|
||||
|
||||
lblWarning.Text = ""
|
||||
If sender Is txtUSTBetrag Or sender Is txtUSTBetragEUR Or sender Is txtUmrechnungskurs Then
|
||||
Select Case True
|
||||
|
||||
If txtUSTBetrag.Text = "" Then
|
||||
lblWarning.Text = "Bitte Umsatzsteuerbetrag eingeben."
|
||||
Exit Sub
|
||||
End If
|
||||
Case sender Is txtUSTBetrag
|
||||
HandleVatAmountChanged()
|
||||
|
||||
End If
|
||||
Case sender Is txtUSTBetragEUR
|
||||
HandleVatAmountEurChanged()
|
||||
|
||||
Case sender Is txtUmrechnungskurs
|
||||
HandleExchangeRateChanged()
|
||||
|
||||
Case sender Is txtRgDatum
|
||||
HandleInvoiceDateChanged()
|
||||
|
||||
Case sender Is txtLeistungsbezeichnung
|
||||
HandleServiceDescriptionChanged()
|
||||
|
||||
Case sender Is sbLeistender
|
||||
HandleSupplierChanged()
|
||||
|
||||
End Select
|
||||
|
||||
SaveIfChanged()
|
||||
|
||||
'If Not VERAG_PROG_ALLGEMEIN.cBerechtignunen.CHECK_BERECHTIGUNG_bool("MDM_USTVA_bearbeiten", Me.FindForm) Then Exit Sub
|
||||
|
||||
'If _gridAktiv And 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
|
||||
' If sender Is txtUSTBetrag Then
|
||||
' If IsNumeric(txtUSTBetrag.Text) AndAlso IsNumeric(txtUmrechnungskurs.Text) Then
|
||||
|
||||
If CDbl(UStV_POS.UStVPo_USteuerbetrag) <> CDbl(txtUSTBetrag.Text) OrElse UStV_POS.UStVPo_USteuerbetrag Is Nothing Then
|
||||
'Umrechnung bei Währung <> EUR im Antrag!
|
||||
' If UStV_POS.UStVPo_USteuerbetrag Is Nothing OrElse CDbl(UStV_POS.UStVPo_USteuerbetrag) <> CDbl(txtUSTBetrag.Text) Then
|
||||
' 'Umrechnung bei Währung <> EUR im Antrag!
|
||||
|
||||
Dim antr As New cUSTVAntrag(UStV_POS.UStVAn_ID)
|
||||
' Dim antr As New cUSTVAntrag(UStV_POS.UStVAn_ID)
|
||||
|
||||
If antr.UStVAn_Währungscode <> "EUR" AndAlso (IsDate(UStV_POS.UStVPo_ReDat) OrElse (txtRgDatum.Text <> "" AndAlso IsDate(txtRgDatum.Text))) Then
|
||||
If txtUmrechnungskurs.Text = 1 Or txtUmrechnungskurs.Text = "" Then
|
||||
Dim kurs As New cEZB_Waehrungskurse(antr.UStVAn_Währungscode)
|
||||
' If antr.UStVAn_Währungscode <> "EUR" AndAlso (IsDate(UStV_POS.UStVPo_ReDat) OrElse (txtRgDatum.Text <> "" AndAlso IsDate(txtRgDatum.Text))) Then
|
||||
' If txtUmrechnungskurs.Text = 1 Or txtUmrechnungskurs.Text = "" Then
|
||||
' Dim kurs As New cEZB_Waehrungskurse(antr.UStVAn_Währungscode)
|
||||
|
||||
If IsDate(UStV_POS.UStVPo_ReDat) Then
|
||||
txtUmrechnungskurs.Text = kurs.GET_KURS(antr.UStVAn_Währungscode, CDate(UStV_POS.UStVPo_ReDat))
|
||||
ElseIf IsDate(txtRgDatum.Text) Then
|
||||
txtUmrechnungskurs.Text = kurs.GET_KURS(antr.UStVAn_Währungscode, CDate(txtRgDatum.Text))
|
||||
Else
|
||||
txtUmrechnungskurs.Text = kurs.ezb_kurs
|
||||
End If
|
||||
' If IsDate(UStV_POS.UStVPo_ReDat) Then
|
||||
' txtUmrechnungskurs.Text = kurs.GET_KURS(antr.UStVAn_Währungscode, CDate(UStV_POS.UStVPo_ReDat))
|
||||
' ElseIf IsDate(txtRgDatum.Text) Then
|
||||
' txtUmrechnungskurs.Text = kurs.GET_KURS(antr.UStVAn_Währungscode, CDate(txtRgDatum.Text))
|
||||
' Else
|
||||
' txtUmrechnungskurs.Text = kurs.ezb_kurs
|
||||
' End If
|
||||
|
||||
End If
|
||||
' End If
|
||||
|
||||
End If
|
||||
' End If
|
||||
|
||||
|
||||
txtUSTBetragEUR.Text = Math.Floor((txtUSTBetrag.Text / txtUmrechnungskurs.Text) * 100 + 0.5) / 100
|
||||
' txtUSTBetragEUR.Text = RoundCurrency(txtUSTBetrag.Text / txtUmrechnungskurs.Text).ToString()
|
||||
|
||||
If IsNumeric(txtNettobetrag.Text) Then txtNettobetragEUR.Text = Math.Floor((txtNettobetrag.Text / txtUmrechnungskurs.Text) * 100 + 0.5) / 100
|
||||
' If IsNumeric(txtNettobetrag.Text) Then txtNettobetragEUR.Text = RoundCurrency(txtNettobetrag.Text / txtUmrechnungskurs.Text).ToString() 'Math.Floor((txtNettobetrag.Text / txtUmrechnungskurs.Text) * 100 + 0.5) / 100
|
||||
|
||||
txtChanged = True
|
||||
End If
|
||||
' _txtChanged = True
|
||||
' End If
|
||||
|
||||
End If
|
||||
' End If
|
||||
|
||||
ElseIf sender Is txtUSTBetragEUR Then
|
||||
' 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
|
||||
' '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
|
||||
' If IsNumeric(txtUSTBetragEUR.Text) AndAlso IsNumeric(txtUSTBetrag.Text) Then
|
||||
|
||||
If CDbl(UStV_POS.UStVPo_USteuerbetragEUR) <> CDbl(txtUSTBetragEUR.Text) OrElse UStV_POS.UStVPo_USteuerbetragEUR Is Nothing Then
|
||||
' If UStV_POS.UStVPo_USteuerbetragEUR Is Nothing OrElse CDbl(UStV_POS.UStVPo_USteuerbetragEUR) <> CDbl(txtUSTBetragEUR.Text) Then
|
||||
|
||||
Dim zahl1 = CDbl(txtUSTBetrag.Text) / CDbl(txtUSTBetragEUR.Text)
|
||||
' 'If CDbl(UStV_POS.UStVPo_USteuerbetragEUR) <> CDbl(txtUSTBetragEUR.Text) OrElse UStV_POS.UStVPo_USteuerbetragEUR Is Nothing Then
|
||||
|
||||
txtUmrechnungskurs.Text = Math.Round(zahl1, 2)
|
||||
txtChanged = True
|
||||
End If
|
||||
End If
|
||||
' Dim zahl1 = CDbl(txtUSTBetrag.Text) / CDbl(txtUSTBetragEUR.Text)
|
||||
|
||||
ElseIf sender Is txtUmrechnungskurs Then
|
||||
' txtUmrechnungskurs.Text = Math.Round(zahl1, 2)
|
||||
' _txtChanged = True
|
||||
' End If
|
||||
' End If
|
||||
|
||||
' ElseIf sender Is txtUmrechnungskurs Then
|
||||
|
||||
|
||||
If IsNumeric(txtUSTBetrag.Text) AndAlso IsNumeric(txtUmrechnungskurs._value) Then
|
||||
' If IsNumeric(txtUSTBetrag.Text) AndAlso IsNumeric(txtUmrechnungskurs._value) Then
|
||||
|
||||
If UStV_POS.UStVPo_Umrechnungskurs <> txtUmrechnungskurs.Text.Replace(",", ".") OrElse UStV_POS.UStVPo_Umrechnungskurs Is Nothing Then
|
||||
' If UStV_POS.UStVPo_Umrechnungskurs <> txtUmrechnungskurs.Text.Replace(",", ".") OrElse UStV_POS.UStVPo_Umrechnungskurs Is Nothing Then
|
||||
|
||||
txtUSTBetragEUR.Text = Math.Floor((txtUSTBetrag.Text / txtUmrechnungskurs.Text) * 100 + 0.5) / 100
|
||||
If IsNumeric(txtNettobetrag.Text) Then txtNettobetragEUR.Text = Math.Floor((txtNettobetrag.Text / txtUmrechnungskurs.Text) * 100 + 0.5) / 100
|
||||
txtChanged = True
|
||||
End If
|
||||
End If
|
||||
' txtUSTBetragEUR.Text = RoundCurrency(txtUSTBetrag.Text / txtUmrechnungskurs.Text).ToString() ' Math.Floor((txtUSTBetrag.Text / txtUmrechnungskurs.Text) * 100 + 0.5) / 100
|
||||
' If IsNumeric(txtNettobetrag.Text) Then txtNettobetragEUR.Text = RoundCurrency(txtNettobetrag.Text / txtUmrechnungskurs.Text).ToString() 'Math.Floor((txtNettobetrag.Text / txtUmrechnungskurs.Text) * 100 + 0.5) / 100
|
||||
' _txtChanged = True
|
||||
' End If
|
||||
' End If
|
||||
|
||||
|
||||
|
||||
|
||||
'ElseIf sender Is sbLeistender Then
|
||||
' 'ElseIf sender Is sbLeistender Then
|
||||
|
||||
|
||||
|
||||
' If UStV_Leist.hasEntry Then
|
||||
' ' If UStV_Leist.hasEntry Then
|
||||
|
||||
|
||||
' UStV_POS.UStVPo_Leistender = UStV_Leist.UStV_Leistender
|
||||
' If UStV_Leist.UStV_LeistenderId > 0 Then UStV_POS.UStVPo_LeistenderId = UStV_Leist.UStV_LeistenderId
|
||||
' txtChanged = True
|
||||
' ' UStV_POS.UStVPo_Leistender = UStV_Leist.UStV_Leistender
|
||||
' ' If UStV_Leist.UStV_LeistenderId > 0 Then UStV_POS.UStVPo_LeistenderId = UStV_Leist.UStV_LeistenderId
|
||||
' ' txtChanged = True
|
||||
|
||||
' End If
|
||||
' ' End If
|
||||
|
||||
|
||||
|
||||
ElseIf sender Is txtRgDatum Then
|
||||
' ElseIf sender Is txtRgDatum Then
|
||||
|
||||
If txtRgDatum.Text <> "" Then
|
||||
txtRgDatum.Text = txtRgDatum.Text.Replace("-", ".")
|
||||
txtRgDatum.Text = txtRgDatum.Text.Replace(",", ".")
|
||||
' If txtRgDatum.Text <> "" Then
|
||||
' txtRgDatum.Text = txtRgDatum.Text.Replace("-", ".")
|
||||
' txtRgDatum.Text = txtRgDatum.Text.Replace(",", ".")
|
||||
|
||||
Dim antr As New cUSTVAntrag(UStV_POS.UStVAn_ID)
|
||||
' Dim antr As New cUSTVAntrag(UStV_POS.UStVAn_ID)
|
||||
|
||||
If IsDate(txtRgDatum.Text) AndAlso ((CDate(txtRgDatum.Text) > antr.UStVAn_ReDatBis) OrElse (CDate(txtRgDatum.Text) < antr.UStVAn_ReDatVon)) Then
|
||||
MsgBox("Rechnungsdatum " & CDate(txtRgDatum.Text) & " darf nicht außerhalb der Antragsperiode liegen!")
|
||||
Else
|
||||
txtChanged = True
|
||||
End If
|
||||
End If
|
||||
' If IsDate(txtRgDatum.Text) AndAlso ((CDate(txtRgDatum.Text) > antr.UStVAn_ReDatBis) OrElse (CDate(txtRgDatum.Text) < antr.UStVAn_ReDatVon)) Then
|
||||
' MsgBox("Rechnungsdatum " & CDate(txtRgDatum.Text) & " darf nicht außerhalb der Antragsperiode liegen!")
|
||||
' Else
|
||||
' _txtChanged = True
|
||||
' End If
|
||||
' End If
|
||||
|
||||
ElseIf sender Is txtLeistungsbezeichnung Then
|
||||
' ElseIf sender Is txtLeistungsbezeichnung Then
|
||||
|
||||
'If UStV_POS.UStVPo_Leistungsbezeichnung <> txtLeistungsbezeichnung.Text Then
|
||||
'UStV_POS.UStVPo_Leistungsbezeichnung = txtLeistungsbezeichnung.Text
|
||||
txtChanged = True
|
||||
'End If
|
||||
' 'If UStV_POS.UStVPo_Leistungsbezeichnung <> txtLeistungsbezeichnung.Text Then
|
||||
' 'UStV_POS.UStVPo_Leistungsbezeichnung = txtLeistungsbezeichnung.Text
|
||||
' _txtChanged = True
|
||||
' 'End If
|
||||
|
||||
|
||||
|
||||
|
||||
ElseIf sender Is sbLeistender Then
|
||||
If sbLeistender.Text <> "" Then
|
||||
If sbLeistender.Text IsNot Nothing AndAlso sbLeistender.Text <> "" Then
|
||||
If IsNumeric(sbLeistender.Text) Then
|
||||
If UStV_Leist IsNot Nothing AndAlso UStV_Leist.UStV_Leistender <> "" AndAlso (UStV_POS.UStVPo_Leistender <> sbLeistender.Text OrElse UStV_POS.UStVPo_LeistenderId <> sbLeistender.Text) Then
|
||||
'speichern der Änderung nur, wenn 1. Leistender gelöscht wird.
|
||||
txtChanged = True
|
||||
ElseIf UStV_Leist Is Nothing Then
|
||||
txtChanged = True
|
||||
End If
|
||||
' ElseIf sender Is sbLeistender Then
|
||||
' If sbLeistender.Text <> "" Then
|
||||
' If sbLeistender.Text IsNot Nothing AndAlso sbLeistender.Text <> "" Then
|
||||
' If IsNumeric(sbLeistender.Text) Then
|
||||
' If UStV_Leist IsNot Nothing AndAlso UStV_Leist.UStV_Leistender <> "" AndAlso (UStV_POS.UStVPo_Leistender <> sbLeistender.Text OrElse UStV_POS.UStVPo_LeistenderId <> sbLeistender.Text) Then
|
||||
' 'speichern der Änderung nur, wenn 1. Leistender gelöscht wird.
|
||||
' _txtChanged = True
|
||||
' ElseIf UStV_Leist Is Nothing Then
|
||||
' _txtChanged = True
|
||||
' End If
|
||||
|
||||
UStV_Leist = New VERAG_PROG_ALLGEMEIN.cUStVLeistender(CInt(sbLeistender.Text))
|
||||
Else
|
||||
If UStV_Leist IsNot Nothing AndAlso UStV_Leist.UStV_Leistender <> "" AndAlso (UStV_Leist.UStV_Leistender <> sbLeistender.Text OrElse UStV_POS.UStVPo_Leistender <> sbLeistender.Text) Then
|
||||
txtChanged = True
|
||||
ElseIf UStV_Leist Is Nothing Then
|
||||
txtChanged = True
|
||||
End If
|
||||
End If
|
||||
' UStV_Leist = New VERAG_PROG_ALLGEMEIN.cUStVLeistender(CInt(sbLeistender.Text))
|
||||
' Else
|
||||
' If UStV_Leist IsNot Nothing AndAlso UStV_Leist.UStV_Leistender <> "" AndAlso (UStV_Leist.UStV_Leistender <> sbLeistender.Text OrElse UStV_POS.UStVPo_Leistender <> sbLeistender.Text) Then
|
||||
' _txtChanged = True
|
||||
' ElseIf UStV_Leist Is Nothing Then
|
||||
' _txtChanged = True
|
||||
' End If
|
||||
' End If
|
||||
|
||||
UStV_Leist = New VERAG_PROG_ALLGEMEIN.cUStVLeistender(sbLeistender.Text)
|
||||
loadChangedDSToPanel(UStV_Leist)
|
||||
Else
|
||||
If UStV_POS.UStVPo_Leistender <> "" OrElse UStV_POS.UStVPo_LeistenderId <> 0 Then
|
||||
loadChangedDSToPanel(Nothing, True)
|
||||
End If
|
||||
' UStV_Leist = New VERAG_PROG_ALLGEMEIN.cUStVLeistender(sbLeistender.Text)
|
||||
' loadChangedDSToPanel(UStV_Leist)
|
||||
' Else
|
||||
' If UStV_POS.UStVPo_Leistender <> "" OrElse UStV_POS.UStVPo_LeistenderId <> 0 Then
|
||||
' loadChangedDSToPanel(Nothing, True)
|
||||
' End If
|
||||
|
||||
End If
|
||||
End If
|
||||
'MsgBox()
|
||||
End If
|
||||
' End If
|
||||
' End If
|
||||
' 'MsgBox()
|
||||
' End If
|
||||
|
||||
|
||||
' End If
|
||||
|
||||
' If _txtChanged Then
|
||||
' values_changed()
|
||||
' _txtChanged = False
|
||||
' End If
|
||||
|
||||
|
||||
'End If
|
||||
|
||||
End Sub
|
||||
|
||||
Private Function CanEdit() As Boolean
|
||||
|
||||
Return VERAG_PROG_ALLGEMEIN.cBerechtignunen.CHECK_BERECHTIGUNG_bool("MDM_USTVA_bearbeiten", Me.FindForm)
|
||||
|
||||
End Function
|
||||
|
||||
Private Sub HandleVatAmountChanged()
|
||||
|
||||
If String.IsNullOrWhiteSpace(txtUSTBetrag.Text) Then
|
||||
lblWarning.Text = "Bitte Umsatzsteuerbetrag eingeben."
|
||||
Return
|
||||
End If
|
||||
|
||||
Dim ustBetrag As Decimal
|
||||
Dim umrechnungskurs As Decimal
|
||||
|
||||
If Not TryGetDecimal(txtUSTBetrag.Text, ustBetrag) Then
|
||||
lblWarning.Text = "USt-Betrag ist ungültig."
|
||||
Return
|
||||
End If
|
||||
|
||||
If Not TryGetDecimal(txtUmrechnungskurs.Text, umrechnungskurs) OrElse
|
||||
umrechnungskurs <= 0 Then
|
||||
|
||||
LoadExchangeRate()
|
||||
|
||||
If Not TryGetDecimal(txtUmrechnungskurs.Text, umrechnungskurs) OrElse
|
||||
umrechnungskurs <= 0 Then
|
||||
|
||||
lblWarning.Text = "Umrechnungskurs ist ungültig."
|
||||
Return
|
||||
|
||||
End If
|
||||
|
||||
If txtChanged Then
|
||||
values_changed()
|
||||
txtChanged = False
|
||||
End If
|
||||
|
||||
|
||||
End If
|
||||
|
||||
Dim oldValueChanged As Boolean =
|
||||
UStV_POS Is Nothing OrElse
|
||||
UStV_POS.UStVPo_USteuerbetrag Is Nothing OrElse
|
||||
Convert.ToDecimal(UStV_POS.UStVPo_USteuerbetrag) <> ustBetrag
|
||||
|
||||
If Not oldValueChanged Then Return
|
||||
|
||||
txtUSTBetragEUR.Text =
|
||||
RoundCurrency(ustBetrag / umrechnungskurs).ToString()
|
||||
|
||||
Dim nettoBetrag As Decimal
|
||||
|
||||
If TryGetDecimal(txtNettobetrag.Text, nettoBetrag) Then
|
||||
txtNettobetragEUR.Text =
|
||||
RoundCurrency(nettoBetrag / umrechnungskurs).ToString()
|
||||
End If
|
||||
|
||||
_txtChanged = True
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub HandleVatAmountEurChanged()
|
||||
|
||||
Dim ustBetragEUR As Decimal
|
||||
Dim ustBetrag As Decimal
|
||||
|
||||
If Not TryGetDecimal(txtUSTBetragEUR.Text, ustBetragEUR) Then
|
||||
Return
|
||||
End If
|
||||
|
||||
If Not TryGetDecimal(txtUSTBetrag.Text, ustBetrag) Then
|
||||
Return
|
||||
End If
|
||||
|
||||
If ustBetragEUR = 0 Then
|
||||
lblWarning.Text = "USt-Betrag EUR darf nicht 0 sein."
|
||||
Return
|
||||
End If
|
||||
|
||||
Dim oldValueChanged As Boolean =
|
||||
UStV_POS Is Nothing OrElse
|
||||
UStV_POS.UStVPo_USteuerbetragEUR Is Nothing OrElse
|
||||
Convert.ToDecimal(UStV_POS.UStVPo_USteuerbetragEUR) <> ustBetragEUR
|
||||
|
||||
If Not oldValueChanged Then Return
|
||||
|
||||
Dim kurs As Decimal =
|
||||
RoundCurrency(ustBetrag / ustBetragEUR)
|
||||
|
||||
txtUmrechnungskurs.Text = kurs.ToString()
|
||||
|
||||
_txtChanged = True
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub HandleExchangeRateChanged()
|
||||
|
||||
Dim ustBetrag As Decimal
|
||||
Dim umrechnungskurs As Decimal
|
||||
|
||||
If Not TryGetDecimal(txtUSTBetrag.Text, ustBetrag) Then
|
||||
Return
|
||||
End If
|
||||
|
||||
If Not TryGetDecimal(txtUmrechnungskurs.Text, umrechnungskurs) Then
|
||||
lblWarning.Text = "Umrechnungskurs ist ungültig."
|
||||
Return
|
||||
End If
|
||||
|
||||
If umrechnungskurs <= 0 Then
|
||||
lblWarning.Text = "Umrechnungskurs muss größer als 0 sein."
|
||||
Return
|
||||
End If
|
||||
|
||||
Dim oldKurs As Decimal
|
||||
|
||||
If UStV_POS IsNot Nothing AndAlso UStV_POS.UStVPo_Umrechnungskurs IsNot Nothing AndAlso TryGetDecimal(Convert.ToString(UStV_POS.UStVPo_Umrechnungskurs), oldKurs) Then
|
||||
|
||||
If oldKurs = umrechnungskurs Then
|
||||
Return
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
txtUSTBetragEUR.Text =
|
||||
RoundCurrency(ustBetrag / umrechnungskurs).ToString()
|
||||
|
||||
Dim nettoBetrag As Decimal
|
||||
|
||||
If TryGetDecimal(txtNettobetrag.Text, nettoBetrag) Then
|
||||
txtNettobetragEUR.Text =
|
||||
RoundCurrency(nettoBetrag / umrechnungskurs).ToString()
|
||||
End If
|
||||
|
||||
_txtChanged = True
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub HandleInvoiceDateChanged()
|
||||
|
||||
If String.IsNullOrWhiteSpace(txtRgDatum.Text) Then
|
||||
Return
|
||||
End If
|
||||
|
||||
txtRgDatum.Text =
|
||||
txtRgDatum.Text.Replace("-", ".").Replace(",", ".")
|
||||
|
||||
Dim rechnungsDatum As DateTime
|
||||
|
||||
If Not DateTime.TryParse(txtRgDatum.Text, rechnungsDatum) Then
|
||||
lblWarning.Text = "Rechnungsdatum ist ungültig."
|
||||
Return
|
||||
End If
|
||||
|
||||
Dim antrag As New cUSTVAntrag(UStV_POS.UStVAn_ID)
|
||||
|
||||
If rechnungsDatum > antrag.UStVAn_ReDatBis OrElse
|
||||
rechnungsDatum < antrag.UStVAn_ReDatVon Then
|
||||
|
||||
MsgBox("Rechnungsdatum " & rechnungsDatum.ToString("dd.MM.yyyy") & " darf nicht außerhalb der Antragsperiode liegen!")
|
||||
|
||||
Return
|
||||
End If
|
||||
|
||||
_txtChanged = True
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub HandleServiceDescriptionChanged()
|
||||
|
||||
If String.IsNullOrWhiteSpace(txtLeistungsbezeichnung.Text) Then
|
||||
lblWarning.Text = "Leistungsbez. muss ausgefüllt werden."
|
||||
Return
|
||||
End If
|
||||
|
||||
_txtChanged = True
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub HandleSupplierChanged()
|
||||
|
||||
Dim supplierText As String = sbLeistender.Text.Trim()
|
||||
|
||||
If String.IsNullOrWhiteSpace(supplierText) Then
|
||||
|
||||
If UStV_POS IsNot Nothing AndAlso
|
||||
(UStV_POS.UStVPo_Leistender <> "" OrElse
|
||||
UStV_POS.UStVPo_LeistenderId <> 0) Then
|
||||
|
||||
UStV_Leist = Nothing
|
||||
loadChangedDSToPanel(Nothing, True)
|
||||
_txtChanged = True
|
||||
|
||||
End If
|
||||
|
||||
Return
|
||||
|
||||
End If
|
||||
|
||||
Dim supplier As VERAG_PROG_ALLGEMEIN.cUStVLeistender
|
||||
|
||||
If IsNumeric(supplierText) Then
|
||||
supplier = New VERAG_PROG_ALLGEMEIN.cUStVLeistender(CInt(supplierText))
|
||||
Else
|
||||
supplier = New VERAG_PROG_ALLGEMEIN.cUStVLeistender(supplierText)
|
||||
End If
|
||||
|
||||
If supplier Is Nothing Then Return
|
||||
|
||||
Dim changed As Boolean = False
|
||||
|
||||
If UStV_Leist Is Nothing Then
|
||||
changed = True
|
||||
ElseIf UStV_POS Is Nothing Then
|
||||
changed = True
|
||||
ElseIf UStV_POS.UStVPo_Leistender <> supplier.UStV_Leistender Then
|
||||
changed = True
|
||||
ElseIf UStV_POS.UStVPo_LeistenderId <> supplier.UStV_LeistenderId Then
|
||||
changed = True
|
||||
End If
|
||||
|
||||
UStV_Leist = supplier
|
||||
|
||||
loadChangedDSToPanel(UStV_Leist)
|
||||
|
||||
If changed Then
|
||||
_txtChanged = True
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub LoadExchangeRate()
|
||||
|
||||
If UStV_POS Is Nothing Then Return
|
||||
|
||||
Dim antrag As New cUSTVAntrag(UStV_POS.UStVAn_ID)
|
||||
|
||||
If antrag.UStVAn_Währungscode = "EUR" Then
|
||||
txtUmrechnungskurs.Text = "1"
|
||||
Return
|
||||
End If
|
||||
|
||||
Dim rechnungsDatum As DateTime
|
||||
|
||||
If DateTime.TryParse(txtRgDatum.Text, rechnungsDatum) Then
|
||||
|
||||
Dim kurs As New cEZB_Waehrungskurse(antrag.UStVAn_Währungscode)
|
||||
|
||||
txtUmrechnungskurs.Text = kurs.GET_KURS(antrag.UStVAn_Währungscode, rechnungsDatum).ToString()
|
||||
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub SaveIfChanged()
|
||||
|
||||
If Not _txtChanged Then Return
|
||||
|
||||
_txtChanged = False
|
||||
|
||||
values_changed()
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub scanSonstiges_FileAdded(id As String, path As String, name As String) Handles scanSonstiges.FileAdded
|
||||
@@ -659,12 +1001,8 @@ Public Class ustCntlUSTV_AntragPosition
|
||||
|
||||
Private Sub cbxAntragsfilter_CheckedChanged(sender As Object, e As EventArgs) Handles cbxAntragsfilter.CheckedChanged
|
||||
|
||||
Dim filter As String = "UstV_aktiv = 1"
|
||||
If Antrag_LandKz <> "" Then
|
||||
If cbxAntragsfilter.Checked Then filter &= " and left(UstV_Leistender_UstNr,2)='" & Antrag_LandKz & "'"
|
||||
sbLeistender.initSearchBox(Me.FindForm, "[UStV_LeistenderId],[UStV_Leistender], ([UStV_Leistender]) as Leistender,[UstV_Leistender_PLZ] as PLZ, ([UstV_Leistender_Strasse] + ' ' +[UstV_Leistender_StrasseNr]) as Strasse, [UstV_Leistender_Stadt] as Stadt FROM [tblUStVLeistender]", {"UStV_Leistender", "UstV_Leistender_UstNr"}, filter, "UStV_Leistender", "UStV_LeistenderId", "Leistender", "FMZOLL",, 400, 200, {"UStV_Leistender", "UStV_LeistenderId"})
|
||||
'sbLeistender.initSearchBox(Me.FindForm, "[UStV_LeistenderId],[UStV_Leistender], ([UStV_Leistender] + ' ' + isnull([UstV_Leistender_UstNr],'')) as Leistender,[UstV_Leistender_PLZ] as PLZ, ([UstV_Leistender_Strasse] + ' ' +[UstV_Leistender_StrasseNr]) as Strasse, [UstV_Leistender_Stadt] as Stadt FROM [tblUStVLeistender]", {"UStV_Leistender", "UstV_Leistender_UstNr"}, filter, "UStV_Leistender", "UStV_LeistenderId", "Leistender", "FMZOLL",, 400, 200, {"UStV_Leistender", "UStV_LeistenderId"})
|
||||
End If
|
||||
InitLeistenderSearchBox()
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub mnuItemKIUPLOAD_Clicked(sender As Object, e As EventArgs)
|
||||
@@ -716,7 +1054,7 @@ Public Class ustCntlUSTV_AntragPosition
|
||||
f.usrcntlVAT_ATEZ1.btnUebernehmen.Enabled = UStV_POS.UStVPo_daId_loeschbar 'NUR ÜBERNEHMEN WENN LÖSCHBAR!
|
||||
f.usrcntlVAT_ATEZ1.initDGV(dt)
|
||||
f.usrcntlVAT_ATEZ1.setColorIndgv()
|
||||
f.usrcntlVAT_ATEZ1.setAmountOnly = IIf(UStV_POS.UStVPo_SchnittstellenNr = 7, True, False)
|
||||
f.usrcntlVAT_ATEZ1.setAmountOnly = UStV_POS.UStVPo_SchnittstellenNr = 7
|
||||
|
||||
|
||||
If f.ShowDialog = DialogResult.OK Then
|
||||
@@ -826,6 +1164,36 @@ Public Class ustCntlUSTV_AntragPosition
|
||||
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub SetAddressChangeHandlers(enabled As Boolean)
|
||||
|
||||
For Each c As Control In pnlAdresse.Controls
|
||||
|
||||
If TypeOf c Is TextBox Then
|
||||
|
||||
Dim tb As TextBox = DirectCast(c, TextBox)
|
||||
|
||||
RemoveHandler tb.TextChanged, AddressOf SomethingChanged
|
||||
|
||||
If enabled Then
|
||||
AddHandler tb.TextChanged, AddressOf SomethingChanged
|
||||
End If
|
||||
|
||||
ElseIf TypeOf c Is MyComboBox Then
|
||||
|
||||
Dim cb As MyComboBox = DirectCast(c, MyComboBox)
|
||||
|
||||
RemoveHandler cb.TextChanged, AddressOf SomethingChanged
|
||||
|
||||
If enabled Then
|
||||
AddHandler cb.TextChanged, AddressOf SomethingChanged
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
Next
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub btnAPIUbload_Click(sender As Object, e As EventArgs) Handles btnAPIUbload.Click
|
||||
@@ -852,7 +1220,7 @@ Public Class ustCntlUSTV_AntragPosition
|
||||
|
||||
Private Sub txtStrasse_PreviewKeyDown(sender As Object, e As PreviewKeyDownEventArgs) Handles txtStrasse.PreviewKeyDown, txtPLZ.PreviewKeyDown, txtOrt.PreviewKeyDown, txtLand.PreviewKeyDown, txtStrassenNr.PreviewKeyDown, txtUIDNr.PreviewKeyDown
|
||||
|
||||
If gridAktiv And Me.FindForm IsNot Nothing Then
|
||||
If _gridAktiv And Me.FindForm IsNot Nothing Then
|
||||
|
||||
' Eingabeprüfung
|
||||
If e.KeyValue = 9 Then
|
||||
@@ -913,11 +1281,11 @@ Public Class ustCntlUSTV_AntragPosition
|
||||
Else
|
||||
If IsNumeric(txtNettobetragEUR.Text) Then
|
||||
txtNettobetrag.Text = Math.Floor((txtNettobetragEUR.Text * txtUmrechnungskurs.Text) * 100 + 0.5) / 100
|
||||
txtChanged = True
|
||||
_txtChanged = True
|
||||
|
||||
If txtChanged Then
|
||||
If _txtChanged Then
|
||||
values_changed()
|
||||
txtChanged = False
|
||||
_txtChanged = False
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
Reference in New Issue
Block a user