diff --git a/SDL/Fakturierung/usrCntlFaktAbrechnung.vb b/SDL/Fakturierung/usrCntlFaktAbrechnung.vb index 4aa90620..af7f6cb8 100644 --- a/SDL/Fakturierung/usrCntlFaktAbrechnung.vb +++ b/SDL/Fakturierung/usrCntlFaktAbrechnung.vb @@ -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 diff --git a/SDL/USTV/frmMDM_USTVAntrag.vb b/SDL/USTV/frmMDM_USTVAntrag.vb index 7ed7c17f..0bf430cd 100644 --- a/SDL/USTV/frmMDM_USTVAntrag.vb +++ b/SDL/USTV/frmMDM_USTVAntrag.vb @@ -3311,19 +3311,13 @@ Public Class frmMDM_USTVAntrag Else - Dim hasVZ = IIf(item.Text.Contains("_VZ"), True, False) + Dim hasVZ = IIf(item.Name.Contains("_VZ"), True, False) Dim f As New SDL.frmAbrechnungsMaskeEinzeln(USTV_ANTRAG.FilialenNr, USTV_ANTRAG.AbfertigungsNr, IIf(USTV_ANTRAG.UStVAn_ErstattungsbetragEUR >= 0, "AG", "AR"), hasVZ) f.Show(Me) End If - - - 'Dim f As New SDL.frmAbrechnungsMaskeEinzeln(item.Name) - 'f.Show(Me) - - End If End If diff --git a/SDL/kunden/frmKundenUebersichtZOLL.vb b/SDL/kunden/frmKundenUebersichtZOLL.vb index d96c6cf8..402e59c5 100644 --- a/SDL/kunden/frmKundenUebersichtZOLL.vb +++ b/SDL/kunden/frmKundenUebersichtZOLL.vb @@ -284,6 +284,8 @@ Public Class frmKundenUebersichtZOLL initAllgemein() + Dim isVerag360 As Boolean = False + If Not IsDBNull(VERAG_PROG_ALLGEMEIN.cAllgemein.MITARBEITER.mit_firmaFMZoll) AndAlso CInt(VERAG_PROG_ALLGEMEIN.cAllgemein.MITARBEITER.mit_firmaFMZoll) = 19 Then isVerag360 = True Me.tbcntrKundenDaten.Visible = True usrcntlKundenuebersicht.setKD(kdnr) @@ -295,7 +297,7 @@ Public Class frmKundenUebersichtZOLL 'initDGVAnhaenge() 'initDGVOffertenSperrliste() 'initSperre() - UsrCntlOfferte1.init(kdnr) + UsrCntlOfferte1.init(kdnr, isVerag360) UsrcntlFiskaluebersicht1.init(kdnr) RG_MONAT = CDate("01." & Now.Month & "." & Now.Year) '.AddMonths(-1) @@ -366,9 +368,6 @@ Public Class frmKundenUebersichtZOLL End If mnueFiskaluebersicht.Enabled = False - Dim isVerag360 As Boolean = False - If Not IsDBNull(VERAG_PROG_ALLGEMEIN.cAllgemein.MITARBEITER.mit_firmaFMZoll) AndAlso CInt(VERAG_PROG_ALLGEMEIN.cAllgemein.MITARBEITER.mit_firmaFMZoll) = 19 Then isVerag360 = True - UsrCntlOfferte1.init(-1, isVerag360) End If Else