Fakt, antrag, etc.

This commit is contained in:
2025-05-26 15:21:21 +02:00
parent ee5f4c578c
commit b58744fa1d
3 changed files with 98 additions and 29 deletions

View File

@@ -2066,6 +2066,7 @@ Public Class usrCntlFaktAbrechnung
End Select
Dim FIRMATMP = VERAG_PROG_ALLGEMEIN.cAllgemein.getFirmaFromFiliale2(cboFiliale._value)
kdFirmaRechnungAn._UseFIRMA = FIRMATMP
'If cboFiliale._value = "5701" AndAlso VERAG_PROG_ALLGEMEIN.cBerechtignunen.CHECK_BERECHTIGUNG_bool("AMBAR_ALLE_RECHNUNGSEMPFÄNGER", "SDL") Then kdFirmaRechnungAn._UseFIRMA = Nothing
kdFirmaAbsender._UseFIRMA = FIRMATMP
@@ -2347,7 +2348,6 @@ Public Class usrCntlFaktAbrechnung
Call przBS415(RECHNUNG) ' Bankspesen errechnen
'Me![SteuerpflichtigerGesamtbetrag] = 0.0#
'Me![SteuerfreierGesamtbetrag] = 0.0#
'Me![Abfertigungskosten] = 0.0#
@@ -2573,7 +2573,7 @@ Public Class usrCntlFaktAbrechnung
If o.LeistungsNr = BGebLeistungsNr Then
'Falls schon vorhanden...
Dim POS = RE.POSITIONEN.Find(Function(x) x.LeistungsNr = BGebLeistungsNr) 'And x.BerechnungsartNr = 9)
Dim POS = RE.POSITIONEN.Find(Function(x) x.LeistungsNr = BGebLeistungsNr And x.BerechnungsartNr = 9)
If POS Is Nothing Then
POS = New VERAG_PROG_ALLGEMEIN.cRechnungsausgangPositionen()
POS.Preis = 0
@@ -2615,6 +2615,89 @@ Public Class usrCntlFaktAbrechnung
End If
End Sub
Private Sub prBearbGeb_NEW(POS_ As cRechnungsausgangPositionen, OFFERTE As cOfferte, RE As cRechnungsausgang, BGebLeistungsNr As Integer, BGebProzent As Double, BGebMinBetrag As Double, BGebBgl As Integer)
If POS_.Anzahl <> 0 Then
If (BGebLeistungsNr > 0 AndAlso BGebProzent > 0 AndAlso BGebBgl <> 0) Then
Dim curBGebErrBetrag As Double = Math.Round(BGebBgl * BGebProzent, 1)
Dim curBGebMinBetrag = BGebMinBetrag
Dim curBGebBetrag As Double = 0
curBGebBetrag = curBGebErrBetrag
If curBGebErrBetrag < 0 Then
curBGebErrBetrag = 0 - curBGebErrBetrag 'Vorzeichen in Plus ändern.
End If
If curBGebMinBetrag < 0 Then
curBGebMinBetrag = 0 - curBGebMinBetrag 'Vorzeichen in Plus ändern.
End If
'Größeren Betrag bereitstellen.
If curBGebErrBetrag > curBGebMinBetrag Then
curBGebBetrag = curBGebErrBetrag 'Errechneten Betrag verwenden
Else
curBGebBetrag = curBGebMinBetrag 'Mindestbetrag verwenden
End If
'Vorzeichen einstellen.
If POS_.Preis < 0 Then
curBGebBetrag = 0 - curBGebBetrag 'Vorzeichen von Plus in Minus ändern.
End If
If SQL.DLookup("[BGebUStV]", "Leistungen", "[LeistungsNr] = '" & POS_.LeistungsNr & "'", "FMZOLL") Then
curBGebBetrag = 0 - curBGebBetrag 'Vorzeichen wechseln.
End If
For Each o In OFFERTE.POSITIONEN
If o.LeistungsNr = BGebLeistungsNr And o.BerechnungsartNr = 9 Then
'Falls schon vorhanden...
Dim POS = RE.POSITIONEN.Find(Function(x) x.LeistungsNr = BGebLeistungsNr And x.BerechnungsartNr = 9)
If POS Is Nothing Then
POS = New VERAG_PROG_ALLGEMEIN.cRechnungsausgangPositionen()
POS.Preis = 0
POS.SteuerpflichtigerBetrag = 0
POS.SteuerfreierBetrag = 0
Dim LEISTUNG As New VERAG_PROG_ALLGEMEIN.cLeistungen(o.LeistungsNr)
POS.Steuerpflichtig = LEISTUNG.Steuerpflichtig
POS.LeistungsNr = o.LeistungsNr
POS.LeistungsBez = o.LeistungsBez
POS.BerechnungsartNr = o.BerechnungsartNr
POS.Anzahl = 1
' POS.BGebLeistungsNr = BGebLeistungsNr
RE.POSITIONEN.Add(POS)
End If
POS.Preis += curBGebBetrag
'End If
If POS.Steuerpflichtig Then
POS.SteuerpflichtigerBetrag += curBGebBetrag
Else
POS.SteuerfreierBetrag += curBGebBetrag
End If
End If
Next
'Catch ex As Exception
' VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
'End Try
' Return False
'End Function
End If
End If
End Sub
@@ -4507,32 +4590,22 @@ Nächste_Textzeile_lesen:
Private Sub setMWSTABRfromSPEDinPOS(r As DataGridViewRow, POS As cRechnungsausgangPositionen, LandNr As String, LandBez As String, Optional antrag As cUSTVAntrag = Nothing, Optional isVZ As Boolean = False)
If SPEDBUCH IsNot Nothing AndAlso (SPEDBUCH.Abfertigungsart = 114 Or SPEDBUCH.Abfertigungsart = 115 Or SPEDBUCH.Abfertigungsart = 10) Then
Dim OFFERT_LAND = ""
Dim OFFERT_VZ = False
Dim OFFERT_RMC = False
Dim OFFERT_FREMD = False
Dim OFFERT_LeistungsBez = r.Cells("LeistungsBez").Value
If Not IsDBNull(r.Cells("Land").Value) AndAlso r.Cells("Land").Value IsNot Nothing AndAlso r.Cells("Land").Value <> "" Then
OFFERT_LAND = r.Cells("Land").Value
End If
If Not IsDBNull(r.Cells("Land").Value) AndAlso r.Cells("Land").Value IsNot Nothing AndAlso r.Cells("Land").Value <> "" Then OFFERT_LAND = r.Cells("Land").Value
If Not IsDBNull(r.Cells("VZ").Value) AndAlso r.Cells("VZ").Value IsNot Nothing Then
OFFERT_VZ = r.Cells("VZ").Value
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
End If
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 Not IsDBNull(r.Cells("Fremd").Value) AndAlso r.Cells("Fremd").Value IsNot Nothing Then
OFFERT_FREMD = r.Cells("Fremd").Value
End If
If OFFERT_LeistungsBez <> "" AndAlso OFFERT_LAND <> "" Then
@@ -4679,10 +4752,13 @@ mwst:
If r.Cells("BGebLeistungsNr").Value IsNot Nothing AndAlso Not IsDBNull(r.Cells("BGebLeistungsNr").Value) AndAlso r.Cells("BGebProzent").Value IsNot Nothing AndAlso Not IsDBNull(r.Cells("BGebProzent").Value) Then
Dim OffertNr As Integer = IIf(IsNumeric(RECHNUNG.OffertenNr), RECHNUNG.OffertenNr, (SPEDBUCH.Abfertigungsart - 100))
If OffertNr < 0 Then OffertNr = 15
Dim minBetag As Double = 0
minBetag = IIf(Not IsDBNull(r.Cells("BGebMinBetrag").Value), r.Cells("BGebMinBetrag").Value, 0)
Dim OFFERTE As New VERAG_PROG_ALLGEMEIN.cOfferte(IIf(RECHNUNG.RechnungsKundenNr > 0, RECHNUNG.RechnungsKundenNr, kdFirmaRechnungAn.KdNr), OffertNr, True)
Call prBearbGeb(POS, OFFERTE, RECHNUNG, r.Cells("BGebLeistungsNr").Value, r.Cells("BGebProzent").Value, POS.Preis * If(RECHNUNG.Vorzeichen = "-", -1, 1))
Call prBearbGeb_NEW(POS, OFFERTE, RECHNUNG, r.Cells("BGebLeistungsNr").Value, r.Cells("BGebProzent").Value, minBetag, POS.Preis * If(RECHNUNG.Vorzeichen = "-", -1, 1))
End If