diff --git a/SDL/Classes/cEABeleg.vb b/SDL/Classes/cEABeleg.vb
index 9cc921ff..76246071 100644
--- a/SDL/Classes/cEABeleg.vb
+++ b/SDL/Classes/cEABeleg.vb
@@ -284,6 +284,8 @@ Public Class EABeleg
Property EC_daid As Integer = 0
Property FT_ReceiptReference As Object = Nothing
Property FT_ReceiptReference_Storno As Object = Nothing
+ Property FT_MissingSignature As Boolean = False
+ Property FT_setMissingSignatureFailed As Boolean = False
Property POS As New List(Of EABelegPositionen)
@@ -364,8 +366,13 @@ Public Class EABeleg
Me.ECZahlungsPerAPI = cSqlDb.checkNullReturnValue(dr.Item("ECZahlungsPerAPI"), Nothing)
Me.ECTerminalreturnCode = cSqlDb.checkNullReturnValue(dr.Item("ECTerminalreturnCode"), Nothing)
Me.EC_daid = cSqlDb.checkNullReturnValue(dr.Item("EC_daid"), Nothing)
+
+ 'Fiskaltrust
+
Me.FT_ReceiptReference = cSqlDb.checkNullReturnValue(dr.Item("FT_ReceiptReference"), Nothing)
Me.FT_ReceiptReference_Storno = cSqlDb.checkNullReturnValue(dr.Item("FT_ReceiptReference_Storno"), Nothing)
+ Me.FT_MissingSignature = cSqlDb.checkNullReturnValue(dr.Item("FT_MissingSignature"), False)
+ Me.FT_MissingSignature = cSqlDb.checkNullReturnValue(dr.Item("FT_setMissingSignatureFailed"), False)
If loadPosAswell Then POS = LOAD_POS_List(Mandant, Niederlassung, Benutzer, BelegNr, BelegDat)
' MsgBox(POS.Count)
@@ -551,8 +558,12 @@ Public Class EABeleg
list.Add(New VERAG_PROG_ALLGEMEIN.MyListItem2("ECZahlungsPerAPI", ECZahlungsPerAPI))
list.Add(New VERAG_PROG_ALLGEMEIN.MyListItem2("ECTerminalreturnCode", ECTerminalreturnCode))
list.Add(New VERAG_PROG_ALLGEMEIN.MyListItem2("EC_daid", EC_daid))
+
+ 'FISKALTRUST
list.Add(New VERAG_PROG_ALLGEMEIN.MyListItem2("FT_ReceiptReference", FT_ReceiptReference))
list.Add(New VERAG_PROG_ALLGEMEIN.MyListItem2("FT_ReceiptReference_Storno", FT_ReceiptReference_Storno))
+ list.Add(New VERAG_PROG_ALLGEMEIN.MyListItem2("FT_MissingSignature", FT_MissingSignature))
+ list.Add(New VERAG_PROG_ALLGEMEIN.MyListItem2("FT_setMissingSignatureFailed", FT_setMissingSignatureFailed))
'For Each p As System.Reflection.PropertyInfo In Me.GetType().GetProperties()
'If p.CanRead Then
diff --git a/SDL/Classes/cFiskaltrustClient_chilkat.vb b/SDL/Classes/cFiskaltrustClient_chilkat.vb
index 7a44006a..60153005 100644
--- a/SDL/Classes/cFiskaltrustClient_chilkat.vb
+++ b/SDL/Classes/cFiskaltrustClient_chilkat.vb
@@ -10,6 +10,7 @@ Public Class FtReceiptCases
' Test-/Nullbeleg
Public Const ZeroReceipt As Long = &H4445000000000002L
+ ' Kassenlebenszyklus
Public Const InitialOperation As Long = &H4445000000000003L
Public Const OutOfOperation As Long = &H4445000000000004L
@@ -22,6 +23,12 @@ Public Class FtReceiptCases
Public Const ImplicitTransaction As Long = &H100000000L
Public Const ReversalReceipt As Long = &H40000L
Public Const TrainingReceipt As Long = &H20000L
+ ' aktiviert den Late-Signing-Modus
+ Public Const FailedReceipt As Long = &H10000L
+
+ ' Receipt-Request:
+ ' bereits verarbeiteten Beleg anhand cbReceiptReference abrufen
+ Public Const ReceiptRequest As Long = &H800000000000L
End Class
@@ -44,6 +51,17 @@ Public Class FtJournalType
End Class
+Public Class ReceiptCaseIntern
+
+ Public Const VERKAUF As String = "Verkauf"
+ Public Const EINGANG As String = "Eingang"
+ Public Const AUSGANG As String = "Ausgang"
+ Public Const WIEDERHOLUNG As String = "Retry"
+
+End Class
+
+
+
Public Class FtPayItemCases
'DE
@@ -71,25 +89,31 @@ Public Class cFiskaltrustClient_chilkat
Private ReadOnly _cashboxId As String
Private ReadOnly _accessToken As String
Private ReadOnly _country As String
+ Private ReadOnly _isFiskaltrust As Boolean = False
Public Sub New(baseUrl As String, cashboxId As String, accessToken As String, country As String)
_baseUrl = baseUrl.TrimEnd("/"c)
_cashboxId = cashboxId
_accessToken = accessToken
_country = country
+
+ If _cashboxId <> "" AndAlso baseUrl <> "" AndAlso _accessToken <> "" AndAlso _country <> "" Then
+ _isFiskaltrust = True
+ Else
+ _isFiskaltrust = False
+ End If
+
End Sub
- Public Function SignReceipt(amount As Decimal, vat As Decimal, POS As List(Of EABelegPositionen), kindOfPayment As String, posSystemId As String, typOfReceiptCase As String) As String
-
- Dim payload As JsonObject = BuildPayloadReceipt(amount, vat, POS, kindOfPayment, posSystemId, typOfReceiptCase, "")
-
- Return SendChilkat(GetEndpoint("payment"), payload.Emit())
-
+ Public Function isFiskaltrust() As Boolean
+ Return _isFiskaltrust
End Function
- Public Function SignReceipt_test(posSystemId As String) As String
+
+
+ Public Function SignReceipt_test(posSystemId As String, TSEisOnline As Boolean) As String
Dim LIST = New List(Of EABelegPositionen)
Dim p = New EABelegPositionen
@@ -110,81 +134,134 @@ Public Class cFiskaltrustClient_chilkat
Dim vat = 0
Dim POS = LIST
Dim kindOfPayment = "Cash"
+ Try
+ Dim payload As JsonObject = BuildPayloadReceipt(amount, vat, POS, kindOfPayment, posSystemId, "Verkauf", "", TSEisOnline)
- Dim payload As JsonObject = BuildPayloadReceipt(amount, vat, POS, kindOfPayment, posSystemId, "Verkauf", "")
-
- Return SendChilkat(GetEndpoint("payment"), payload.Emit())
+ Return SendChilkat(GetEndpoint("payment"), payload.Emit())
+ Catch ex As Exception
+ VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
+ End Try
End Function
- Public Function ChancelReceipt(reference As String, amount As Decimal, vat As Decimal, POS As List(Of EABelegPositionen), kindOfPayment As String, posSystemId As String) As String
- Dim payload As JsonObject = BuildPayloadReceipt(amount, vat, POS, kindOfPayment, posSystemId, "Storno", reference)
- Return SendChilkat(GetEndpoint("storno"), payload.Emit())
+ Public Function ChancelReceipt_test(reference As String, posSystemId As String, TSEisOnline As Boolean) As String
+
+ Try
+ Dim LIST = New List(Of EABelegPositionen)
+ Dim p = New EABelegPositionen
+ p.Mandant = "VERA"
+ p.Niederlassung = "SUB"
+ p.Benutzer = 74
+ p.BelegDat = Now
+ p.BelegNr = 1
+ p.PreislistenNr = 1
+ p.PreislistenPos = 1
+ p.LeistungsNr = 300
+ p.LeistungsBez = "TEST"
+ p.Preis = 10
+ p.Anzahl = 1
+ LIST.Add(p)
+
+ Dim amount = 100
+ Dim vat = 0
+ Dim POS = LIST
+ Dim kindOfPayment = "Cash"
+
+ Dim payload As JsonObject = BuildPayloadReceipt(amount, vat, POS, kindOfPayment, posSystemId, "Storno", reference, TSEisOnline)
+
+ Return SendChilkat(GetEndpoint("storno"), payload.Emit())
+ Catch ex As Exception
+ VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
+ End Try
End Function
- Public Function ChancelReceipt_test(reference As String, posSystemId As String) As String
+ Public Function SignReceipt(amount As Decimal, vat As Decimal, POS As List(Of EABelegPositionen), kindOfPayment As String, posSystemId As String, typOfReceiptCase As String, reference As String, TESisOnline As Boolean) As String
+ Try
+ Dim payload As JsonObject = BuildPayloadReceipt(amount, vat, POS, kindOfPayment, posSystemId, typOfReceiptCase, reference, TESisOnline)
- Dim LIST = New List(Of EABelegPositionen)
- Dim p = New EABelegPositionen
- p.Mandant = "VERA"
- p.Niederlassung = "SUB"
- p.Benutzer = 74
- p.BelegDat = Now
- p.BelegNr = 1
- p.PreislistenNr = 1
- p.PreislistenPos = 1
- p.LeistungsNr = 300
- p.LeistungsBez = "TEST"
- p.Preis = 10
- p.Anzahl = 1
- LIST.Add(p)
+ Return SendChilkat(GetEndpoint("payment"), payload.Emit())
+ Catch ex As Exception
+ VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
+ End Try
- Dim amount = 100
- Dim vat = 0
- Dim POS = LIST
- Dim kindOfPayment = "Cash"
-
- Dim payload As JsonObject = BuildPayloadReceipt(amount, vat, POS, kindOfPayment, posSystemId, "Storno", reference)
-
- Return SendChilkat(GetEndpoint("storno"), payload.Emit())
End Function
-
Public Function SignNullReceipt(posSystemId As String) As String
- Return SendChilkat(GetEndpoint("payment"), BuildPayloadNullReceipt(posSystemId, _country).Emit())
+ Try
+ Return SendChilkat(GetEndpoint("payment"), BuildPayloadNullReceipt(posSystemId, _country).Emit())
+ Catch ex As Exception
+ VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
+ End Try
+ End Function
+
+ Public Function ChancelReceipt(reference As String, amount As Decimal, vat As Decimal, POS As List(Of EABelegPositionen), kindOfPayment As String, posSystemId As String, TSEisOnline As Boolean) As String
+ Try
+ Dim payload As JsonObject = BuildPayloadReceipt(amount, vat, POS, kindOfPayment, posSystemId, "Storno", reference, TSEisOnline)
+
+ Return SendChilkat(GetEndpoint("storno"), payload.Emit())
+ Catch ex As Exception
+ VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
+ End Try
End Function
Public Function SignOutOfOrderReceipt(posSystemId As String) As String
- Return SendChilkat(GetEndpoint("payment"), BuildPayloadOutOfOperationReceipt(posSystemId, _country).Emit())
+ Try
+ Return SendChilkat(GetEndpoint("payment"), BuildPayloadOutOfOperationReceipt(posSystemId, _country).Emit())
+ Catch ex As Exception
+ VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
+ End Try
End Function
- Public Function SignOInitialOperationReceipt(posSystemId As String) As String
- Return SendChilkat(GetEndpoint("payment"), BuildPayloadInitialOperationReceipt(posSystemId, _country).Emit())
+ Public Function SignTempOutOfOrderReceipt(posSystemId As String) As String
+ Try
+ Return SendChilkat(GetEndpoint("payment"), BuildPayloadOutOfOperationReceipt(posSystemId, _country).Emit())
+ Catch ex As Exception
+ VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
+ End Try
+ End Function
+
+ Public Function SignInitialOperationReceipt(posSystemId As String) As String
+ Try
+ Return SendChilkat(GetEndpoint("payment"), BuildPayloadInitialOperationReceipt(posSystemId, _country).Emit())
+ Catch ex As Exception
+ VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
+ End Try
End Function
Public Function SignClosingReceipt(receiptType As String, posSystemId As String, kind As String) As String
- Return SendChilkat(GetEndpoint("payment"), BuildPayloadClosingReceipt(receiptType, posSystemId, kind).Emit())
+ Try
+ Return SendChilkat(GetEndpoint("payment"), BuildPayloadClosingReceipt(receiptType, posSystemId, kind).Emit())
+ Catch ex As Exception
+ VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
+ End Try
End Function
Public Function Echo(kassenName As String) As String
+ Try
+ Dim json As New JsonObject()
+ json.UpdateString("Message", kassenName & " - VERBINDUNG OK")
- Dim json As New JsonObject()
- json.UpdateString("Message", kassenName & " - VERBINDUNG OK")
-
- Return SendChilkat(GetEndpoint("test"), json.Emit())
-
+ Return SendChilkat(GetEndpoint("test"), json.Emit())
+ Catch ex As Exception
+ VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
+ End Try
End Function
Public Function Journal(ftJournalType As Integer) As String
+ Try
- Dim endpoint = GetEndpoint("journal")
+ Dim endpoint = GetEndpoint("journal")
- endpoint &= "?type=" & ftJournalType
+ endpoint &= "?type=" & ftJournalType
- Return SendChilkat(endpoint, "")
+ Return SendChilkat(endpoint, "")
+
+ Catch ex As Exception
+ VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
+ End Try
End Function
@@ -289,9 +366,12 @@ Public Class cFiskaltrustClient_chilkat
Throw lastEx
+
+
+
End Function
- Private Function BuildPayloadReceipt(amount As Decimal, vat As Decimal, POS As List(Of EABelegPositionen), kindOfPayment As String, posSystemId As String, _receiptCase As String, _reference As String) As JsonObject
+ Private Function BuildPayloadReceipt(amount As Decimal, vat As Decimal, POS As List(Of EABelegPositionen), kindOfPayment As String, posSystemId As String, _receiptCase As String, _reference As String, TSEisOnline As Boolean) As JsonObject
Dim json As New JsonObject()
@@ -312,49 +392,64 @@ Public Class cFiskaltrustClient_chilkat
If _receiptCase = "Storno" Then
- ' New reference for the Storno receipt
json.UpdateString("cbReceiptReference", Guid.NewGuid().ToString())
-
- ' Reference to the original receipt from the database
json.UpdateString("cbPreviousReceiptReference", _reference)
- ' Storno = POS receipt + reversal + implicit transaction
- receipCase = FtReceiptCases.PosReceipt Or FtReceiptCases.ReversalReceipt Or FtReceiptCases.ImplicitTransaction
+ If TSEisOnline Then
+ receipCase = FtReceiptCases.PosReceipt Or FtReceiptCases.ReversalReceipt Or FtReceiptCases.ImplicitTransaction
+ Else
+ receipCase = FtReceiptCases.PosReceipt Or FtReceiptCases.ReversalReceipt Or FtReceiptCases.FailedReceipt Or FtReceiptCases.ImplicitTransaction
+ End If
+
+ ElseIf _receiptCase = "Retry" Then
+
+ 'Receipt-Request nach Kommunikationsfehler
+ 'dieselbe cbReceiptReference verwenden
+ 'dieselben cbChargeItems und cbPayItems mitsenden
+ 'optional dieselbe cbTerminalID
+
+ json.UpdateString("cbReceiptReference", _reference)
+ receipCase = FtReceiptCases.PosReceipt Or FtReceiptCases.ReceiptRequest
Else
' New reference for a normal receipt
json.UpdateString("cbReceiptReference", Guid.NewGuid().ToString())
-
- ' Normal sale
-
- 'Select Case _receiptCase
- ' Case "Eingang"
- ' receipCase = FtReceiptCases.CashIn Or FtReceiptCases.ImplicitTransaction
- ' Case "Ausgang"
- ' receipCase = FtReceiptCases.CashOut Or FtReceiptCases.ImplicitTransaction
- ' Case Else
- receipCase = FtReceiptCases.PosReceipt Or FtReceiptCases.ImplicitTransaction
- 'End Select
-
-
+ If TSEisOnline Then
+ receipCase = FtReceiptCases.PosReceipt Or FtReceiptCases.ImplicitTransaction
+ Else
+ receipCase = FtReceiptCases.PosReceipt Or FtReceiptCases.FailedReceipt Or FtReceiptCases.ImplicitTransaction
+ End If
End If
json.UpdateString("ftReceiptCase", receipCase.ToString())
-
-
Dim chargeItems = json.AppendArray("cbChargeItems")
For Each p In POS
If chargeItems.AddObjectAt(-1) Then
+
+
+ Dim quantity As Double = p.Anzahl
+ Dim unitPrice As Double = p.Preis
+ Dim lineAmount As Double = p.Betrag
+
+ 'bei Storno negieren (BEI DE nur einen Teil)!
+ 'To cancel a receipt, resend it with this flag added to the ftReceiptCase and inverse the cbPayItems OR cbChargeItems (This is not the same behavior as described in the general part — in Germany, this flag requires only one of cbPayItems or cbChargeItems to be negative, and both must not be negative at the same time)'
+ 'https://docs.fiskaltrust.cloud/docs/poscreators/middleware-doc/germany/reference-tables/ftreceiptcase
+
+ If _receiptCase = "Storno" Then
+ quantity = quantity * -1
+ lineAmount = lineAmount * -1
+ End If
+
Dim item As Chilkat.JsonObject = chargeItems.ObjectAt(chargeItems.Size - 1)
- item.UpdateInt("Quantity", p.Anzahl)
- item.UpdateNumber("Amount", p.Preis.ToString().Replace(",", "."))
- item.UpdateNumber("VATRate", vat.ToString().Replace(",", "."))
+ item.UpdateInt("Quantity", quantity)
+ item.UpdateNumber("Amount", lineAmount)
+ item.UpdateNumber("VATRate", vat)
item.UpdateString("Description", p.LeistungsBez)
Dim ChargeItemCase As Long
@@ -430,8 +525,6 @@ Public Class cFiskaltrustClient_chilkat
json.UpdateString("cbUser", "Admin")
json.UpdateString("ftReceiptCaseData", "")
-
-
Dim chargeItems = json.AppendArray("cbChargeItems")
Dim payItems = json.AppendArray("cbPayItems")
@@ -573,7 +666,14 @@ Public Class cFiskaltrustClient_chilkat
.ftReceiptIdentification = json.StringOf("ftReceiptIdentification")
.ftReceiptMoment = ftReceiptMoment.GetAsTimestamp(getAsLocal)
.ftState = json.StringOf("ftState")
- .ftBeleg_ID = beleg_temp.BelegNr
+
+ If beleg_temp Is Nothing Then
+ .ftBeleg_ID = -1
+ Else
+ .ftBeleg_ID = beleg_temp.BelegNr
+ End If
+
+
saved = .SAVE()
If saved AndAlso beleg_temp IsNot Nothing Then
@@ -594,8 +694,8 @@ Public Class cFiskaltrustClient_chilkat
Dim num As Integer = json.SizeOfArray("ftSignatures")
If num = 0 Then
- MsgBox("Signatureinheit liefert keine (gültige) Signatur, Signatureinheit ausgefallen!")
- Return True
+ MsgBox("Signatureinheit liefert keine (gültige) Signatur, Signatureinheit ausgefallen" & vbNewLine & "Beleg kann nachträglich signiert werden!")
+ Return False
End If
Dim Signatures As Chilkat.JsonArray = json.ArrayOf("ftSignatures")
@@ -714,15 +814,8 @@ Public Class cFiskaltrustClient_chilkat
End If
-
-
End Function
-
- Private Sub Log(message As String)
- Console.WriteLine(message)
- End Sub
-
Public Function PrettyPrintJson(jsonText As String) As String
Dim json As New Chilkat.JsonObject()
diff --git a/SDL/Classes/cRKSV.vb b/SDL/Classes/cRKSV.vb
index 0f51914b..9a7d3684 100644
--- a/SDL/Classes/cRKSV.vb
+++ b/SDL/Classes/cRKSV.vb
@@ -89,7 +89,7 @@ Public Class cRKSV
End Function
- Shared Function insertRKSVFiskaltrustAsync(ByVal kasse As cRKSV_Kasse, beleg_temp As EABeleg, ByVal RKSV_Beleg_Id As Integer, ByVal summeBRUTTO As Double, TEST As Boolean, ByRef QR_CodeString As String, ByRef LastJWS As String, ByRef typOfReceiptCase As String) As Boolean
+ Shared Function insertRKSVFiskaltrustAsync(ByVal kasse As cRKSV_Kasse, beleg_temp As EABeleg, ByVal RKSV_Beleg_Id As Integer, ByVal summeBRUTTO As Double, TEST As Boolean, ByRef QR_CodeString As String, ByRef LastJWS As String, ByRef typOfReceiptCase As String, Optional reference As String = "", Optional TSEisOnline As Boolean = True) As Boolean
Try
@@ -133,7 +133,7 @@ Public Class cRKSV
'End If
Else
Dim client As New cFiskaltrustClient_chilkat(kasse.rksv_FT_RestServiceURL, kasse.rksv_FT_CashboxID, kasse.rksv_FT_AccessToken, kasse.rksv_FT_Country)
- Dim result = client.SignReceipt(summeBRUTTO, steuersatz, beleg_temp.POS, kindOfPayment, kasse.rksv_id, typOfReceiptCase)
+ Dim result = client.SignReceipt(summeBRUTTO, steuersatz, beleg_temp.POS, kindOfPayment, kasse.rksv_id, typOfReceiptCase, reference, TSEisOnline)
If result <> "" Then
Return client.saveRKSV_FT(result, QR_CodeString, beleg_temp, False)
Else
@@ -968,7 +968,7 @@ Public Class cRKSV
End Try
Return False
End Function
- Shared Function stornoRKSV_FT(ByVal kasse As cRKSV_Kasse, ByVal beleg_temp As EABeleg, ByRef QR_CodeString As String, ByRef LastJWS As String, ByRef answer As String) As Boolean
+ Shared Function stornoRKSV_FT(ByVal kasse As cRKSV_Kasse, ByVal beleg_temp As EABeleg, ByRef QR_CodeString As String, ByRef LastJWS As String, ByRef answer As String, TSEisOnline As Boolean) As Boolean
Try
If beleg_temp.rksv_BelegId <= 0 Then
@@ -1013,7 +1013,7 @@ Public Class cRKSV
Else
Dim client As New cFiskaltrustClient_chilkat(kasse.rksv_FT_RestServiceURL, kasse.rksv_FT_CashboxID, kasse.rksv_FT_AccessToken, kasse.rksv_FT_Country)
- Dim result = client.ChancelReceipt(beleg_temp.FT_ReceiptReference, beleg_temp.rksv_umsatz, steuersatz, beleg_temp.POS, kindOfPayment, kasse.rksv_id)
+ Dim result = client.ChancelReceipt(beleg_temp.FT_ReceiptReference, beleg_temp.rksv_umsatz, steuersatz, beleg_temp.POS, kindOfPayment, kasse.rksv_id, TSEisOnline)
If result <> "" Then
client.saveRKSV_FT(result, QR_CodeString, beleg_temp, True)
Else
diff --git a/SDL/Fakturierung/cAutomailversand.vb b/SDL/Fakturierung/cAutomailversand.vb
index 767c9e86..bbc88c3f 100644
--- a/SDL/Fakturierung/cAutomailversand.vb
+++ b/SDL/Fakturierung/cAutomailversand.vb
@@ -404,6 +404,12 @@ Public Class cAutomailversand
Subject = Subject.Replace("%Belegtyp%", belegtyp)
Subject = Subject.Replace("%BelegNr%", txtRgNr)
+ If RECHNUNG IsNot Nothing Then
+ Subject = Subject.Replace("%FilialNr%%AbfertigungsNr%-%UnterNr%", RECHNUNG.FilialenNr & "-" & RECHNUNG.AbfertigungsNr & "-" & RECHNUNG.UnterNr)
+ Else
+ Subject = Subject.Replace("%FilialNr%%AbfertigungsNr%-%UnterNr%", "")
+ End If
+
TextHTML &= r.txt_text
TextHTML = TextHTML.Replace("%Belegtyp%", belegtyp)
diff --git a/SDL/Fakturierung/cFakturierung.vb b/SDL/Fakturierung/cFakturierung.vb
index 63659f44..22b04357 100644
--- a/SDL/Fakturierung/cFakturierung.vb
+++ b/SDL/Fakturierung/cFakturierung.vb
@@ -3058,6 +3058,9 @@ Public Class cFakturierung
Dim FIRMA As New VERAG_PROG_ALLGEMEIN.cFirmen(RECHNUNG.Firma_ID)
Dim desc As InvoiceDescriptor = InvoiceDescriptor.CreateInvoice(addYeartoRgNr(FIRMA.Firma_ID, RECHNUNG.Buchungsjahr) & RECHNUNG.RechnungsNr, RECHNUNG.RechnungsDatum, IIf(FIRMA.Firma_ID = 26, CurrencyCodes.GBP, CurrencyCodes.EUR))
+
+
+
Select Case RECHNUNG.BelegartenKz
Case "AR"
desc.Name = "SPEDITIONSRECHNUNG"
@@ -3108,29 +3111,34 @@ Public Class cFakturierung
' Optionally, to support Peppol-----------------------------
+ If RECHNUNG.FilialenNr > 0 AndAlso RECHNUNG.AbfertigungsNr > 0 Then
+ Dim lrn = RECHNUNG.FilialenNr & "/" & RECHNUNG.AbfertigungsNr
+ desc.AddAdditionalReferencedDocument(lrn, AdditionalReferencedDocumentTypeCode.ReferenceDocument)
+
+ End If
If Not IsDBNull(RECHNUNG.RechnungsUstIdNr) AndAlso RECHNUNG.RechnungsUstIdNr IsNot Nothing AndAlso Not IsDBNull(RECHNUNG.RechnungsUstIdKz) AndAlso RECHNUNG.RechnungsUstIdKz IsNot Nothing Then
- desc.AddBuyerTaxRegistration(RECHNUNG.RechnungsUstIdKz & RECHNUNG.RechnungsUstIdNr, TaxRegistrationSchemeID.VA)
- If vatBuyer Then
- desc.SetBuyerElectronicAddress(RECHNUNG.RechnungsUstIdKz & RECHNUNG.RechnungsUstIdNr, vatBuyer)
- desc.SetSellerElectronicAddress(FIRMA.Firma_UID.ToString.Replace("UID: ", ""), vatSeller)
+ desc.AddBuyerTaxRegistration(RECHNUNG.RechnungsUstIdKz & RECHNUNG.RechnungsUstIdNr, TaxRegistrationSchemeID.VA)
+ If vatBuyer Then
+ desc.SetBuyerElectronicAddress(RECHNUNG.RechnungsUstIdKz & RECHNUNG.RechnungsUstIdNr, vatBuyer)
+ desc.SetSellerElectronicAddress(FIRMA.Firma_UID.ToString.Replace("UID: ", ""), vatSeller)
+ End If
+
+ End If
+ '-----------------------------
+ desc.ActualDeliveryDate = (RECHNUNG.Abfertigungsdatum)
+
+ Dim steuerProzent As Double = SQL.DLookup(" isnull([Steuersatz %],0)", "[Steuertabelle] ", "[Steuerschlüssel]='" & checkNull(RECHNUNG.Steuerschlüssel) & "'", "FMZOLL", 0)
+ Dim steuerProzenFaktor As Double = 0
+ If steuerProzent > 0 AndAlso steuerProzent < 1 Then
+ steuerProzenFaktor = steuerProzent * 100
End If
- End If
- '-----------------------------
- desc.ActualDeliveryDate = (RECHNUNG.Abfertigungsdatum)
- Dim steuerProzent As Double = SQL.DLookup(" isnull([Steuersatz %],0)", "[Steuertabelle] ", "[Steuerschlüssel]='" & checkNull(RECHNUNG.Steuerschlüssel) & "'", "FMZOLL", 0)
- Dim steuerProzenFaktor As Double = 0
- If steuerProzent > 0 AndAlso steuerProzent < 1 Then
- steuerProzenFaktor = steuerProzent * 100
- End If
+ Dim sumNetto As Double = 0
+ For Each p In RECHNUNG.POSITIONEN
-
- Dim sumNetto As Double = 0
- For Each p In RECHNUNG.POSITIONEN
-
- Dim tradeLineItemNew As TradeLineItem = desc.AddTradeLineItem(
+ Dim tradeLineItemNew As TradeLineItem = desc.AddTradeLineItem(
name:=p.LeistungsBez,
billedQuantity:=Convert.ToDecimal(p.Anzahl),
unitCode:=QuantityCodes.C62, ' immer in Stück
@@ -3140,27 +3148,27 @@ Public Class cFakturierung
taxPercent:=IIf(p.Steuerpflichtig, Convert.ToDecimal(RECHNUNG.Steuersatz_Proz * 100), 0),
taxType:=IIf(p.Steuerpflichtig, TaxTypes.VAT, TaxTypes.VAT)
)
- Dim netUnitPrice = Convert.ToDecimal(p.Preis)
- Dim grossUnitPrice = IIf(p.Steuerpflichtig, Convert.ToDecimal(p.Preis * (1 + RECHNUNG.Steuersatz_Proz)), Convert.ToDecimal(p.Preis))
- Dim netPricePos = netUnitPrice * Convert.ToDecimal(p.Anzahl)
- sumNetto += netPricePos
- Next
+ Dim netUnitPrice = Convert.ToDecimal(p.Preis)
+ Dim grossUnitPrice = IIf(p.Steuerpflichtig, Convert.ToDecimal(p.Preis * (1 + RECHNUNG.Steuersatz_Proz)), Convert.ToDecimal(p.Preis))
+ Dim netPricePos = netUnitPrice * Convert.ToDecimal(p.Anzahl)
+ sumNetto += netPricePos
+ Next
- 'Summe aller Rechnungspositions-Nettobeträge der Rechnung
- Dim lineTotalAmont = sumNetto
- 'Der Gesamtbetrag der Umsatzsteuer für die Rechnung,
- 'IIf(RECHNUNG.SteuerpflichtigerGesamtbetrag <> 0, Math.Round(Convert.ToDecimal(RECHNUNG.SteuerpflichtigerGesamtbetrag) / (100 + steuerProzenFaktor) * steuerProzenFaktor, 2), 0) ??????????????????
- Dim taxTotalAmount = IIf(RECHNUNG.SteuerpflichtigerGesamtbetrag <> 0, Math.Round(Convert.ToDecimal(RECHNUNG.SteuerpflichtigerGesamtbetrag) / (100 + steuerProzenFaktor) * steuerProzenFaktor, 2, MidpointRounding.AwayFromZero), 0)
- ' Die Gesamtsumme der Rechnung ohne Umsatzsteuer ' RECHNUNG.SteuerfreierGesamtbetrag + RECHNUNG.SteuerpflichtigerGesamtbetrag + 0 - 0
- Dim taxBasisAmount = Convert.ToDecimal(RECHNUNG.SteuerfreierGesamtbetrag + RECHNUNG.SteuerpflichtigerGesamtbetrag + 0 - 0 - taxTotalAmount)
- 'Der Gesamtbetrag der Rechnung mit Umsatzsteuer
- 'Dim grandTotalAmount = Convert.ToDecimal(RECHNUNG.SteuerfreierGesamtbetrag + RECHNUNG.SteuerpflichtigerGesamtbetrag + taxTotalAmount)
- Dim grandTotalAmount = Convert.ToDecimal(RECHNUNG.SteuerfreierGesamtbetrag + RECHNUNG.SteuerpflichtigerGesamtbetrag)
- 'Der ausstehende Betrag, um dessen Zahlung gebeten wird. Dieser Betrag ist der Rechnungsgesamtbetrag einschließlich Umsatzsteuer abzüglich des im Voraus gezahlten Betrages.Im Falle einer vollständig beglichenen Rechnung ist dieser Betrag gleich null. Der Betrag kann negativ sein; In diesem Fall schuldet der Verkäufer dem Käufer den Betrag
- 'Dim duePayableAmount = Convert.ToDecimal(RECHNUNG.SteuerfreierGesamtbetrag + RECHNUNG.SteuerpflichtigerGesamtbetrag + taxTotalAmount)
- Dim duePayableAmount = Convert.ToDecimal(RECHNUNG.SteuerfreierGesamtbetrag + RECHNUNG.SteuerpflichtigerGesamtbetrag)
+ 'Summe aller Rechnungspositions-Nettobeträge der Rechnung
+ Dim lineTotalAmont = sumNetto
+ 'Der Gesamtbetrag der Umsatzsteuer für die Rechnung,
+ 'IIf(RECHNUNG.SteuerpflichtigerGesamtbetrag <> 0, Math.Round(Convert.ToDecimal(RECHNUNG.SteuerpflichtigerGesamtbetrag) / (100 + steuerProzenFaktor) * steuerProzenFaktor, 2), 0) ??????????????????
+ Dim taxTotalAmount = IIf(RECHNUNG.SteuerpflichtigerGesamtbetrag <> 0, Math.Round(Convert.ToDecimal(RECHNUNG.SteuerpflichtigerGesamtbetrag) / (100 + steuerProzenFaktor) * steuerProzenFaktor, 2, MidpointRounding.AwayFromZero), 0)
+ ' Die Gesamtsumme der Rechnung ohne Umsatzsteuer ' RECHNUNG.SteuerfreierGesamtbetrag + RECHNUNG.SteuerpflichtigerGesamtbetrag + 0 - 0
+ Dim taxBasisAmount = Convert.ToDecimal(RECHNUNG.SteuerfreierGesamtbetrag + RECHNUNG.SteuerpflichtigerGesamtbetrag + 0 - 0 - taxTotalAmount)
+ 'Der Gesamtbetrag der Rechnung mit Umsatzsteuer
+ 'Dim grandTotalAmount = Convert.ToDecimal(RECHNUNG.SteuerfreierGesamtbetrag + RECHNUNG.SteuerpflichtigerGesamtbetrag + taxTotalAmount)
+ Dim grandTotalAmount = Convert.ToDecimal(RECHNUNG.SteuerfreierGesamtbetrag + RECHNUNG.SteuerpflichtigerGesamtbetrag)
+ 'Der ausstehende Betrag, um dessen Zahlung gebeten wird. Dieser Betrag ist der Rechnungsgesamtbetrag einschließlich Umsatzsteuer abzüglich des im Voraus gezahlten Betrages.Im Falle einer vollständig beglichenen Rechnung ist dieser Betrag gleich null. Der Betrag kann negativ sein; In diesem Fall schuldet der Verkäufer dem Käufer den Betrag
+ 'Dim duePayableAmount = Convert.ToDecimal(RECHNUNG.SteuerfreierGesamtbetrag + RECHNUNG.SteuerpflichtigerGesamtbetrag + taxTotalAmount)
+ Dim duePayableAmount = Convert.ToDecimal(RECHNUNG.SteuerfreierGesamtbetrag + RECHNUNG.SteuerpflichtigerGesamtbetrag)
- desc.SetTotals(
+ desc.SetTotals(
lineTotalAmount:=Convert.ToDecimal(lineTotalAmont),
chargeTotalAmount:=0, 'Summe aller in der Rechnung enthaltenen Zuschläge der Dokumentenebene
allowanceTotalAmount:=0, 'Summe aller in der Rechnung enthaltenen Abschläge der Dokumenteneben
@@ -3173,96 +3181,96 @@ Public Class cFakturierung
)
- desc.AddTradePaymentTerms(RECHNUNG.TextZZ, zahlungszieldatum)
+ desc.AddTradePaymentTerms(RECHNUNG.TextZZ, zahlungszieldatum)
- 'If RECHNUNG.TextZZ.ToString.Contains("Abbuchungsauftrag") Then
- ' desc.SetPaymentMeansSepaDirectDebit("", "")
- 'Else
- desc.SetPaymentMeans(PaymentMeansTypeCodes.SEPACreditTransfer, RECHNUNG.TextZZ)
- 'End If
+ 'If RECHNUNG.TextZZ.ToString.Contains("Abbuchungsauftrag") Then
+ ' desc.SetPaymentMeansSepaDirectDebit("", "")
+ 'Else
+ desc.SetPaymentMeans(PaymentMeansTypeCodes.SEPACreditTransfer, RECHNUNG.TextZZ)
+ 'End If
- Dim isReverseCharge = isReverseChargeSumme(FIRMA, RECHNUNG)
- If isReverseCharge Then
- Select Case RECHNUNG.RechnungSprache
- Case "EN" : desc.AddNote("The VAT liability is transferred to the recipient of the service (reverse charge system).", SubjectCodes.AAI)
- Case Else : desc.AddNote("Die Umsatzsteuerschuld geht auf den Leistungsempfänger über (Reverse Charge Verfahren).", SubjectCodes.AAI)
- End Select
- End If
+ Dim isReverseCharge = isReverseChargeSumme(FIRMA, RECHNUNG)
+ If isReverseCharge Then
+ Select Case RECHNUNG.RechnungSprache
+ Case "EN" : desc.AddNote("The VAT liability is transferred to the recipient of the service (reverse charge system).", SubjectCodes.AAI)
+ Case Else : desc.AddNote("Die Umsatzsteuerschuld geht auf den Leistungsempfänger über (Reverse Charge Verfahren).", SubjectCodes.AAI)
+ End Select
+ End If
- If RECHNUNG.SteuerfreierGesamtbetrag > 0 Then
- desc.AddApplicableTradeTax(Convert.ToDecimal(RECHNUNG.SteuerfreierGesamtbetrag), 0, 0, TaxTypes.VAT, TaxCategoryCodes.Z)
- End If
+ If RECHNUNG.SteuerfreierGesamtbetrag > 0 Then
+ desc.AddApplicableTradeTax(Convert.ToDecimal(RECHNUNG.SteuerfreierGesamtbetrag), 0, 0, TaxTypes.VAT, TaxCategoryCodes.Z)
+ End If
- If RECHNUNG.SteuerpflichtigerGesamtbetrag > 0 Then
- desc.AddApplicableTradeTax(Convert.ToDecimal(taxBasisAmount - RECHNUNG.SteuerfreierGesamtbetrag), Convert.ToDecimal(steuerProzenFaktor), Convert.ToDecimal(taxTotalAmount), TaxTypes.VAT, IIf(isReverseCharge, TaxCategoryCodes.AE, TaxCategoryCodes.S))
- End If
+ If RECHNUNG.SteuerpflichtigerGesamtbetrag > 0 Then
+ desc.AddApplicableTradeTax(Convert.ToDecimal(taxBasisAmount - RECHNUNG.SteuerfreierGesamtbetrag), Convert.ToDecimal(steuerProzenFaktor), Convert.ToDecimal(taxTotalAmount), TaxTypes.VAT, IIf(isReverseCharge, TaxCategoryCodes.AE, TaxCategoryCodes.S))
+ End If
- Select Case FIRMA.Firma_ID
- Case 21, 22, 23 '"UNISPED"
- If FIRMA.Firma_IBAN1 IsNot Nothing AndAlso FIRMA.Firma_BIC1 IsNot Nothing AndAlso FIRMA.Firma_Bankverbindung1 IsNot Nothing Then desc.AddCreditorFinancialAccount(IIf(FIRMA.Firma_IBAN1 IsNot Nothing, FIRMA.Firma_IBAN1.ToString.Replace("IBAN: ", ""), ""), IIf(FIRMA.Firma_BIC1 IsNot Nothing, FIRMA.Firma_BIC1.ToString.Replace("BIC: ", ""), ""),,, IIf(FIRMA.Firma_Bankverbindung1 IsNot Nothing, FIRMA.Firma_Bankverbindung1, ""))
- If FIRMA.Firma_IBAN2 IsNot Nothing AndAlso FIRMA.Firma_BIC2 IsNot Nothing AndAlso FIRMA.Firma_Bankverbindung2 IsNot Nothing Then desc.AddCreditorFinancialAccount(IIf(FIRMA.Firma_IBAN2 IsNot Nothing, FIRMA.Firma_IBAN2.ToString.Replace("IBAN: ", ""), ""), IIf(FIRMA.Firma_BIC2 IsNot Nothing, FIRMA.Firma_BIC2.ToString.Replace("BIC: ", ""), ""),,, IIf(FIRMA.Firma_Bankverbindung2 IsNot Nothing, FIRMA.Firma_Bankverbindung2, ""))
+ Select Case FIRMA.Firma_ID
+ Case 21, 22, 23 '"UNISPED"
+ If FIRMA.Firma_IBAN1 IsNot Nothing AndAlso FIRMA.Firma_BIC1 IsNot Nothing AndAlso FIRMA.Firma_Bankverbindung1 IsNot Nothing Then desc.AddCreditorFinancialAccount(IIf(FIRMA.Firma_IBAN1 IsNot Nothing, FIRMA.Firma_IBAN1.ToString.Replace("IBAN: ", ""), ""), IIf(FIRMA.Firma_BIC1 IsNot Nothing, FIRMA.Firma_BIC1.ToString.Replace("BIC: ", ""), ""),,, IIf(FIRMA.Firma_Bankverbindung1 IsNot Nothing, FIRMA.Firma_Bankverbindung1, ""))
+ If FIRMA.Firma_IBAN2 IsNot Nothing AndAlso FIRMA.Firma_BIC2 IsNot Nothing AndAlso FIRMA.Firma_Bankverbindung2 IsNot Nothing Then desc.AddCreditorFinancialAccount(IIf(FIRMA.Firma_IBAN2 IsNot Nothing, FIRMA.Firma_IBAN2.ToString.Replace("IBAN: ", ""), ""), IIf(FIRMA.Firma_BIC2 IsNot Nothing, FIRMA.Firma_BIC2.ToString.Replace("BIC: ", ""), ""),,, IIf(FIRMA.Firma_Bankverbindung2 IsNot Nothing, FIRMA.Firma_Bankverbindung2, ""))
- Case 26 'VERAG-UNISPED"
- If FIRMA.Firma_IBAN1 IsNot Nothing AndAlso FIRMA.Firma_BIC1 IsNot Nothing AndAlso FIRMA.Firma_Bankverbindung1 IsNot Nothing Then desc.AddCreditorFinancialAccount(IIf(FIRMA.Firma_IBAN1 IsNot Nothing, FIRMA.Firma_IBAN1.ToString.Replace("IBAN: ", ""), ""), IIf(FIRMA.Firma_BIC1 IsNot Nothing, FIRMA.Firma_BIC1.ToString.Replace("BIC: ", ""), ""),,, IIf(FIRMA.Firma_Bankverbindung1 IsNot Nothing, FIRMA.Firma_Bankverbindung1, ""))
- If FIRMA.Firma_IBAN2 IsNot Nothing AndAlso FIRMA.Firma_BIC2 IsNot Nothing AndAlso FIRMA.Firma_Bankverbindung2 IsNot Nothing Then desc.AddCreditorFinancialAccount(IIf(FIRMA.Firma_IBAN2 IsNot Nothing, FIRMA.Firma_IBAN2.ToString.Replace("IBAN: ", ""), ""), IIf(FIRMA.Firma_BIC2 IsNot Nothing, FIRMA.Firma_BIC2.ToString.Replace("BIC: ", ""), ""),,, IIf(FIRMA.Firma_Bankverbindung2 IsNot Nothing, FIRMA.Firma_Bankverbindung2, ""))
+ Case 26 'VERAG-UNISPED"
+ If FIRMA.Firma_IBAN1 IsNot Nothing AndAlso FIRMA.Firma_BIC1 IsNot Nothing AndAlso FIRMA.Firma_Bankverbindung1 IsNot Nothing Then desc.AddCreditorFinancialAccount(IIf(FIRMA.Firma_IBAN1 IsNot Nothing, FIRMA.Firma_IBAN1.ToString.Replace("IBAN: ", ""), ""), IIf(FIRMA.Firma_BIC1 IsNot Nothing, FIRMA.Firma_BIC1.ToString.Replace("BIC: ", ""), ""),,, IIf(FIRMA.Firma_Bankverbindung1 IsNot Nothing, FIRMA.Firma_Bankverbindung1, ""))
+ If FIRMA.Firma_IBAN2 IsNot Nothing AndAlso FIRMA.Firma_BIC2 IsNot Nothing AndAlso FIRMA.Firma_Bankverbindung2 IsNot Nothing Then desc.AddCreditorFinancialAccount(IIf(FIRMA.Firma_IBAN2 IsNot Nothing, FIRMA.Firma_IBAN2.ToString.Replace("IBAN: ", ""), ""), IIf(FIRMA.Firma_BIC2 IsNot Nothing, FIRMA.Firma_BIC2.ToString.Replace("BIC: ", ""), ""),,, IIf(FIRMA.Firma_Bankverbindung2 IsNot Nothing, FIRMA.Firma_Bankverbindung2, ""))
- Case 24 'AMBAR"
- If FIRMA.Firma_IBAN1 IsNot Nothing AndAlso FIRMA.Firma_BIC1 IsNot Nothing AndAlso FIRMA.Firma_Bankverbindung1 IsNot Nothing Then desc.AddCreditorFinancialAccount(IIf(FIRMA.Firma_IBAN1 IsNot Nothing, FIRMA.Firma_IBAN1.ToString.Replace("IBAN: ", ""), ""), IIf(FIRMA.Firma_BIC1 IsNot Nothing, FIRMA.Firma_BIC1.ToString.Replace("BIC: ", ""), ""),,, IIf(FIRMA.Firma_Bankverbindung1 IsNot Nothing, FIRMA.Firma_Bankverbindung1, ""))
- If FIRMA.Firma_IBAN2 IsNot Nothing AndAlso FIRMA.Firma_BIC2 IsNot Nothing AndAlso FIRMA.Firma_Bankverbindung2 IsNot Nothing Then desc.AddCreditorFinancialAccount(IIf(FIRMA.Firma_IBAN2 IsNot Nothing, FIRMA.Firma_IBAN2.ToString.Replace("IBAN: ", ""), ""), IIf(FIRMA.Firma_BIC2 IsNot Nothing, FIRMA.Firma_BIC2.ToString.Replace("BIC: ", ""), ""),,, IIf(FIRMA.Firma_Bankverbindung2 IsNot Nothing, FIRMA.Firma_Bankverbindung2, ""))
- 'Änderung Ticket_Nr.: 6983
- 'desc.AddCreditorFinancialAccount("TR90 0006 2001 6040 0009 0804 66", "TGBATRISXXX",,, "Garanti Bank Türkei – Euro Konto")
- desc.AddCreditorFinancialAccount("TR67 0006 2000 5440 0009 0513 57", "TGBATRISXXX",,, "Garanti Bank Türkei – Euro Konto")
+ Case 24 'AMBAR"
+ If FIRMA.Firma_IBAN1 IsNot Nothing AndAlso FIRMA.Firma_BIC1 IsNot Nothing AndAlso FIRMA.Firma_Bankverbindung1 IsNot Nothing Then desc.AddCreditorFinancialAccount(IIf(FIRMA.Firma_IBAN1 IsNot Nothing, FIRMA.Firma_IBAN1.ToString.Replace("IBAN: ", ""), ""), IIf(FIRMA.Firma_BIC1 IsNot Nothing, FIRMA.Firma_BIC1.ToString.Replace("BIC: ", ""), ""),,, IIf(FIRMA.Firma_Bankverbindung1 IsNot Nothing, FIRMA.Firma_Bankverbindung1, ""))
+ If FIRMA.Firma_IBAN2 IsNot Nothing AndAlso FIRMA.Firma_BIC2 IsNot Nothing AndAlso FIRMA.Firma_Bankverbindung2 IsNot Nothing Then desc.AddCreditorFinancialAccount(IIf(FIRMA.Firma_IBAN2 IsNot Nothing, FIRMA.Firma_IBAN2.ToString.Replace("IBAN: ", ""), ""), IIf(FIRMA.Firma_BIC2 IsNot Nothing, FIRMA.Firma_BIC2.ToString.Replace("BIC: ", ""), ""),,, IIf(FIRMA.Firma_Bankverbindung2 IsNot Nothing, FIRMA.Firma_Bankverbindung2, ""))
+ 'Änderung Ticket_Nr.: 6983
+ 'desc.AddCreditorFinancialAccount("TR90 0006 2001 6040 0009 0804 66", "TGBATRISXXX",,, "Garanti Bank Türkei – Euro Konto")
+ desc.AddCreditorFinancialAccount("TR67 0006 2000 5440 0009 0513 57", "TGBATRISXXX",,, "Garanti Bank Türkei – Euro Konto")
- Case 20 '"IMEX"
- If RECHNUNG.RechnungsLandKz = "TR" Then
- desc.AddCreditorFinancialAccount("TR84 0006 2001 6040 0009 0987 13", "",,, "Garanti Bank")
- Else
- If hasVK(RECHNUNG) Then
- desc.AddCreditorFinancialAccount("AT35 4480 0365 7822 0002", "VBOEATWWOOE",,, "Volksbank Oberösterreich AG")
+ Case 20 '"IMEX"
+ If RECHNUNG.RechnungsLandKz = "TR" Then
+ desc.AddCreditorFinancialAccount("TR84 0006 2001 6040 0009 0987 13", "",,, "Garanti Bank")
Else
- If hasEUSTZOLL(RECHNUNG.RechnungsNr) Then
- desc.AddCreditorFinancialAccount("AT62 4480 0365 7822 0001", "VBOEATWWOOE", )
+ If hasVK(RECHNUNG) Then
+ desc.AddCreditorFinancialAccount("AT35 4480 0365 7822 0002", "VBOEATWWOOE",,, "Volksbank Oberösterreich AG")
Else
- desc.AddCreditorFinancialAccount("TR84 0006 2001 6040 0009 0987 13", "VBOEATWWOOE", ,, "Volksbank Oberösterreich AG")
+ If hasEUSTZOLL(RECHNUNG.RechnungsNr) Then
+ desc.AddCreditorFinancialAccount("AT62 4480 0365 7822 0001", "VBOEATWWOOE", )
+ Else
+ desc.AddCreditorFinancialAccount("TR84 0006 2001 6040 0009 0987 13", "VBOEATWWOOE", ,, "Volksbank Oberösterreich AG")
+ End If
End If
End If
- End If
- Case 19
- If FIRMA.Firma_IBAN1 IsNot Nothing AndAlso FIRMA.Firma_BIC1 IsNot Nothing AndAlso FIRMA.Firma_Bankverbindung1 IsNot Nothing Then desc.AddCreditorFinancialAccount(IIf(FIRMA.Firma_IBAN1 IsNot Nothing, FIRMA.Firma_IBAN1.ToString.Replace("IBAN: ", ""), ""), IIf(FIRMA.Firma_BIC1 IsNot Nothing, FIRMA.Firma_BIC1.ToString.Replace("BIC: ", ""), ""),,, IIf(FIRMA.Firma_Bankverbindung1 IsNot Nothing, FIRMA.Firma_Bankverbindung1, ""))
+ Case 19
+ If FIRMA.Firma_IBAN1 IsNot Nothing AndAlso FIRMA.Firma_BIC1 IsNot Nothing AndAlso FIRMA.Firma_Bankverbindung1 IsNot Nothing Then desc.AddCreditorFinancialAccount(IIf(FIRMA.Firma_IBAN1 IsNot Nothing, FIRMA.Firma_IBAN1.ToString.Replace("IBAN: ", ""), ""), IIf(FIRMA.Firma_BIC1 IsNot Nothing, FIRMA.Firma_BIC1.ToString.Replace("BIC: ", ""), ""),,, IIf(FIRMA.Firma_Bankverbindung1 IsNot Nothing, FIRMA.Firma_Bankverbindung1, ""))
- Case Else 'VERAG,ATILLA
- If FIRMA.Firma_IBAN1 IsNot Nothing AndAlso FIRMA.Firma_BIC1 IsNot Nothing AndAlso FIRMA.Firma_Bankverbindung1 IsNot Nothing Then desc.AddCreditorFinancialAccount(IIf(FIRMA.Firma_IBAN1 IsNot Nothing, FIRMA.Firma_IBAN1.ToString.Replace("IBAN: ", ""), ""), IIf(FIRMA.Firma_BIC1 IsNot Nothing, FIRMA.Firma_BIC1.ToString.Replace("BIC: ", ""), ""),,, IIf(FIRMA.Firma_Bankverbindung1 IsNot Nothing, FIRMA.Firma_Bankverbindung1, ""))
- If FIRMA.Firma_IBAN2 IsNot Nothing AndAlso FIRMA.Firma_BIC2 IsNot Nothing AndAlso FIRMA.Firma_Bankverbindung2 IsNot Nothing Then desc.AddCreditorFinancialAccount(IIf(FIRMA.Firma_IBAN2 IsNot Nothing, FIRMA.Firma_IBAN2.ToString.Replace("IBAN: ", ""), ""), IIf(FIRMA.Firma_BIC2 IsNot Nothing, FIRMA.Firma_BIC2.ToString.Replace("BIC: ", ""), ""),,, IIf(FIRMA.Firma_Bankverbindung2 IsNot Nothing, FIRMA.Firma_Bankverbindung2, ""))
+ Case Else 'VERAG,ATILLA
+ If FIRMA.Firma_IBAN1 IsNot Nothing AndAlso FIRMA.Firma_BIC1 IsNot Nothing AndAlso FIRMA.Firma_Bankverbindung1 IsNot Nothing Then desc.AddCreditorFinancialAccount(IIf(FIRMA.Firma_IBAN1 IsNot Nothing, FIRMA.Firma_IBAN1.ToString.Replace("IBAN: ", ""), ""), IIf(FIRMA.Firma_BIC1 IsNot Nothing, FIRMA.Firma_BIC1.ToString.Replace("BIC: ", ""), ""),,, IIf(FIRMA.Firma_Bankverbindung1 IsNot Nothing, FIRMA.Firma_Bankverbindung1, ""))
+ If FIRMA.Firma_IBAN2 IsNot Nothing AndAlso FIRMA.Firma_BIC2 IsNot Nothing AndAlso FIRMA.Firma_Bankverbindung2 IsNot Nothing Then desc.AddCreditorFinancialAccount(IIf(FIRMA.Firma_IBAN2 IsNot Nothing, FIRMA.Firma_IBAN2.ToString.Replace("IBAN: ", ""), ""), IIf(FIRMA.Firma_BIC2 IsNot Nothing, FIRMA.Firma_BIC2.ToString.Replace("BIC: ", ""), ""),,, IIf(FIRMA.Firma_Bankverbindung2 IsNot Nothing, FIRMA.Firma_Bankverbindung2, ""))
- End Select
+ End Select
- Dim tmpPathZugpferd = VERAG_PROG_ALLGEMEIN.DATENVERVER_OPTIONS.getTMPPath("ZUGFeRD_Invoice_" & RECHNUNG.RechnungsNr, ".xml", True, False)
+ Dim tmpPathZugpferd = VERAG_PROG_ALLGEMEIN.DATENVERVER_OPTIONS.getTMPPath("ZUGFeRD_Invoice_" & RECHNUNG.RechnungsNr, ".xml", True, False)
- Using stream As New FileStream(tmpPathZugpferd, FileMode.Create, FileAccess.Write, FileShare.None)
- desc.Save(stream, ZUGFeRDVersion.Version20, Profile.Comfort)
- End Using
+ Using stream As New FileStream(tmpPathZugpferd, FileMode.Create, FileAccess.Write, FileShare.None)
+ desc.Save(stream, ZUGFeRDVersion.Version20, Profile.Comfort)
+ End Using
- Return tmpPathZugpferd
+ Return tmpPathZugpferd
- 'Dim stream As FileStream = New FileStream(tmpPathZugpferd, FileMode.Create, FileAccess.Write)
- 'desc.Save(stream, ZUGFeRDVersion.Version20, Profile.Comfort)
+ 'Dim stream As FileStream = New FileStream(tmpPathZugpferd, FileMode.Create, FileAccess.Write)
+ 'desc.Save(stream, ZUGFeRDVersion.Version20, Profile.Comfort)
- 'stream.Flush()
- 'stream.Close()
- 'Return tmpPathZugpferd
+ 'stream.Flush()
+ 'stream.Close()
+ 'Return tmpPathZugpferd
- ElseIf Not einzelrechnung AndAlso SR_DT IsNot Nothing Then
+ ElseIf Not einzelrechnung AndAlso SR_DT IsNot Nothing Then
- '---------------------------------------------------------------------------------
- '--------------------------------SAMMELRECHNUNG-----------------------------------
- '---------------------------------------------------------------------------------
+ '---------------------------------------------------------------------------------
+ '--------------------------------SAMMELRECHNUNG-----------------------------------
+ '---------------------------------------------------------------------------------
- Dim ROW As DataRow = SR_DT.Rows(0)
+ Dim ROW As DataRow = SR_DT.Rows(0)
Dim FIRMA As New VERAG_PROG_ALLGEMEIN.cFirmen(ROW("Firma_ID"))
Dim RECHNUNG_AD As New VERAG_PROG_ALLGEMEIN.cAdressen(ROW("RechnungsKundenNr"))
@@ -3297,6 +3305,17 @@ Public Class cFakturierung
End Select
+ If Not IsDBNull(ROW("FilialenNr")) AndAlso Not IsDBNull(ROW("AbfertigungsNr")) Then
+
+ Dim filialenNr As String = ROW("FilialenNr").ToString().Trim()
+ Dim abfertigungsNr As String = ROW("AbfertigungsNr").ToString().Trim()
+
+ If filialenNr <> String.Empty AndAlso abfertigungsNr <> String.Empty Then
+ Dim lrn As String = filialenNr & "/" & abfertigungsNr
+ desc.AddAdditionalReferencedDocument(lrn, AdditionalReferencedDocumentTypeCode.ReferenceDocument)
+ End If
+ End If
+
'Die „Berechnung BT-10“ bezieht sich auf das Feld BT-10 „Buyer reference“ (Käuferreferenz) in der elektronischen Rechnung, speziell im XRechnung-Standard. Dieses Feld dient zur Angabe der Leitweg-ID
'für öffentliche Auftraggeber oder anderer Referenzinformationen für interne Zuordnungsprozesse.
'Die Leitweg-ID ist in Deutschland eine Pflichtangabe für elektronische Rechnungen an die Bundesverwaltung und muss vom Rechnungssteller vom Auftraggeber erhalten werden.
diff --git a/SDL/Formulare/KDFormulare/frmFormulare.vb b/SDL/Formulare/KDFormulare/frmFormulare.vb
index 2f7ad9f8..ee05eec8 100644
--- a/SDL/Formulare/KDFormulare/frmFormulare.vb
+++ b/SDL/Formulare/KDFormulare/frmFormulare.vb
@@ -5,7 +5,9 @@ Imports System.Reflection
Imports System.Text.RegularExpressions
Imports System.Windows.Documents
Imports com.sun.tools.internal.ws.wsdl.document.mime
+Imports DAKOSY_Worker.Abgabenbescheid_008
Imports GrapeCity.ActiveReports
+Imports GrapeCity.DataVisualization.TypeScript
Imports itextsharp.text.pdf
Imports Microsoft.Office.Interop
Imports VERAG_PROG_ALLGEMEIN
@@ -1171,136 +1173,136 @@ Public Class frmFormulare
For Each c In MyFlowLayoutPanel1.Controls
- Dim pfadList As List(Of String) = FormularManagerNEU.genPDF(c,,,,, listMail)
- For Each pfad In pfadList
- If pfad <> "" Then list.Add(pfad)
- Next
+ Dim pfadList As List(Of String) = FormularManagerNEU.genPDF(c,,,,, listMail)
+ For Each pfad In pfadList
+ If pfad <> "" Then list.Add(pfad)
Next
+ Next
- Dim dest_path = ""
- If list.Count = 0 Then Me.Cursor = Cursors.Default : Exit Sub
+ Dim dest_path = ""
+ If list.Count = 0 Then Me.Cursor = Cursors.Default : Exit Sub
- If list.Count = 1 Then
- dest_path = list(0)
- Else
- dest_path = VERAG_PROG_ALLGEMEIN.DATENVERVER_OPTIONS.getTMPPath(VERAG_PROG_ALLGEMEIN.cAllgemein.FIRMA & attachmentName & ".pdf", ".pdf", False, False)
- If Not FormularManagerNEU.MergePdfFiles(list, dest_path) Then
- dest_path = "" : MsgBox("Fehler PDF")
- End If
+ If list.Count = 1 Then
+ dest_path = list(0)
+ Else
+ dest_path = VERAG_PROG_ALLGEMEIN.DATENVERVER_OPTIONS.getTMPPath(VERAG_PROG_ALLGEMEIN.cAllgemein.FIRMA & attachmentName & ".pdf", ".pdf", False, False)
+ If Not FormularManagerNEU.MergePdfFiles(list, dest_path) Then
+ dest_path = "" : MsgBox("Fehler PDF")
End If
+ End If
- If dest_path <> "" Then
- If sender Is Button2 Then
- Process.Start(dest_path)
- ElseIf sender Is btn Then
- 'System.Diagnostics.Process.Start("mailto:" & "" & "?subject=" & "?" & "&body=" & "?" & "&attachment=" & dest_path)
- Try
+ If dest_path <> "" Then
+ If sender Is Button2 Then
+ Process.Start(dest_path)
+ ElseIf sender Is btn Then
+ 'System.Diagnostics.Process.Start("mailto:" & "" & "?subject=" & "?" & "&body=" & "?" & "&attachment=" & dest_path)
+ Try
If listMail IsNot Nothing AndAlso listMail.Count > 0 Then
- For Each l In listMail
- Dim outl As New Outlook.Application
-
- Dim Mail As Microsoft.Office.Interop.Outlook.MailItem
- Mail = outl.CreateItem(0)
-
- 'Dim StandAcc = VERAG_PROG_ALLGEMEIN.cProgramFunctions.getdefaultOutlookAccount(outl)
- 'If StandAcc IsNot Nothing Then Mail.SendUsingAccount = StandAcc
-
- If l.MailHTMLText <> "" Then Mail.HTMLBody = l.MailHTMLText
- If l.Mail_To <> "" Then Mail.To = l.Mail_To
- If l.Mail_CC <> "" Then Mail.CC = l.Mail_CC
- If l.Mail_BCC <> "" Then Mail.CC = l.Mail_BCC
- If l.Mail_Subject <> "" Then Mail.Subject = l.Mail_Subject
-
- If VERAG_PROG_ALLGEMEIN.cAllgemein.FIRMA = "AMBAR" Then
- Try
- Mail.SentOnBehalfOfName = SDL.cFakturierung.getDefaultMail("AMBAR")
- Mail.HTMLBody &= cFakturierung.getSignature(cboTextKonserveSprache._value, 24, False, True)
- Catch ex2 As Exception
- MsgBox(ex2.Message)
- End Try
- End If
-
- Mail.Attachments.Add(dest_path, Microsoft.Office.Interop.Outlook.OlAttachmentType.olByValue, , VERAG_PROG_ALLGEMEIN.cAllgemein.FIRMA & attachmentName & ".pdf")
- Mail.Display()
-
- Next
- Else
+ For Each l In listMail
Dim outl As New Outlook.Application
Dim Mail As Microsoft.Office.Interop.Outlook.MailItem
Mail = outl.CreateItem(0)
- 'MsgBox(VERAG_PROG_ALLGEMEIN.cProgramFunctions.printdefaultOutlookAccount(outl))
'Dim StandAcc = VERAG_PROG_ALLGEMEIN.cProgramFunctions.getdefaultOutlookAccount(outl)
- 'Mail.SendUsingAccount = outl.Session.DefaultAccount
+ 'If StandAcc IsNot Nothing Then Mail.SendUsingAccount = StandAcc
+ If l.MailHTMLText <> "" Then Mail.HTMLBody = l.MailHTMLText
+ If l.Mail_To <> "" Then Mail.To = l.Mail_To
+ If l.Mail_CC <> "" Then Mail.CC = l.Mail_CC
+ If l.Mail_BCC <> "" Then Mail.CC = l.Mail_BCC
+ If l.Mail_Subject <> "" Then Mail.Subject = l.Mail_Subject
If VERAG_PROG_ALLGEMEIN.cAllgemein.FIRMA = "AMBAR" Then
Try
Mail.SentOnBehalfOfName = SDL.cFakturierung.getDefaultMail("AMBAR")
- Mail.HTMLBody &= cFakturierung.getSignature(cboTextKonserveSprache._value, 24, True, True)
+ Mail.HTMLBody &= cFakturierung.getSignature(cboTextKonserveSprache._value, 24, False, True)
Catch ex2 As Exception
MsgBox(ex2.Message)
End Try
-
-
End If
- If Me.txtEmail.Text <> "" Then Mail.To = Me.txtEmail.Text
- If cboTextkonserve._value <> "" AndAlso cboTextKonserveSprache._value <> "" Then
- Dim tX As New VERAG_PROG_ALLGEMEIN.cTextkonserve("FRM_MNGR_MailText", cboTextkonserve._value, cboTextKonserveSprache._value, VERAG_PROG_ALLGEMEIN.cAllgemein.FIRMA)
- Dim TextHTML = ""
- TextHTML &= tX.txt_text
- TextHTML &= "
"
- TextHTML &= "
"
- TextHTML &= "Mit freundlichen Grüßen
"
- TextHTML &= VERAG_PROG_ALLGEMEIN.cAllgemein.USRNAME & "
"
- TextHTML &= "
"
- TextHTML &= cFakturierung.getSignature(cboTextKonserveSprache._value, tX.txt_firmaSig, True, True)
+ Mail.Attachments.Add(dest_path, Microsoft.Office.Interop.Outlook.OlAttachmentType.olByValue, , VERAG_PROG_ALLGEMEIN.cAllgemein.FIRMA & attachmentName & ".pdf")
+ Mail.Display()
+
+ Next
+ Else
+ Dim outl As New Outlook.Application
+
+ Dim Mail As Microsoft.Office.Interop.Outlook.MailItem
+ Mail = outl.CreateItem(0)
+
+ 'MsgBox(VERAG_PROG_ALLGEMEIN.cProgramFunctions.printdefaultOutlookAccount(outl))
+ 'Dim StandAcc = VERAG_PROG_ALLGEMEIN.cProgramFunctions.getdefaultOutlookAccount(outl)
+ 'Mail.SendUsingAccount = outl.Session.DefaultAccount
- Mail.HTMLBody = "