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.