fakt. Pos zurücksetzen, etc.

This commit is contained in:
2025-08-27 15:54:42 +02:00
parent 410fcd8d6e
commit c71f1ef352
3 changed files with 155 additions and 69 deletions

View File

@@ -1426,13 +1426,19 @@ Public Class usrCntlFaktAbrechnung
For Each r In dgvOfferteDetailsUebersicht.Rows
If r.Cells("LeistungsBez").Value.Contains("Fremd-RG") AndAlso r.Cells("Anzahl").Value <> 0 AndAlso IsNumeric(r.Cells("Preis").Value) Then
Dim OFFERT_RMC As Boolean = False
Dim OFFERT_FREMD As Boolean = False
If Not IsDBNull(r.Cells("RMC").Value) AndAlso r.Cells("RMC").Value IsNot Nothing Then OFFERT_RMC = r.Cells("RMC").Value
If Not IsDBNull(r.Cells("Fremd").Value) AndAlso r.Cells("Fremd").Value IsNot Nothing Then OFFERT_FREMD = r.Cells("Fremd").Value
If OFFERT_FREMD AndAlso r.Cells("Anzahl").Value <> 0 AndAlso IsNumeric(r.Cells("Preis").Value) Then
containFremd = True
bearbNrFremd = IIf(Not IsDBNull(r.Cells("BGebLeistungsNr").Value), r.Cells("BGebLeistungsNr").Value, 0)
minBetragFremd = IIf(Not IsDBNull(r.Cells("BGebMinBetrag").Value), r.Cells("BGebMinBetrag").Value, 0)
sumOffertFremd = Math.Round(r.Cells("Anzahl").Value * CDbl(r.Cells("Preis").Value * r.Cells("BGebProzent").Value), 2)
End If
If r.Cells("LeistungsBez").Value.Contains("RMC-RG") AndAlso r.Cells("Anzahl").Value <> 0 AndAlso IsNumeric(r.Cells("Preis").Value) Then
If OFFERT_RMC AndAlso r.Cells("Anzahl").Value <> 0 AndAlso IsNumeric(r.Cells("Preis").Value) Then
containRMC = True
bearbNrRMC = IIf(Not IsDBNull(r.Cells("BGebLeistungsNr").Value), r.Cells("BGebLeistungsNr").Value, 0)
sumOffertRMC = Math.Round(r.Cells("Anzahl").Value * CDbl(r.Cells("Preis").Value * r.Cells("BGebProzent").Value), 2)
@@ -1443,11 +1449,22 @@ Public Class usrCntlFaktAbrechnung
Dim preistaffelIsSet As Boolean = False
For Each r In dgvOfferteDetailsUebersicht.Rows
If r.Cells("Anzahl").Value <> 0 And r.Cells("Preis").Value <> 0 AndAlso IsNumeric(r.Cells("Preis").Value) AndAlso r.Cells("LeistungsNr").Value <> bearbNrRMC Then
Dim isMWSTBearb As Boolean = False
If Not preistaffelIsSet Then setMWSTABRfromSPEDinPOS(r, landNr, landBez, summeRMC, summeFremd, (containRMC AndAlso containFremd), posSet, preistaffelIsSet, antrag, isVZ, True, sumOffertRMC, minBetragRMC, sumOffertFremd, minBetragFremd)
Select Case r.Cells("LeistungsNr").Value
Case 124, 125, 126, 117, 118, 119, bearbNrRMC : isMWSTBearb = True
End Select
If r IsNot Nothing AndAlso r.Cells("Anzahl").Value <> 0 AndAlso IsNumeric(r.Cells("Preis").Value) AndAlso r.Cells("Preis").Value <> 0 AndAlso isMWSTBearb Then 'r.Cells("LeistungsNr").Value <> bearbNrRMC AndAlso
If Not preistaffelIsSet Then
setMWSTABRfromSPEDinPOS(r, landNr, landBez, summeRMC, summeFremd, (containRMC AndAlso containFremd), posSet, preistaffelIsSet, antrag, isVZ, True, sumOffertRMC, minBetragRMC, sumOffertFremd, minBetragFremd)
End If
'If posSet Then Exit For
End If
@@ -2674,9 +2691,12 @@ Public Class usrCntlFaktAbrechnung
If (BGebLeistungsNr > 0 AndAlso BGebProzent > 0 AndAlso BGebBgl <> 0) Then
Dim minBetragRMCUsed As Boolean = False
Dim curBGebMinBetrag = BGebMinBetrag
Dim OFFERT_VZ As Boolean = False
Dim OFFERT_RMC As Boolean = False
Dim OFFERT_FREMD As Boolean = False
Dim curBGebErrBetrag As Double = Math.Round(BGebBgl * BGebProzent, 1)
Dim curBGebBetrag As Double = 0
curBGebBetrag = curBGebErrBetrag
@@ -2688,16 +2708,20 @@ Public Class usrCntlFaktAbrechnung
curBGebMinBetrag = 0 - curBGebMinBetrag 'Vorzeichen in Plus ändern.
End If
If Not IsDBNull(r.Cells("VZ").Value) AndAlso r.Cells("VZ").Value IsNot Nothing Then OFFERT_VZ = r.Cells("VZ").Value
If Not IsDBNull(r.Cells("RMC").Value) AndAlso r.Cells("RMC").Value IsNot Nothing Then OFFERT_RMC = r.Cells("RMC").Value
If Not IsDBNull(r.Cells("Fremd").Value) AndAlso r.Cells("Fremd").Value IsNot Nothing Then OFFERT_FREMD = r.Cells("Fremd").Value
'Größeren Betrag bereitstellen.
If curBGebErrBetrag > curBGebMinBetrag Then
curBGebBetrag = curBGebErrBetrag 'Errechneten Betrag verwenden
summeFremdBearb += If(r.Cells("LeistungsBez").Value.Contains("Fremd-RG"), curBGebErrBetrag, 0)
summeRMCBearb += If(r.Cells("LeistungsBez").Value.Contains("RMC-RG"), curBGebErrBetrag, 0)
summeFremdBearb += If(OFFERT_FREMD, curBGebErrBetrag, 0)
summeRMCBearb += If(OFFERT_RMC, curBGebErrBetrag, 0)
Else
curBGebBetrag = curBGebMinBetrag 'Mindestbetrag verwenden
summeFremdBearb += If(r.Cells("LeistungsBez").Value.Contains("Fremd-RG"), curBGebErrBetrag, 0)
summeRMCBearb += If(r.Cells("LeistungsBez").Value.Contains("Fremd-RG"), curBGebErrBetrag, 0)
minBetragRMCUsed = IIf(r.Cells("LeistungsBez").Value.Contains("Fremd-RG") OrElse r.Cells("LeistungsBez").Value.Contains("RMC-RG"), True, False)
summeFremdBearb += If(OFFERT_FREMD, curBGebErrBetrag, 0)
summeRMCBearb += If(OFFERT_FREMD, curBGebErrBetrag, 0)
minBetragRMCUsed = IIf(OFFERT_FREMD OrElse OFFERT_RMC, True, False)
End If
'Vorzeichen einstellen.

View File

@@ -113,7 +113,6 @@ Partial Class frmMDM_USTVAntrag
Me.dgvUSTVPositionen = New VERAG_PROG_ALLGEMEIN.MyDatagridview(Me.components)
Me.pnlAntragsPosDetails = New System.Windows.Forms.Panel()
Me.Panel2 = New System.Windows.Forms.Panel()
Me.UstCntlUSTV_AntragPosition1 = New SDL.ustCntlUSTV_AntragPosition()
Me.Panel4 = New System.Windows.Forms.Panel()
Me.cbxKIUploaddelete = New System.Windows.Forms.CheckBox()
Me.scanUSTVA = New VERAG_PROG_ALLGEMEIN.usrcntlPDFScan()
@@ -124,7 +123,6 @@ Partial Class frmMDM_USTVAntrag
Me.Panel3 = New System.Windows.Forms.Panel()
Me.dgvErstattungspositionen = New VERAG_PROG_ALLGEMEIN.MyDatagridview(Me.components)
Me.pnlErstattungsdetails = New System.Windows.Forms.Panel()
Me.UstCntlUSTV_AntragErstattungen1 = New SDL.ustCntlUSTV_ErstattungPosition()
Me.Panel1 = New System.Windows.Forms.Panel()
Me.Button2 = New System.Windows.Forms.Button()
Me.Button3 = New System.Windows.Forms.Button()
@@ -135,10 +133,14 @@ Partial Class frmMDM_USTVAntrag
Me.VorauszahlungToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
Me.AktivierenToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
Me.DeaktivierenToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
Me.FakturiertZurücksetzenToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
Me.ncs_Belege = New System.Windows.Forms.ContextMenuStrip(Me.components)
Me.ToolStripMenuItem1 = New System.Windows.Forms.ToolStripMenuItem()
Me.ToolStripMenuItem2 = New System.Windows.Forms.ToolStripMenuItem()
Me.ToolStripMenuItem3 = New System.Windows.Forms.ToolStripMenuItem()
Me.FakturiertToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
Me.UstCntlUSTV_AntragPosition1 = New SDL.ustCntlUSTV_AntragPosition()
Me.UstCntlUSTV_AntragErstattungen1 = New SDL.ustCntlUSTV_ErstattungPosition()
Me.pnlBottom.SuspendLayout()
CType(Me.pb_Beleg, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.picExcel, System.ComponentModel.ISupportInitialize).BeginInit()
@@ -1515,14 +1517,6 @@ Partial Class frmMDM_USTVAntrag
Me.Panel2.Size = New System.Drawing.Size(1438, 263)
Me.Panel2.TabIndex = 1
'
'UstCntlUSTV_AntragPosition1
'
Me.UstCntlUSTV_AntragPosition1.Dock = System.Windows.Forms.DockStyle.Fill
Me.UstCntlUSTV_AntragPosition1.Location = New System.Drawing.Point(154, 0)
Me.UstCntlUSTV_AntragPosition1.Name = "UstCntlUSTV_AntragPosition1"
Me.UstCntlUSTV_AntragPosition1.Size = New System.Drawing.Size(1282, 261)
Me.UstCntlUSTV_AntragPosition1.TabIndex = 0
'
'Panel4
'
Me.Panel4.BackColor = System.Drawing.Color.WhiteSmoke
@@ -1668,14 +1662,6 @@ Partial Class frmMDM_USTVAntrag
Me.pnlErstattungsdetails.Size = New System.Drawing.Size(1436, 261)
Me.pnlErstattungsdetails.TabIndex = 0
'
'UstCntlUSTV_AntragErstattungen1
'
Me.UstCntlUSTV_AntragErstattungen1.Dock = System.Windows.Forms.DockStyle.Fill
Me.UstCntlUSTV_AntragErstattungen1.Location = New System.Drawing.Point(154, 0)
Me.UstCntlUSTV_AntragErstattungen1.Name = "UstCntlUSTV_AntragErstattungen1"
Me.UstCntlUSTV_AntragErstattungen1.Size = New System.Drawing.Size(1280, 259)
Me.UstCntlUSTV_AntragErstattungen1.TabIndex = 2
'
'Panel1
'
Me.Panel1.BackColor = System.Drawing.Color.WhiteSmoke
@@ -1733,15 +1719,15 @@ Partial Class frmMDM_USTVAntrag
'
'cns_vorauszahlen
'
Me.cns_vorauszahlen.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.VorauszahlungToolStripMenuItem})
Me.cns_vorauszahlen.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.VorauszahlungToolStripMenuItem, Me.FakturiertZurücksetzenToolStripMenuItem})
Me.cns_vorauszahlen.Name = "cns_vorauszahlen"
Me.cns_vorauszahlen.Size = New System.Drawing.Size(152, 26)
Me.cns_vorauszahlen.Size = New System.Drawing.Size(212, 70)
'
'VorauszahlungToolStripMenuItem
'
Me.VorauszahlungToolStripMenuItem.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.AktivierenToolStripMenuItem, Me.DeaktivierenToolStripMenuItem})
Me.VorauszahlungToolStripMenuItem.Name = "VorauszahlungToolStripMenuItem"
Me.VorauszahlungToolStripMenuItem.Size = New System.Drawing.Size(151, 22)
Me.VorauszahlungToolStripMenuItem.Size = New System.Drawing.Size(211, 22)
Me.VorauszahlungToolStripMenuItem.Text = "Vorauszahlung"
'
'AktivierenToolStripMenuItem
@@ -1756,31 +1742,60 @@ Partial Class frmMDM_USTVAntrag
Me.DeaktivierenToolStripMenuItem.Size = New System.Drawing.Size(138, 22)
Me.DeaktivierenToolStripMenuItem.Text = "deaktivieren"
'
'FakturiertZurücksetzenToolStripMenuItem
'
Me.FakturiertZurücksetzenToolStripMenuItem.Name = "FakturiertZurücksetzenToolStripMenuItem"
Me.FakturiertZurücksetzenToolStripMenuItem.Size = New System.Drawing.Size(211, 22)
Me.FakturiertZurücksetzenToolStripMenuItem.Text = "abgerechnet zurücksetzen"
'
'ncs_Belege
'
Me.ncs_Belege.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.ToolStripMenuItem1})
Me.ncs_Belege.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.ToolStripMenuItem1, Me.FakturiertToolStripMenuItem})
Me.ncs_Belege.Name = "cns_vorauszahlen"
Me.ncs_Belege.Size = New System.Drawing.Size(181, 48)
Me.ncs_Belege.Size = New System.Drawing.Size(196, 48)
'
'ToolStripMenuItem1
'
Me.ToolStripMenuItem1.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.ToolStripMenuItem2, Me.ToolStripMenuItem3})
Me.ToolStripMenuItem1.Name = "ToolStripMenuItem1"
Me.ToolStripMenuItem1.Size = New System.Drawing.Size(180, 22)
Me.ToolStripMenuItem1.Size = New System.Drawing.Size(195, 22)
Me.ToolStripMenuItem1.Text = "Vorauszahlung"
'
'ToolStripMenuItem2
'
Me.ToolStripMenuItem2.Name = "ToolStripMenuItem2"
Me.ToolStripMenuItem2.Size = New System.Drawing.Size(180, 22)
Me.ToolStripMenuItem2.Size = New System.Drawing.Size(138, 22)
Me.ToolStripMenuItem2.Text = "aktivieren"
'
'ToolStripMenuItem3
'
Me.ToolStripMenuItem3.Name = "ToolStripMenuItem3"
Me.ToolStripMenuItem3.Size = New System.Drawing.Size(180, 22)
Me.ToolStripMenuItem3.Size = New System.Drawing.Size(138, 22)
Me.ToolStripMenuItem3.Text = "deaktivieren"
'
'FakturiertToolStripMenuItem
'
Me.FakturiertToolStripMenuItem.Name = "FakturiertToolStripMenuItem"
Me.FakturiertToolStripMenuItem.Size = New System.Drawing.Size(195, 22)
Me.FakturiertToolStripMenuItem.Text = "Fakturiert zurücksetzen"
Me.FakturiertToolStripMenuItem.Visible = False
'
'UstCntlUSTV_AntragPosition1
'
Me.UstCntlUSTV_AntragPosition1.Dock = System.Windows.Forms.DockStyle.Fill
Me.UstCntlUSTV_AntragPosition1.Location = New System.Drawing.Point(154, 0)
Me.UstCntlUSTV_AntragPosition1.Name = "UstCntlUSTV_AntragPosition1"
Me.UstCntlUSTV_AntragPosition1.Size = New System.Drawing.Size(1282, 261)
Me.UstCntlUSTV_AntragPosition1.TabIndex = 0
'
'UstCntlUSTV_AntragErstattungen1
'
Me.UstCntlUSTV_AntragErstattungen1.Dock = System.Windows.Forms.DockStyle.Fill
Me.UstCntlUSTV_AntragErstattungen1.Location = New System.Drawing.Point(154, 0)
Me.UstCntlUSTV_AntragErstattungen1.Name = "UstCntlUSTV_AntragErstattungen1"
Me.UstCntlUSTV_AntragErstattungen1.Size = New System.Drawing.Size(1280, 259)
Me.UstCntlUSTV_AntragErstattungen1.TabIndex = 2
'
'frmMDM_USTVAntrag
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
@@ -1942,4 +1957,6 @@ Partial Class frmMDM_USTVAntrag
Friend WithEvents ToolStripMenuItem2 As ToolStripMenuItem
Friend WithEvents ToolStripMenuItem3 As ToolStripMenuItem
Friend WithEvents cbxSicherheit As CheckBox
Friend WithEvents FakturiertToolStripMenuItem As ToolStripMenuItem
Friend WithEvents FakturiertZurücksetzenToolStripMenuItem As ToolStripMenuItem
End Class

View File

@@ -3424,9 +3424,9 @@ Public Class frmMDM_USTVAntrag
If sender Is dgvUSTVPositionen Then
If dgvUSTVPositionen.SelectedRows.Count > 0 Then
If VERAG_PROG_ALLGEMEIN.cBerechtignunen.CHECK_BERECHTIGUNG_bool("MDM_USTVA_bearbeiten", Me.FindForm) OrElse VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM Then
cns_vorauszahlen.Show(Cursor.Position)
End If
End If
End If
@@ -3439,6 +3439,8 @@ Public Class frmMDM_USTVAntrag
Private Sub AktivierenToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles AktivierenToolStripMenuItem.Click
If VERAG_PROG_ALLGEMEIN.cBerechtignunen.CHECK_BERECHTIGUNG_bool("MDM_USTVA_bearbeiten", Me.FindForm) OrElse VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM Then
If vbYes = MsgBox("Möchten Sie die Vorauszahlung der markierten Positionen setzen?", vbYesNoCancel) Then
For Each r As DataGridViewRow In dgvUSTVPositionen.SelectedRows
@@ -3461,11 +3463,16 @@ Public Class frmMDM_USTVAntrag
init()
End If
Else
MsgBox("NICHT BERECHTIGT")
End If
End Sub
Private Sub DeaktivierenToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles DeaktivierenToolStripMenuItem.Click
If VERAG_PROG_ALLGEMEIN.cBerechtignunen.CHECK_BERECHTIGUNG_bool("MDM_USTVA_bearbeiten", Me.FindForm) OrElse VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM Then
If vbYes = MsgBox("Möchten Sie die Vorauszahlung der markierten Positionen deaktiveren?", vbYesNoCancel) Then
For Each r As DataGridViewRow In dgvUSTVPositionen.SelectedRows
@@ -3494,6 +3501,11 @@ Public Class frmMDM_USTVAntrag
init()
End If
Else
MsgBox("NICHT BERECHTIGT")
End If
End Sub
Private Sub initScanUSTVA()
@@ -3548,8 +3560,41 @@ Public Class frmMDM_USTVAntrag
End Sub
Private Sub FakturiertZurücksetzenToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles FakturiertZurücksetzenToolStripMenuItem.Click
If VERAG_PROG_ALLGEMEIN.cBerechtignunen.CHECK_BERECHTIGUNG("MDM_Fakturierung", Me) = 0 OrElse VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM Then
If vbYes = MsgBox("Möchten Sie die bereits " & IIf(dgvUSTVPositionen.SelectedRows.Count > 1, " abgerechneten Positionen ", " abgerechnete Position ") & "zurücksetzen?" & vbNewLine & "Dies darf nur durchgeführt werden wenn der ursprüngliche Beleg storniert wurde!", vbYesNoCancel, "ACHTUNG") Then
Dim isSet As Boolean = False
For Each r As DataGridViewRow In dgvUSTVPositionen.SelectedRows
If Not IsDBNull(r.Cells("UStVPo_VZ").Value) AndAlso Not IsDBNull(r.Cells("UStVPo_VZ_RKID").Value) AndAlso IsNumeric(r.Cells("UStVPo_VZ_RKID").Value) Then 'nur noch nicht abgerech. dürfen gesetzt werden!
Dim USTV_POS = New VERAG_PROG_ALLGEMEIN.cUStVPositionen(UStVAn_ID, r.Cells("UStVPo_ID").Value)
If Not IsDBNull(USTV_POS.UStVPo_VZ_RKID) AndAlso USTV_POS.UStVPo_VZ = True Then
USTV_POS.UStVPo_VZ_RKID = Nothing
isSet = USTV_POS.SAVE()
End If
End If
Next
If isSet Then SQL.doSQL("UPDATE [tblUStVAntrag] SET UStVAn_VZoffen = 1 WHERE [UStVAn_ID] IN (SELECT distinct([UStVAn_ID]) FROM [tblUStVPositionen] WHERE isnull([UStVPo_VZ],0) = 1 and isnull([UStVPo_VZ_RKID],0) = 0)", "FMZOLL") 'Aktualisierung
init()
End If
Else
MsgBox("NICHT BERECHTIGT")
End If
End Sub
Private Sub mnuItemBelegeOpenPDF_Clicked(sender As Object, e As EventArgs)
ncs_Belege.Hide()
Dim item As ToolStripMenuItem = TryCast(sender, ToolStripMenuItem)