diff --git a/SDL/USTV/frmMDM_USTVAntrag.vb b/SDL/USTV/frmMDM_USTVAntrag.vb index 55dcb9d3..fc9e7d41 100644 --- a/SDL/USTV/frmMDM_USTVAntrag.vb +++ b/SDL/USTV/frmMDM_USTVAntrag.vb @@ -1146,10 +1146,11 @@ Public Class frmMDM_USTVAntrag If UStVEr_ID > 0 Then Dim ANTR_ERSTATTUNG As New VERAG_PROG_ALLGEMEIN.cUStVErstattungPositionen(USTV_ANTRAG.UStVAn_ID, UStVEr_ID) UstCntlUSTV_AntragErstattungen1.Enabled = True - UstCntlUSTV_AntragErstattungen1.setValues(USTV_ANTRAG.UStVAn_KuNr, ANTR_ERSTATTUNG) + UstCntlUSTV_AntragErstattungen1.setValues(USTV_ANTRAG, ANTR_ERSTATTUNG, USTV_ANTRAG.UStVAn_KuNr) Else UstCntlUSTV_AntragErstattungen1.reset() UstCntlUSTV_AntragErstattungen1.Enabled = False + UstCntlUSTV_AntragErstattungen1.setValues(USTV_ANTRAG) End If End Sub @@ -1965,9 +1966,11 @@ Public Class frmMDM_USTVAntrag If TabControl1.SelectedTab Is TabPage1 Then init() + posTabisSelected = True ElseIf TabControl1.SelectedTab Is TabPage2 Then initdgvErstattungen() + posTabisSelected = False End If @@ -2046,7 +2049,9 @@ Public Class frmMDM_USTVAntrag If dgvErstattungspositionen.Rows.Count = 0 Then Exit Sub If vbYes = MsgBox("Möchten Sie den Erstattungseintrag wirklich löschen?", vbYesNoCancel) Then - UstCntlUSTV_AntragErstattungen1.UStV_ERS.DELETE(UstCntlUSTV_AntragPosition1.UStV_POS.UStVAn_ID, UstCntlUSTV_AntragErstattungen1.UStV_ERS) + If UstCntlUSTV_AntragErstattungen1.UStV_ERS.DELETE(UstCntlUSTV_AntragPosition1.UStV_POS.UStVAn_ID, UstCntlUSTV_AntragErstattungen1.UStV_ERS) Then + initdgvErstattungen() + End If End If End Sub @@ -2062,7 +2067,7 @@ Public Class frmMDM_USTVAntrag .SET_SQL("SELECT [UStVAn_ID] ,[UStVEr_ID],[UStVEr_USteuerbetrag],[Belegdatum],[Belegnummer],[GutschriftsDatum],[GutschriftsNr],[Berufungsdatum],[Berufungshöhe],[Berufungsgrund],[Bemerkung],[UStVEr_Umrechnungskurs],[UStVEr_USteuerbetragEUR],[UStVEr_Sachbearbeiter],[UStVEr_Zeitstempel] FROM [tblUStVErstattung] - where UStVAn_ID='" & UStVAn_ID & "' ORDER BY UStVEr_ID", "FMZOLL") + where UStVAn_ID=" & UStVAn_ID & " ORDER BY UStVEr_ID", "FMZOLL") .LOAD() .RowTemplate.Height = 20 .AllowUserToOrderColumns = False @@ -2116,6 +2121,8 @@ Public Class frmMDM_USTVAntrag End If + If .RowCount < 1 Then initErstsattungsPosition(-1) + End With diff --git a/SDL/USTV/ustCntlUSTV_ErstattungPosition .Designer.vb b/SDL/USTV/ustCntlUSTV_ErstattungPosition .Designer.vb index d29593ac..2efe8331 100644 --- a/SDL/USTV/ustCntlUSTV_ErstattungPosition .Designer.vb +++ b/SDL/USTV/ustCntlUSTV_ErstattungPosition .Designer.vb @@ -41,6 +41,9 @@ Partial Class ustCntlUSTV_ErstattungPosition Me.lblAenderungsdatum = New System.Windows.Forms.Label() Me.lblSachbearbeiter = New System.Windows.Forms.Label() Me.pnl = New System.Windows.Forms.Panel() + Me.Label19 = New System.Windows.Forms.Label() + Me.Label18 = New System.Windows.Forms.Label() + Me.txtGuNr = New VERAG_PROG_ALLGEMEIN.MyTextBox() Me.txtBerufungsdatum = New VERAG_PROG_ALLGEMEIN.MyTextBox() Me.lblWarning = New System.Windows.Forms.Label() Me.txtBemerkung = New VERAG_PROG_ALLGEMEIN.MyTextBox() @@ -56,9 +59,6 @@ Partial Class ustCntlUSTV_ErstattungPosition Me.txtUmrechnungskurs = New VERAG_PROG_ALLGEMEIN.MyTextBox() Me.txtUSTBetrag = New VERAG_PROG_ALLGEMEIN.MyTextBox() Me.Panel1 = New System.Windows.Forms.Panel() - Me.txtGuNr = New VERAG_PROG_ALLGEMEIN.MyTextBox() - Me.Label18 = New System.Windows.Forms.Label() - Me.Label19 = New System.Windows.Forms.Label() Me.Panel2.SuspendLayout() Me.pnl.SuspendLayout() Me.Panel1.SuspendLayout() @@ -123,7 +123,7 @@ Partial Class ustCntlUSTV_ErstattungPosition Me.btnBildAuf.Location = New System.Drawing.Point(16, 7) Me.btnBildAuf.Name = "btnBildAuf" Me.btnBildAuf.Size = New System.Drawing.Size(71, 77) - Me.btnBildAuf.TabIndex = 0 + Me.btnBildAuf.TabIndex = 12 Me.btnBildAuf.Text = "Bild auf" Me.btnBildAuf.TextAlign = System.Drawing.ContentAlignment.BottomCenter Me.btnBildAuf.UseVisualStyleBackColor = True @@ -136,7 +136,7 @@ Partial Class ustCntlUSTV_ErstattungPosition Me.Button1.Location = New System.Drawing.Point(16, 90) Me.Button1.Name = "Button1" Me.Button1.Size = New System.Drawing.Size(71, 77) - Me.Button1.TabIndex = 1 + Me.Button1.TabIndex = 13 Me.Button1.Text = "Bild ab" Me.Button1.TextAlign = System.Drawing.ContentAlignment.TopCenter Me.Button1.UseVisualStyleBackColor = True @@ -159,7 +159,7 @@ Partial Class ustCntlUSTV_ErstattungPosition Me.Label3.Name = "Label3" Me.Label3.Size = New System.Drawing.Size(87, 15) Me.Label3.TabIndex = 5 - Me.Label3.Text = "Gutschritfs-Nr.:" + Me.Label3.Text = "Gutschrifts-Nr.:" ' 'Label6 ' @@ -291,6 +291,49 @@ Partial Class ustCntlUSTV_ErstattungPosition Me.pnl.Size = New System.Drawing.Size(1300, 235) Me.pnl.TabIndex = 1 ' + 'Label19 + ' + Me.Label19.AutoSize = True + Me.Label19.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.5!) + Me.Label19.Location = New System.Drawing.Point(504, 112) + Me.Label19.Name = "Label19" + Me.Label19.Size = New System.Drawing.Size(107, 15) + Me.Label19.TabIndex = 34 + Me.Label19.Text = "Berufungs-Datum:" + ' + 'Label18 + ' + Me.Label18.AutoSize = True + Me.Label18.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.Label18.Location = New System.Drawing.Point(504, 92) + Me.Label18.Name = "Label18" + Me.Label18.Size = New System.Drawing.Size(58, 13) + Me.Label18.TabIndex = 33 + Me.Label18.Text = "Berufung" + ' + 'txtGuNr + ' + Me.txtGuNr._DateTimeOnly = False + Me.txtGuNr._numbersOnly = False + Me.txtGuNr._numbersOnlyKommastellen = "" + Me.txtGuNr._numbersOnlyTrennzeichen = True + Me.txtGuNr._Prozent = False + Me.txtGuNr._ShortDateNew = False + Me.txtGuNr._ShortDateOnly = False + Me.txtGuNr._TimeOnly = False + Me.txtGuNr._TimeOnly_Seconds = False + Me.txtGuNr._value = Nothing + Me.txtGuNr._Waehrung = False + Me.txtGuNr._WaehrungZeichen = False + Me.txtGuNr.Location = New System.Drawing.Point(695, 49) + Me.txtGuNr.MaxLength = 22 + Me.txtGuNr.MaxLineLength = -1 + Me.txtGuNr.MaxLines_Warning = "" + Me.txtGuNr.MaxLines_Warning_Label = Nothing + Me.txtGuNr.Name = "txtGuNr" + Me.txtGuNr.Size = New System.Drawing.Size(182, 20) + Me.txtGuNr.TabIndex = 4 + ' 'txtBerufungsdatum ' Me.txtBerufungsdatum._DateTimeOnly = False @@ -313,7 +356,7 @@ Partial Class ustCntlUSTV_ErstattungPosition Me.txtBerufungsdatum.MaxLines_Warning_Label = Nothing Me.txtBerufungsdatum.Name = "txtBerufungsdatum" Me.txtBerufungsdatum.Size = New System.Drawing.Size(169, 20) - Me.txtBerufungsdatum.TabIndex = 15 + Me.txtBerufungsdatum.TabIndex = 8 ' 'lblWarning ' @@ -346,8 +389,8 @@ Partial Class ustCntlUSTV_ErstattungPosition Me.txtBemerkung.MaxLines_Warning = "" Me.txtBemerkung.MaxLines_Warning_Label = Nothing Me.txtBemerkung.Name = "txtBemerkung" - Me.txtBemerkung.Size = New System.Drawing.Size(431, 20) - Me.txtBemerkung.TabIndex = 20 + Me.txtBemerkung.Size = New System.Drawing.Size(458, 20) + Me.txtBemerkung.TabIndex = 11 ' 'Label14 ' @@ -391,7 +434,7 @@ Partial Class ustCntlUSTV_ErstattungPosition Me.txtBerufungshoehe.MaxLines_Warning_Label = Nothing Me.txtBerufungshoehe.Name = "txtBerufungshoehe" Me.txtBerufungshoehe.Size = New System.Drawing.Size(99, 20) - Me.txtBerufungshoehe.TabIndex = 16 + Me.txtBerufungshoehe.TabIndex = 10 ' 'txtBelegNr ' @@ -414,7 +457,7 @@ Partial Class ustCntlUSTV_ErstattungPosition Me.txtBelegNr.MaxLines_Warning_Label = Nothing Me.txtBelegNr.Name = "txtBelegNr" Me.txtBelegNr.Size = New System.Drawing.Size(183, 20) - Me.txtBelegNr.TabIndex = 7 + Me.txtBelegNr.TabIndex = 2 ' 'Label16 ' @@ -448,7 +491,7 @@ Partial Class ustCntlUSTV_ErstattungPosition Me.txtBerurunfgrund.MaxLines_Warning_Label = Nothing Me.txtBerurunfgrund.Name = "txtBerurunfgrund" Me.txtBerurunfgrund.Size = New System.Drawing.Size(154, 20) - Me.txtBerurunfgrund.TabIndex = 18 + Me.txtBerurunfgrund.TabIndex = 9 ' 'txtBelegDatum ' @@ -472,7 +515,7 @@ Partial Class ustCntlUSTV_ErstattungPosition Me.txtBelegDatum.MaxLines_Warning_Label = Nothing Me.txtBelegDatum.Name = "txtBelegDatum" Me.txtBelegDatum.Size = New System.Drawing.Size(154, 20) - Me.txtBelegDatum.TabIndex = 6 + Me.txtBelegDatum.TabIndex = 1 ' 'txtGuDatum ' @@ -495,7 +538,7 @@ Partial Class ustCntlUSTV_ErstattungPosition Me.txtGuDatum.MaxLines_Warning_Label = Nothing Me.txtGuDatum.Name = "txtGuDatum" Me.txtGuDatum.Size = New System.Drawing.Size(182, 20) - Me.txtGuDatum.TabIndex = 8 + Me.txtGuDatum.TabIndex = 3 ' 'txtUSTBetragEUR ' @@ -519,7 +562,7 @@ Partial Class ustCntlUSTV_ErstattungPosition Me.txtUSTBetragEUR.MaxLines_Warning_Label = Nothing Me.txtUSTBetragEUR.Name = "txtUSTBetragEUR" Me.txtUSTBetragEUR.Size = New System.Drawing.Size(154, 20) - Me.txtUSTBetragEUR.TabIndex = 11 + Me.txtUSTBetragEUR.TabIndex = 7 ' 'txtUmrechnungskurs ' @@ -543,7 +586,7 @@ Partial Class ustCntlUSTV_ErstattungPosition Me.txtUmrechnungskurs.MaxLines_Warning_Label = Nothing Me.txtUmrechnungskurs.Name = "txtUmrechnungskurs" Me.txtUmrechnungskurs.Size = New System.Drawing.Size(108, 20) - Me.txtUmrechnungskurs.TabIndex = 10 + Me.txtUmrechnungskurs.TabIndex = 6 ' 'txtUSTBetrag ' @@ -567,7 +610,7 @@ Partial Class ustCntlUSTV_ErstattungPosition Me.txtUSTBetrag.MaxLines_Warning_Label = Nothing Me.txtUSTBetrag.Name = "txtUSTBetrag" Me.txtUSTBetrag.Size = New System.Drawing.Size(154, 20) - Me.txtUSTBetrag.TabIndex = 9 + Me.txtUSTBetrag.TabIndex = 5 ' 'Panel1 ' @@ -579,49 +622,6 @@ Partial Class ustCntlUSTV_ErstattungPosition Me.Panel1.Size = New System.Drawing.Size(99, 235) Me.Panel1.TabIndex = 2 ' - 'txtGuNr - ' - Me.txtGuNr._DateTimeOnly = False - Me.txtGuNr._numbersOnly = False - Me.txtGuNr._numbersOnlyKommastellen = "" - Me.txtGuNr._numbersOnlyTrennzeichen = True - Me.txtGuNr._Prozent = False - Me.txtGuNr._ShortDateNew = False - Me.txtGuNr._ShortDateOnly = False - Me.txtGuNr._TimeOnly = False - Me.txtGuNr._TimeOnly_Seconds = False - Me.txtGuNr._value = Nothing - Me.txtGuNr._Waehrung = False - Me.txtGuNr._WaehrungZeichen = False - Me.txtGuNr.Location = New System.Drawing.Point(695, 49) - Me.txtGuNr.MaxLength = 22 - Me.txtGuNr.MaxLineLength = -1 - Me.txtGuNr.MaxLines_Warning = "" - Me.txtGuNr.MaxLines_Warning_Label = Nothing - Me.txtGuNr.Name = "txtGuNr" - Me.txtGuNr.Size = New System.Drawing.Size(182, 20) - Me.txtGuNr.TabIndex = 32 - ' - 'Label18 - ' - Me.Label18.AutoSize = True - Me.Label18.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - Me.Label18.Location = New System.Drawing.Point(504, 92) - Me.Label18.Name = "Label18" - Me.Label18.Size = New System.Drawing.Size(58, 13) - Me.Label18.TabIndex = 33 - Me.Label18.Text = "Berufung" - ' - 'Label19 - ' - Me.Label19.AutoSize = True - Me.Label19.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.5!) - Me.Label19.Location = New System.Drawing.Point(504, 112) - Me.Label19.Name = "Label19" - Me.Label19.Size = New System.Drawing.Size(107, 15) - Me.Label19.TabIndex = 34 - Me.Label19.Text = "Berufungs-Datum:" - ' 'ustCntlUSTV_ErstattungPosition ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) diff --git a/SDL/USTV/ustCntlUSTV_ErstattungPosition .vb b/SDL/USTV/ustCntlUSTV_ErstattungPosition .vb index ef59ba65..f4746a4d 100644 --- a/SDL/USTV/ustCntlUSTV_ErstattungPosition .vb +++ b/SDL/USTV/ustCntlUSTV_ErstattungPosition .vb @@ -1,8 +1,8 @@ -Imports GrapeCity.ActiveReports.ReportsCore.Tools -Imports VERAG_PROG_ALLGEMEIN +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 = "" @@ -40,13 +40,15 @@ Public Class ustCntlUSTV_ErstattungPosition End Sub - Sub setValues(kdnr As Integer, UStV_ERS As VERAG_PROG_ALLGEMEIN.cUStVErstattungPositionen) + Sub setValues(UstV_AN_ As cUSTVAntrag, Optional UStV_ERS As VERAG_PROG_ALLGEMEIN.cUStVErstattungPositionen = Nothing, Optional kdNr As Integer = -1) - gridAktiv = False + UstV_AN = UstV_AN_ + If UStV_ERS Is Nothing Then Exit Sub Me.UStV_ERS = UStV_ERS - Me.kdnr = kdnr + Me.kdnr = kdNr + txtBelegDatum._value = If(UStV_ERS.Belegdatum, "") txtBelegNr._value = If(UStV_ERS.Belegnummer, "") @@ -67,15 +69,19 @@ Public Class ustCntlUSTV_ErstattungPosition txtUSTBetragEUR.Text = If(UStV_ERS.UStVEr_USteuerbetragEUR, "") txtBemerkung.Text = If(UStV_ERS.Bemerkung, "") - gridAktiv = True 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() + 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 @@ -182,7 +188,7 @@ Public Class ustCntlUSTV_ErstattungPosition 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 gridAktiv And Me.FindForm IsNot Nothing Then + If Me.FindForm IsNot Nothing Then ' Eingabeprüfung If e.KeyValue = 9 Then diff --git a/VERAG_PROG_ALLGEMEIN/Classes/USTV/cUSTVAntrag.vb b/VERAG_PROG_ALLGEMEIN/Classes/USTV/cUSTVAntrag.vb index 2ca49127..ccb9f506 100644 --- a/VERAG_PROG_ALLGEMEIN/Classes/USTV/cUSTVAntrag.vb +++ b/VERAG_PROG_ALLGEMEIN/Classes/USTV/cUSTVAntrag.vb @@ -582,4 +582,16 @@ Public Class cUStVErstattungPositionen Return SQL.doSQL(sqlstr, "FMZOLL") End Function + + Public Function getMaxPosNr() As Integer + Try + Dim maxPosNr = -1 + + Return SQL.getValueTxtBySql("SELECT isnull(max([UStVEr_ID]),0)+1 FROM [tblUStVErstattung] where UStVAn_ID='" & UStVAn_ID & "'", "FMZOLL",,, "1") + + Catch ex As Exception + MsgBox("Fehler in der Funktion '" & System.Reflection.MethodInfo.GetCurrentMethod.Name & "'" & vbNewLine & vbNewLine & ex.Message & vbNewLine & vbNewLine & ex.StackTrace) + End Try + Return -1 + End Function End Class