fix CustomDecl.

This commit is contained in:
2026-10-22 10:46:38 +02:00
parent f8e11ee4d4
commit 5c4db84753
2 changed files with 30 additions and 11 deletions

View File

@@ -503,8 +503,15 @@ Public Class ustCntlUSTV_AntragPosition
Private Sub txtUSTBetrag_PreviewKeyDown(sender As Object, e As PreviewKeyDownEventArgs) Handles txtUSTBetrag.PreviewKeyDown, txtUSTBetragEUR.PreviewKeyDown, txtRgDatum.PreviewKeyDown, txtRgNr.PreviewKeyDown, txtUmrechnungskurs.PreviewKeyDown, sbLeistender.PreviewKeyDown, txtLeistungsbezeichnung.PreviewKeyDown
lblWarning.Text = ""
If e.KeyValue <> Keys.Tab Then Return
If Not CanEdit() Then Return
If Not CanEdit() Then
lblWarning.Text = "keine Berechtigung/bereits abgerech."
Return
End If
If Not _gridAktiv OrElse Me.FindForm Is Nothing Then Return
lblWarning.Text = ""
@@ -712,7 +719,17 @@ Public Class ustCntlUSTV_AntragPosition
Private Function CanEdit() As Boolean
Return VERAG_PROG_ALLGEMEIN.cBerechtignunen.CHECK_BERECHTIGUNG_bool("MDM_USTVA_bearbeiten", Me.FindForm)
Dim allowed As Boolean = False
allowed = VERAG_PROG_ALLGEMEIN.cBerechtignunen.CHECK_BERECHTIGUNG_bool("MDM_USTVA_bearbeiten", Me.FindForm)
If allowed Then
If UStV_POS.UStVPo_VZ_RKID IsNot Nothing AndAlso CInt(UStV_POS.UStVPo_VZ_RKID) > 0 Then
allowed = False
End If
End If
Return allowed
End Function

View File

@@ -601,8 +601,8 @@ Public Class cVERAG_CustomsDeclarations
Dim eigenmasseSumme_YEAR As Decimal = getCBAM_KG(vertretenerEORI, CDate("01.01." & dateCBAM.Year), CDate("31.12." & dateCBAM.Year), za_MRN) / 1000
Dim quarter As Integer = Math.Ceiling(dateCBAM.Month / 3.0)
Dim Country As String = If(CBAM_ITEMS.FirstOrDefault()?.zaItem_OriginCountry, "")
createOrUpdateKundenSicherheitseintrag(KD_IND, Country, vertretenerEORI, quarter, dateCBAM.Year)
Dim CountryOfOrigin As String = If(CBAM_ITEMS.FirstOrDefault()?.zaItem_OriginCountry, "")
createOrUpdateKundenSicherheitseintrag(KD_IND, CountryOfOrigin, vertretenerEORI, quarter, dateCBAM.Year)
'Prüft, ob Vertrag vorliegt:
@@ -686,9 +686,9 @@ Public Class cVERAG_CustomsDeclarations
Dim dateCBAM = If(If(za_ReleaseDate, za_DeclarationDate), Now)
Dim Country As String = If(CBAM_ITEMS.FirstOrDefault()?.zaItem_OriginCountry, "")
Dim CountryOfOrigin As String = If(CBAM_ITEMS.FirstOrDefault()?.zaItem_OriginCountry, "")
Dim quarter As Integer = Math.Ceiling(dateCBAM.Month / 3.0)
createOrUpdateKundenSicherheitseintrag(KD, Country, importerEORI, quarter, dateCBAM.Year)
createOrUpdateKundenSicherheitseintrag(KD, CountryOfOrigin, importerEORI, quarter, dateCBAM.Year)
Dim eigenmasseSumme_Shipment As Decimal = CBAM_ITEMS.Sum(Function(i) If(i.zaItem_NetMass, 0D)) / 1000
Dim eigenmasseSumme_YEAR As Decimal = getCBAM_KG(importerEORI, CDate("01.01." & dateCBAM.Year), CDate("31.12." & dateCBAM.Year)) / 1000
@@ -818,13 +818,13 @@ Public Class cVERAG_CustomsDeclarations
Return String.Join(", ", result)
End Function
Private Function createOrUpdateKundenSicherheitseintrag(KUNDE As cKunde, ImportCountry As String, EORI As String, cbamQquarter As Integer, cbamYear As Integer)
Private Function createOrUpdateKundenSicherheitseintrag(KUNDE As cKunde, CountryOfOrigin As String, EORI As String, cbamQquarter As Integer, cbamYear As Integer)
Dim von As Date
Dim bis As Date
Dim CBAMZertifikatKosten As Double = 0
If ImportCountry = "" Then Return False
If CountryOfOrigin = "" Then Return False
Select Case cbamQquarter
Case "1"
@@ -849,7 +849,7 @@ Public Class cVERAG_CustomsDeclarations
Dim EORI_ = {EORI}
Dim LIST As List(Of VERAG_PROG_ALLGEMEIN.cVERAG_CustomsDeclarations) = VERAG_PROG_ALLGEMEIN.cVERAG_CustomsDeclarations.LOAD_List_CBAM(EORI_, ImportCountry, von, bis,, True)
Dim LIST As List(Of VERAG_PROG_ALLGEMEIN.cVERAG_CustomsDeclarations) = VERAG_PROG_ALLGEMEIN.cVERAG_CustomsDeclarations.LOAD_List_CBAM(EORI_, CountryOfOrigin, von, bis,, True)
Dim grouped = From za In LIST
@@ -873,7 +873,9 @@ Public Class cVERAG_CustomsDeclarations
If grouped.Count < 1 Then
Return False
End If
Dim gesamtBetrag As Double = 0
Dim cost As Double = 0
@@ -886,7 +888,7 @@ Public Class cVERAG_CustomsDeclarations
gesamtBetrag += cost
Next
If gesamtBetrag > 0 Then
If gesamtBetrag <> 0 Then
Dim Kunde_Sicherheit As New cKundenSicherheiten(KUNDE.KundenNr, cbamQquarter, cbamYear)
If Kunde_Sicherheit.hasEntry Then