unisped VorlageProv

This commit is contained in:
2026-05-05 11:28:07 +02:00
parent d2f34d49c8
commit 925baf2818
3 changed files with 96 additions and 40 deletions

View File

@@ -565,15 +565,20 @@ Public Class cFakturierung
Case 21, 22, 23 Case 21, 22, 23
Dim VORL = RECHNUNG.POSITIONEN.FindAll(Function(x) (x.LeistungsNr = 700 Or x.LeistungsNr = 710)) Dim VORL = RECHNUNG.POSITIONEN.FindAll(Function(x) (x.LeistungsNr = 700 Or x.LeistungsNr = 710))
' If ZZKdZahlungszielVL <> ZZKdZahlungsziel Then ' If ZZKdZahlungszielVL <> ZZKdZahlungsziel Then
If VORL IsNot Nothing AndAlso VORL.Count > 0 Then
Select Case RECHNUNG.RechnungSprache ''Ab 01.05.2026 nciht mehr, da Vorlageprovision nicht mehr abzugsfähig ist!
Case "EN" : strText = strText.Replace("<Vorlageprovision>", "If payment is received by <Rechnungsdatum+ZZVL>, you can deduct the template commission charged. " & vbCrLf) If If(RECHNUNG.RechnungsDatum, Now) < CDate("01.05.2026") Then
Case Else : strText = strText.Replace("<Vorlageprovision>", "Bei Zahlungseingang bis zum <Rechnungsdatum+ZZVL> können Sie die verrechnete Vorlageprovision in Abzug bringen. " & vbCrLf) If VORL IsNot Nothing AndAlso VORL.Count > 0 Then
End Select Select Case RECHNUNG.RechnungSprache
Case "EN" : strText = strText.Replace("<Vorlageprovision>", "If payment is received by <Rechnungsdatum+ZZVL>, you can deduct the template commission charged. " & vbCrLf)
Case Else : strText = strText.Replace("<Vorlageprovision>", "Bei Zahlungseingang bis zum <Rechnungsdatum+ZZVL> können Sie die verrechnete Vorlageprovision in Abzug bringen. " & vbCrLf)
End Select
End If
End If End If
' End If ' End If
End Select End Select
strText.Replace("<Vorlageprovision>", "")
'strText = strZahlbar & vbNewLine & strText 'strText = strZahlbar & vbNewLine & strText
' Text in Rechnungskopfsatz übernehmen. ' Text in Rechnungskopfsatz übernehmen.
strText = strText.Replace("<Vorlageprovision>", "") strText = strText.Replace("<Vorlageprovision>", "")

View File

@@ -207,8 +207,6 @@ Public Class usrCntlATLAS_AnkunftsAnzeige
Dim saveDir = Application.StartupPath & "\Dakosy_SEND\" Dim saveDir = Application.StartupPath & "\Dakosy_SEND\"
If Not System.IO.Directory.Exists(saveDir) Then If Not System.IO.Directory.Exists(saveDir) Then
System.IO.Directory.CreateDirectory(saveDir) System.IO.Directory.CreateDirectory(saveDir)

View File

@@ -206,7 +206,7 @@ Public Class cVERAG_CustomsDeclarations
Parties = cVERAG_CustomsDeclarations_Parties.LOAD_BY_ZAID(za_Id) Parties = cVERAG_CustomsDeclarations_Parties.LOAD_BY_ZAID(za_Id)
Items = cVERAG_CustomsDeclarations_Item.LOAD_BY_ZAID(za_Id) Items = cVERAG_CustomsDeclarations_Item.LOAD_BY_ZAID(za_Id)
Duties = cVERAG_CustomsDeclarations_Duty.LOAD_BY_ZAID(za_Id) Duties = cVERAG_CustomsDeclarations_Duty.LOAD_HEAD_BY_ZAID(za_Id)
Documents = cVERAG_CustomsDeclarations_Document.LOAD_HEAD_BY_ZAID(za_Id) Documents = cVERAG_CustomsDeclarations_Document.LOAD_HEAD_BY_ZAID(za_Id)
Catch ex As Exception Catch ex As Exception
@@ -323,7 +323,7 @@ Public Class cVERAG_CustomsDeclarations
If loadAll Then If loadAll Then
CD.Parties = cVERAG_CustomsDeclarations_Parties.LOAD_BY_ZAID(CD.za_Id) CD.Parties = cVERAG_CustomsDeclarations_Parties.LOAD_BY_ZAID(CD.za_Id)
CD.Items = cVERAG_CustomsDeclarations_Item.LOAD_BY_ZAID(CD.za_Id, cbamWhereSnd) CD.Items = cVERAG_CustomsDeclarations_Item.LOAD_BY_ZAID(CD.za_Id, cbamWhereSnd)
CD.Duties = cVERAG_CustomsDeclarations_Duty.LOAD_BY_ZAID(CD.za_Id) CD.Duties = cVERAG_CustomsDeclarations_Duty.LOAD_HEAD_BY_ZAID(CD.za_Id)
CD.Documents = cVERAG_CustomsDeclarations_Document.LOAD_HEAD_BY_ZAID(CD.za_Id) CD.Documents = cVERAG_CustomsDeclarations_Document.LOAD_HEAD_BY_ZAID(CD.za_Id)
End If End If
@@ -371,7 +371,7 @@ Public Class cVERAG_CustomsDeclarations
ZA.Parties = cVERAG_CustomsDeclarations_Parties.LOAD_BY_ZAID(ZA.za_Id) ZA.Parties = cVERAG_CustomsDeclarations_Parties.LOAD_BY_ZAID(ZA.za_Id)
ZA.Items = cVERAG_CustomsDeclarations_Item.LOAD_BY_ZAID(ZA.za_Id) ZA.Items = cVERAG_CustomsDeclarations_Item.LOAD_BY_ZAID(ZA.za_Id)
ZA.Duties = cVERAG_CustomsDeclarations_Duty.LOAD_BY_ZAID(ZA.za_Id) ZA.Duties = cVERAG_CustomsDeclarations_Duty.LOAD_HEAD_BY_ZAID(ZA.za_Id)
ZA.Documents = cVERAG_CustomsDeclarations_Document.LOAD_HEAD_BY_ZAID(ZA.za_Id) ZA.Documents = cVERAG_CustomsDeclarations_Document.LOAD_HEAD_BY_ZAID(ZA.za_Id)
End If End If
@@ -411,7 +411,7 @@ Public Class cVERAG_CustomsDeclarations
ZA.Parties = cVERAG_CustomsDeclarations_Parties.LOAD_BY_ZAID(ZA.za_Id) ZA.Parties = cVERAG_CustomsDeclarations_Parties.LOAD_BY_ZAID(ZA.za_Id)
ZA.Items = cVERAG_CustomsDeclarations_Item.LOAD_BY_ZAID(ZA.za_Id) ZA.Items = cVERAG_CustomsDeclarations_Item.LOAD_BY_ZAID(ZA.za_Id)
ZA.Duties = cVERAG_CustomsDeclarations_Duty.LOAD_BY_ZAID(ZA.za_Id) ZA.Duties = cVERAG_CustomsDeclarations_Duty.LOAD_HEAD_BY_ZAID(ZA.za_Id)
ZA.Documents = cVERAG_CustomsDeclarations_Document.LOAD_HEAD_BY_ZAID(ZA.za_Id) ZA.Documents = cVERAG_CustomsDeclarations_Document.LOAD_HEAD_BY_ZAID(ZA.za_Id)
End If End If
@@ -572,13 +572,13 @@ Public Class cVERAG_CustomsDeclarations
' ) ' )
''========================================================= ''=========================================================
Else Else
'==================>> DIRECT <<========================= '==================>> DIRECT <<=========================
Try Try
If KD IsNot Nothing Then If KD IsNot Nothing Then
Dim ERW As New cKundenErweitert(KD.KundenNr) Dim ERW As New cKundenErweitert(KD.KundenNr)
Select Case ERW.kde_CBAM_Status Select Case ERW.kde_CBAM_Status
Case "", "50to" ' Nur hier wird eine Warnung gesendet!! -> WEnn der Kunde bereits Registriert ist, nicht notwendig. Case "", "50to" ' Nur hier wird eine Warnung gesendet!! -> WEnn der Kunde bereits Registriert ist, nicht notwendig.
Dim dateCBAM = If(If(za_ReleaseDate, za_DeclarationDate), Now) Dim dateCBAM = If(If(za_ReleaseDate, za_DeclarationDate), Now)
@@ -607,10 +607,10 @@ Public Class cVERAG_CustomsDeclarations
End If End If
'geprüft werden die bisherigen CBAM Waren im Jahr + die aktuelle Sendung 'geprüft werden die bisherigen CBAM Waren im Jahr + die aktuelle Sendung
If eigenmasseSumme_YEAR < Warn1 And (eigenmasseSumme_Shipment + eigenmasseSumme_YEAR) >= Warn1 Then If eigenmasseSumme_YEAR < Warn1 And (eigenmasseSumme_Shipment + eigenmasseSumme_YEAR) >= Warn1 Then
'--> WARN 1 überschritten '--> WARN 1 überschritten
WarnLevel = "1" WarnLevel = "1"
Schwellenwert = Warn1 Schwellenwert = Warn1
End If End If
'===========>>>> WARNUNG <<<<<<<================================= '===========>>>> WARNUNG <<<<<<<=================================
If WarnLevel <> "" Then If WarnLevel <> "" Then
@@ -677,13 +677,13 @@ Public Class cVERAG_CustomsDeclarations
End If End If
'================================================================ '================================================================
End Select End Select
End If End If
'========================================================= '=========================================================
Catch ex As Exception Catch ex As Exception
cErrorHandler.ERR(ex.Message, ex.StackTrace, Reflection.MethodInfo.GetCurrentMethod.Name) cErrorHandler.ERR(ex.Message, ex.StackTrace, Reflection.MethodInfo.GetCurrentMethod.Name)
End Try End Try
End If
End If End If
End If
Catch ex As Exception Catch ex As Exception
cErrorHandler.ERR(ex.Message, ex.StackTrace, Reflection.MethodInfo.GetCurrentMethod.Name) cErrorHandler.ERR(ex.Message, ex.StackTrace, Reflection.MethodInfo.GetCurrentMethod.Name)
End Try End Try
@@ -818,10 +818,14 @@ Public Class cVERAG_CustomsDeclarations
If za_Id <= 0 Then Return False If za_Id <= 0 Then Return False
cVERAG_CustomsDeclarations_Parties.REPLACE_ALL(za_Id, Parties) cVERAG_CustomsDeclarations_Parties.REPLACE_ALL(za_Id, Parties)
cVERAG_CustomsDeclarations_Duty.REPLACE_ALL(za_Id, Duties)
cVERAG_CustomsDeclarations_Document.REPLACE_HEAD(za_Id, Documents) cVERAG_CustomsDeclarations_Document.REPLACE_HEAD(za_Id, Documents)
' Items zuerst speichern, damit zaItem_Id für Item-Duties vorhanden ist
cVERAG_CustomsDeclarations_Item.REPLACE_ALL(za_Id, Items) cVERAG_CustomsDeclarations_Item.REPLACE_ALL(za_Id, Items)
' Nur Header-Duties speichern (zaDuty_zaItemId bleibt NULL)
cVERAG_CustomsDeclarations_Duty.REPLACE_HEAD(za_Id, Duties)
Return True Return True
End Function End Function
End Class End Class
@@ -991,6 +995,10 @@ Public Class cVERAG_CustomsDeclarations_Item
Public Property zaItem_Remarks As String Public Property zaItem_Remarks As String
Public Property Documents As New List(Of cVERAG_CustomsDeclarations_Document) Public Property Documents As New List(Of cVERAG_CustomsDeclarations_Document)
' Duties auf Positionsebene; werden mit zaDuty_zaItemId = zaItem_Id gespeichert
Public Property Duties As New List(Of cVERAG_CustomsDeclarations_Duty)
Public Property hasEntry As Boolean = False Public Property hasEntry As Boolean = False
Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL
@@ -1063,11 +1071,17 @@ Public Class cVERAG_CustomsDeclarations_Item
SQL.doSQL("DELETE FROM tblVERAG_CustomsDeclarations_Items WHERE zaItem_zaId=" & zaId, "FMZOLL") SQL.doSQL("DELETE FROM tblVERAG_CustomsDeclarations_Items WHERE zaItem_zaId=" & zaId, "FMZOLL")
SQL.doSQL("DELETE FROM tblVERAG_CustomsDeclarations_Documents WHERE zaDoc_zaId=" & zaId & " AND zaDoc_ItemId is not null", "FMZOLL") SQL.doSQL("DELETE FROM tblVERAG_CustomsDeclarations_Documents WHERE zaDoc_zaId=" & zaId & " AND zaDoc_ItemId is not null", "FMZOLL")
' Nur Item-Duties löschen; Header-Duties bleiben erhalten und werden separat gespeichert
SQL.doSQL("DELETE FROM tblVERAG_CustomsDeclarations_Duties WHERE zaDuty_zaId=" & zaId & " AND zaDuty_zaItemId IS NOT NULL", "FMZOLL")
If list Is Nothing Then Exit Sub
For Each it In list For Each it In list
it.zaItem_zaId = zaId it.zaItem_zaId = zaId
it.zaItem_Id = SQL.doSQLVarListID(it.zaItem_Id, it.getInsertCmd(), "FMZOLL", , it.getParameterList()) it.zaItem_Id = SQL.doSQLVarListID(it.zaItem_Id, it.getInsertCmd(), "FMZOLL", , it.getParameterList())
'MsgBox(it.zaItem_Id)
cVERAG_CustomsDeclarations_Document.INSERT_ITEM(it.zaItem_zaId, it.zaItem_Id, it.Documents) cVERAG_CustomsDeclarations_Document.INSERT_ITEM(it.zaItem_zaId, it.zaItem_Id, it.Documents)
cVERAG_CustomsDeclarations_Duty.INSERT_ITEM(it.zaItem_zaId, it.zaItem_Id, it.Duties)
Next Next
End Sub End Sub
@@ -1108,10 +1122,13 @@ Public Class cVERAG_CustomsDeclarations_Item
End Using End Using
End Using End Using
' ===== Documents NACHLADEN (pro Item) ===== ' ===== Documents und Duties NACHLADEN (pro Item) =====
For Each it In result For Each it In result
it.Documents = it.Documents =
cVERAG_CustomsDeclarations_Document.LOAD_ITEM_BY_ITEMID(zaId, it.zaItem_Id) cVERAG_CustomsDeclarations_Document.LOAD_ITEM_BY_ITEMID(zaId, it.zaItem_Id)
it.Duties =
cVERAG_CustomsDeclarations_Duty.LOAD_ITEM_BY_ITEMID(zaId, it.zaItem_Id)
Next Next
Catch ex As Exception Catch ex As Exception
@@ -1151,14 +1168,15 @@ Public Class cVERAG_CustomsDeclarations_Duty
Public Property zaDuty_Id As Integer Public Property zaDuty_Id As Integer
Public Property zaDuty_zaId As Integer Public Property zaDuty_zaId As Integer
' NULL = Duty auf Kopfebene; Wert = Duty gehört zur jeweiligen Position
Public Property zaDuty_zaItemId As Integer?
Public Property zaDuty_AccountType As String Public Property zaDuty_AccountType As String
Public Property zaDuty_AccountHeadCustoms As String Public Property zaDuty_AccountHeadCustoms As String
Public Property zaDuty_ApplicationType As String Public Property zaDuty_ApplicationType As String
Public Property zaDuty_AccountNo As String Public Property zaDuty_AccountNo As String
Public Property zaDuty_AccountEORI As String Public Property zaDuty_AccountEORI As String
Public Property zaDuty_AccountHolderName As String Public Property zaDuty_AccountHolderName As String
Public Property zaDuty_DutyType As String Public Property zaDuty_DutyType As String
@@ -1167,12 +1185,16 @@ Public Class cVERAG_CustomsDeclarations_Duty
Public Property zaDuty_AmountForeign As Decimal? Public Property zaDuty_AmountForeign As Decimal?
Public Property zaDuty_Currency As String Public Property zaDuty_Currency As String
Public Property zaDuty_LimitDate As Date? Public Property zaDuty_LimitDate As Date?
Public Property zaDuty_Prozentsatz As Decimal?
Public Property hasEntry As Boolean = False Public Property hasEntry As Boolean = False
Public Function getParameterList() As List(Of SQLVariable) Public Function getParameterList() As List(Of SQLVariable)
Return New List(Of SQLVariable) From { Return New List(Of SQLVariable) From {
New SQLVariable("zaDuty_Id", zaDuty_Id,, True), New SQLVariable("zaDuty_Id", zaDuty_Id,, True),
New SQLVariable("zaDuty_zaId", zaDuty_zaId), New SQLVariable("zaDuty_zaId", zaDuty_zaId),
New SQLVariable("zaDuty_zaItemId", zaDuty_zaItemId),
New SQLVariable("zaDuty_AccountType", zaDuty_AccountType), New SQLVariable("zaDuty_AccountType", zaDuty_AccountType),
New SQLVariable("zaDuty_AccountHeadCustoms", zaDuty_AccountHeadCustoms), New SQLVariable("zaDuty_AccountHeadCustoms", zaDuty_AccountHeadCustoms),
New SQLVariable("zaDuty_ApplicationType", zaDuty_ApplicationType), New SQLVariable("zaDuty_ApplicationType", zaDuty_ApplicationType),
@@ -1184,7 +1206,8 @@ Public Class cVERAG_CustomsDeclarations_Duty
New SQLVariable("zaDuty_AmountEUR", zaDuty_AmountEUR), New SQLVariable("zaDuty_AmountEUR", zaDuty_AmountEUR),
New SQLVariable("zaDuty_AmountForeign", zaDuty_AmountForeign), New SQLVariable("zaDuty_AmountForeign", zaDuty_AmountForeign),
New SQLVariable("zaDuty_Currency", zaDuty_Currency), New SQLVariable("zaDuty_Currency", zaDuty_Currency),
New SQLVariable("zaDuty_LimitDate", zaDuty_LimitDate) New SQLVariable("zaDuty_LimitDate", zaDuty_LimitDate),
New SQLVariable("zaDuty_Prozentsatz", zaDuty_Prozentsatz)
} }
End Function End Function
@@ -1203,40 +1226,70 @@ Public Class cVERAG_CustomsDeclarations_Duty
' ---------- DELETE + INSERT ---------- ' ---------- DELETE + INSERT ----------
Public Shared Sub REPLACE_ALL(zaId As Integer, list As List(Of cVERAG_CustomsDeclarations_Duty)) Public Shared Sub REPLACE_HEAD(zaId As Integer, list As List(Of cVERAG_CustomsDeclarations_Duty))
Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL
SQL.doSQL("DELETE FROM tblVERAG_CustomsDeclarations_Duties WHERE zaDuty_zaId=" & zaId, "FMZOLL") ' Nur Header-Duties löschen
SQL.doSQL("DELETE FROM tblVERAG_CustomsDeclarations_Duties WHERE zaDuty_zaId=" & zaId & " AND zaDuty_zaItemId IS NULL", "FMZOLL")
If list Is Nothing Then Exit Sub
For Each d In list For Each d In list
d.zaDuty_zaId = zaId d.zaDuty_zaId = zaId
d.zaDuty_zaItemId = Nothing
d.zaDuty_Id = SQL.doSQLVarListID(d.zaDuty_Id, d.getInsertCmd(), "FMZOLL", , d.getParameterList()) d.zaDuty_Id = SQL.doSQLVarListID(d.zaDuty_Id, d.getInsertCmd(), "FMZOLL", , d.getParameterList())
Next Next
End Sub End Sub
Public Shared Function LOAD_BY_ZAID(zaId As Integer) _ Public Shared Sub INSERT_ITEM(zaId As Integer, itemId As Integer, list As List(Of cVERAG_CustomsDeclarations_Duty))
As List(Of cVERAG_CustomsDeclarations_Duty) Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL
If list Is Nothing Then Exit Sub
For Each d In list
d.zaDuty_zaId = zaId
d.zaDuty_zaItemId = itemId
d.zaDuty_Id = SQL.doSQLVarListID(d.zaDuty_Id, d.getInsertCmd(), "FMZOLL", , d.getParameterList())
Next
End Sub
Public Shared Function LOAD_HEAD_BY_ZAID(zaId As Integer) As List(Of cVERAG_CustomsDeclarations_Duty)
Return LOAD_BY_WHERE(zaId, " AND zaDuty_zaItemId IS NULL")
End Function
Public Shared Function LOAD_ITEM_BY_ITEMID(zaId As Integer, itemId As Integer) As List(Of cVERAG_CustomsDeclarations_Duty)
Return LOAD_BY_WHERE(zaId, " AND zaDuty_zaItemId=" & itemId)
End Function
Public Shared Function LOAD_BY_ZAID(zaId As Integer) As List(Of cVERAG_CustomsDeclarations_Duty)
' Kompatibilität: lädt weiterhin alle Duties zur Anmeldung
Return LOAD_BY_WHERE(zaId, "")
End Function
Private Shared Function LOAD_BY_WHERE(zaId As Integer, Optional where As String = "") As List(Of cVERAG_CustomsDeclarations_Duty)
Dim result As New List(Of cVERAG_CustomsDeclarations_Duty) Dim result As New List(Of cVERAG_CustomsDeclarations_Duty)
Try Try
Using conn As SqlConnection = SQL.GetNewOpenConnectionFMZOLL() Using conn As SqlConnection = SQL.GetNewOpenConnectionFMZOLL()
Using cmd As New SqlCommand( Using cmd As New SqlCommand(
"SELECT * FROM tblVERAG_CustomsDeclarations_Duties WHERE zaDuty_zaId=@zaId", "SELECT * FROM tblVERAG_CustomsDeclarations_Duties WHERE zaDuty_zaId=@zaId " & where,
conn) conn)
cmd.Parameters.AddWithValue("@zaId", zaId) cmd.Parameters.AddWithValue("@zaId", zaId)
Using dr As SqlDataReader = cmd.ExecuteReader() Using dr As SqlDataReader = cmd.ExecuteReader()
While dr.Read() While dr.Read
Dim d As New cVERAG_CustomsDeclarations_Duty Dim d As New cVERAG_CustomsDeclarations_Duty
d.hasEntry = False d.hasEntry = False
' ===== DEINE LOAD-VORLAGE (1:1, nur in While) =====
For Each li In d.getParameterList() For Each li In d.getParameterList()
Dim pi As PropertyInfo = Dim pi As PropertyInfo =
d.GetType().GetProperty(li.Scalarvariable) d.GetType().GetProperty(li.Scalarvariable)
If pi Is Nothing Then Continue For
If dr.Item(li.Text) Is DBNull.Value Then If dr.Item(li.Text) Is DBNull.Value Then
pi.SetValue(d, Nothing) pi.SetValue(d, Nothing)
Else Else