@@ -2,6 +2,7 @@
Imports System . IO
Imports System . Reflection
Imports System . Windows . Documents
Imports com . sun . xml . internal . ws . api . pipe
Imports itextsharp . text . pdf
Imports Microsoft . Office . Interop
Imports VERAG_PROG_ALLGEMEIN
@@ -817,15 +818,15 @@ Public Class frmMDM_USTVAntrag
If USTV_ANTRAG . UStVAn_Währungscode <> " EUR " AndAlso ANTRAG . plose_WaehrungAbbuchung = " EUR " Then
NETTOBETRAG = Math . r ound( kurs . EXCHANGE_EURTOCUR ( NETTOBETRAG_EUR , USTV_ANTRAG . UStVAn_Währungscode , CDate ( USTV_POS . UStVPo_ReDat ) ) , 2 )
NETTOBETRAG = Math . R ound( kurs . EXCHANGE_EURTOCUR ( NETTOBETRAG_EUR , USTV_ANTRAG . UStVAn_Währungscode , CDate ( USTV_POS . UStVPo_ReDat ) ) , 2 )
ElseIf USTV_ANTRAG . UStVAn_Währungscode = " EUR " AndAlso ANTRAG . plose_WaehrungAbbuchung <> " EUR " Then
NETTOBETRAG_EUR = Math . r ound( kurs . EXCHANGE_CURTOEUR ( NETTOBETRAG , USTV_ANTRAG . UStVAn_Währungscode , CDate ( USTV_POS . UStVPo_ReDat ) ) , 2 )
NETTOBETRAG_EUR = Math . R ound( kurs . EXCHANGE_CURTOEUR ( NETTOBETRAG , USTV_ANTRAG . UStVAn_Währungscode , CDate ( USTV_POS . UStVPo_ReDat ) ) , 2 )
ElseIf USTV_ANTRAG . UStVAn_Währungscode <> " EUR " AndAlso ANTRAG . plose_WaehrungAbbuchung <> " EUR " Then
NETTOBETRAG_EUR = Math . r ound( kurs . EXCHANGE_CURTOEUR ( NETTOBETRAG , USTV_ANTRAG . UStVAn_Währungscode , CDate ( USTV_POS . UStVPo_ReDat ) ) , 2 )
NETTOBETRAG_EUR = Math . R ound( kurs . EXCHANGE_CURTOEUR ( NETTOBETRAG , USTV_ANTRAG . UStVAn_Währungscode , CDate ( USTV_POS . UStVPo_ReDat ) ) , 2 )
End If
@@ -923,21 +924,21 @@ Public Class frmMDM_USTVAntrag
If USTV_ANTRAG . UStVAn_Währungscode <> " EUR " AndAlso ANTRAG . plose_WaehrungAbbuchung = " EUR " Then
UST_org = Math . r ound( kurs . EXCHANGE_EURTOCUR ( UST_EUR , USTV_ANTRAG . UStVAn_Währungscode , CDate ( USTV_POS . UStVPo_ReDat ) ) , 2 )
UST_org = Math . R ound( kurs . EXCHANGE_EURTOCUR ( UST_EUR , USTV_ANTRAG . UStVAn_Währungscode , CDate ( USTV_POS . UStVPo_ReDat ) ) , 2 )
ElseIf USTV_ANTRAG . UStVAn_Währungscode = " EUR " AndAlso ANTRAG . plose_WaehrungAbbuchung <> " EUR " Then
UST_EUR = Math . r ound( kurs . EXCHANGE_CURTOEUR ( UST_org , USTV_ANTRAG . UStVAn_Währungscode , CDate ( USTV_POS . UStVPo_ReDat ) ) , 2 )
UST_EUR = Math . R ound( kurs . EXCHANGE_CURTOEUR ( UST_org , USTV_ANTRAG . UStVAn_Währungscode , CDate ( USTV_POS . UStVPo_ReDat ) ) , 2 )
ElseIf USTV_ANTRAG . UStVAn_Währungscode <> " EUR " AndAlso ANTRAG . plose_WaehrungAbbuchung <> " EUR " Then
UST_EUR = Math . r ound( kurs . EXCHANGE_CURTOEUR ( UST_org , USTV_ANTRAG . UStVAn_Währungscode , CDate ( USTV_POS . UStVPo_ReDat ) ) , 2 )
UST_EUR = Math . R ound( kurs . EXCHANGE_CURTOEUR ( UST_org , USTV_ANTRAG . UStVAn_Währungscode , CDate ( USTV_POS . UStVPo_ReDat ) ) , 2 )
End If
If ( UST_org <> 0 AndAlso UST_org <> UST_EUR ) Then
umrechKurs = Math . f loor( ( UST_org / UST_EUR * 100 + 0 . 5 ) ) / 100
umrechKurs = Math . F loor( ( UST_org / UST_EUR * 100 + 0 . 5 ) ) / 100
End If
@@ -1079,7 +1080,7 @@ Public Class frmMDM_USTVAntrag
Dim umrechKurs As Double = 1
Dim UST_EUR = CDbl ( r . Item ( " SteuerbetragLokal " ) )
UST_EUR = Math . r ound( UST_EUR , 2 )
UST_EUR = Math . R ound( UST_EUR , 2 )
USTV_POS . UStVPo_USteuerbetragEUR = UST_EUR
USTV_POS . UStVPo_Umrechnungskurs = umrechKurs
@@ -1212,17 +1213,17 @@ Public Class frmMDM_USTVAntrag
'umrechKurs = frmdw / eur
umrechKurs = Math . f loor( ( Brutto_org / Brutto_EUR * 100 + 0 . 5 ) ) / 100
umrechKurs = Math . F loor( ( Brutto_org / Brutto_EUR * 100 + 0 . 5 ) ) / 100
End If
If CDbl ( r . Item ( " rmc_betragMWST " ) ) <> 0 Then
USTV_POS . UStVPo_USteuerbetragEUR = Math . r ound( ( r . Item ( " rmc_betragMWST " ) / umrechKurs ) , 2 )
USTV_POS . UStVPo_USteuerbetragEUR = Math . R ound( ( r . Item ( " rmc_betragMWST " ) / umrechKurs ) , 2 )
USTV_POS . UStVPo_Umrechnungskurs = umrechKurs
USTV_POS . UStVPo_USteuerbetrag = r . Item ( " rmc_betragMWST " )
If USTV_POS . UStVPo_NettobetragEUR Is Nothing Then
USTV_POS . UStVPo_NettobetragEUR = Math . r ound( ( r . Item ( " rmc_betragNetto " ) / umrechKurs ) , 2 )
USTV_POS . UStVPo_NettobetragEUR = Math . R ound( ( r . Item ( " rmc_betragNetto " ) / umrechKurs ) , 2 )
End If
End If
@@ -1315,7 +1316,7 @@ Public Class frmMDM_USTVAntrag
'umrechKurs = UST_org / UST_EUR
umrechKurs = Math . f loor( ( UST_org / UST_EUR * 100 + 0 . 5 ) ) / 100
umrechKurs = Math . F loor( ( UST_org / UST_EUR * 100 + 0 . 5 ) ) / 100
End If
@@ -1325,7 +1326,7 @@ Public Class frmMDM_USTVAntrag
USTV_POS . UStVPo_USteuerbetrag = UST_org
If USTV_POS . UStVPo_NettobetragEUR Is Nothing Then
USTV_POS . UStVPo_NettobetragEUR = Math . r ound( ( r . Item ( " NETTO " ) / umrechKurs ) , 2 )
USTV_POS . UStVPo_NettobetragEUR = Math . R ound( ( r . Item ( " NETTO " ) / umrechKurs ) , 2 )
End If
End If
@@ -1423,7 +1424,7 @@ Public Class frmMDM_USTVAntrag
If ( UST_org <> 0 AndAlso UST_org <> UST_EUR ) Then
umrechKurs = Math . f loor( ( UST_org / UST_EUR * 100 + 0 . 5 ) ) / 100
umrechKurs = Math . F loor( ( UST_org / UST_EUR * 100 + 0 . 5 ) ) / 100
End If
@@ -1556,11 +1557,11 @@ Public Class frmMDM_USTVAntrag
If USTV_ANTRAG . UStVAn_Währungscode <> " EUR " Then
Dim kurs As New cEZB_Waehrungskurse ( USTV_ANTRAG . UStVAn_Währungscode )
UST_org = Math . r ound( kurs . EXCHANGE_EURTOCUR ( UST_EUR , USTV_ANTRAG . UStVAn_Währungscode , CDate ( USTV_POS . UStVPo_ReDat ) ) , 2 )
UST_org = Math . R ound( kurs . EXCHANGE_EURTOCUR ( UST_EUR , USTV_ANTRAG . UStVAn_Währungscode , CDate ( USTV_POS . UStVPo_ReDat ) ) , 2 )
End If
If ( UST_org <> 0 AndAlso UST_org <> UST_EUR ) Then
umrechKurs = Math . f loor( ( UST_org / UST_EUR * 100 + 0 . 5 ) ) / 100
umrechKurs = Math . F loor( ( UST_org / UST_EUR * 100 + 0 . 5 ) ) / 100
End If
@@ -1569,7 +1570,7 @@ Public Class frmMDM_USTVAntrag
USTV_POS . UStVPo_Umrechnungskurs = umrechKurs
USTV_POS . UStVPo_USteuerbetrag = UST_org
If USTV_POS . UStVPo_Nettobetrag Is Nothing Then USTV_POS . UStVPo_Nettobetrag = Math . r ound( ( r . Item ( " Nettobetrag " ) * umrechKurs ) , 2 )
If USTV_POS . UStVPo_Nettobetrag Is Nothing Then USTV_POS . UStVPo_Nettobetrag = Math . R ound( ( r . Item ( " Nettobetrag " ) * umrechKurs ) , 2 )
If USTV_POS . INSERT ( ) Then
@@ -1733,8 +1734,8 @@ Public Class frmMDM_USTVAntrag
Else
USTV_POS . UStVPo_USteuerbetrag = r . Cells ( " total_VAT_amount " ) . Value
USTV_POS . UStVPo_USteuerbetragEUR = Math . r ound( kurs . EXCHANGE_CURTOEUR ( r . Cells ( " total_VAT_amount " ) . Value , r . Cells ( " total_VAT_currency " ) . Value , CDate ( USTV_POS . UStVPo_ReDat ) ) , 2 )
USTV_POS . UStVPo_Umrechnungskurs = Math . f loor( ( CDbl ( USTV_POS . UStVPo_USteuerbetrag ) / CDbl ( USTV_POS . UStVPo_USteuerbetragEUR ) * 100 + 0 . 5 ) ) / 100
USTV_POS . UStVPo_USteuerbetragEUR = Math . R ound( kurs . EXCHANGE_CURTOEUR ( r . Cells ( " total_VAT_amount " ) . Value , r . Cells ( " total_VAT_currency " ) . Value , CDate ( USTV_POS . UStVPo_ReDat ) ) , 2 )
USTV_POS . UStVPo_Umrechnungskurs = Math . F loor( ( CDbl ( USTV_POS . UStVPo_USteuerbetrag ) / CDbl ( USTV_POS . UStVPo_USteuerbetragEUR ) * 100 + 0 . 5 ) ) / 100
End If
Else
'2. Antragswährung <> Belegswährung (EUR zu FREMD und FREMD zu EUR)
@@ -1742,10 +1743,10 @@ Public Class frmMDM_USTVAntrag
Dim kurs As New cEZB_Waehrungskurse ( r . Cells ( " total_VAT_currency " ) . Value )
If r . Cells ( " total_VAT_currency " ) . Value <> " EUR " Then
USTV_POS . UStVPo_USteuerbetrag = r . Cells ( " total_VAT_amount " ) . Value
USTV_POS . UStVPo_USteuerbetragEUR = Math . r ound( kurs . EXCHANGE_CURTOEUR ( r . Cells ( " total_VAT_amount " ) . Value , r . Cells ( " total_VAT_currency " ) . Value , CDate ( USTV_POS . UStVPo_ReDat ) ) , 2 )
USTV_POS . UStVPo_Umrechnungskurs = Math . f loor( ( CDbl ( USTV_POS . UStVPo_USteuerbetrag ) / CDbl ( USTV_POS . UStVPo_USteuerbetragEUR ) * 100 + 0 . 5 ) ) / 100
USTV_POS . UStVPo_USteuerbetragEUR = Math . R ound( kurs . EXCHANGE_CURTOEUR ( r . Cells ( " total_VAT_amount " ) . Value , r . Cells ( " total_VAT_currency " ) . Value , CDate ( USTV_POS . UStVPo_ReDat ) ) , 2 )
USTV_POS . UStVPo_Umrechnungskurs = Math . F loor( ( CDbl ( USTV_POS . UStVPo_USteuerbetrag ) / CDbl ( USTV_POS . UStVPo_USteuerbetragEUR ) * 100 + 0 . 5 ) ) / 100
ElseIf r . Cells ( " total_VAT_currency " ) . Value = " EUR " Then
USTV_POS . UStVPo_USteuerbetrag = Math . r ound( kurs . EXCHANGE_EURTOCUR ( r . Cells ( " total_VAT_amount " ) . Value , USTV_ANTRAG . UStVAn_Währungscode , CDate ( USTV_POS . UStVPo_ReDat ) ) , 2 )
USTV_POS . UStVPo_USteuerbetrag = Math . R ound( kurs . EXCHANGE_EURTOCUR ( r . Cells ( " total_VAT_amount " ) . Value , USTV_ANTRAG . UStVAn_Währungscode , CDate ( USTV_POS . UStVPo_ReDat ) ) , 2 )
USTV_POS . UStVPo_USteuerbetragEUR = USTV_POS . UStVPo_USteuerbetrag
USTV_POS . UStVPo_Umrechnungskurs = 1
End If
@@ -1754,13 +1755,13 @@ Public Class frmMDM_USTVAntrag
If r . Cells ( " total_VAT_currency " ) . Value = " EUR " Then
USTV_POS . UStVPo_USteuerbetragEUR = r . Cells ( " total_VAT_amount " ) . Value
Dim kurs As New cEZB_Waehrungskurse ( USTV_ANTRAG . UStVAn_Währungscode )
USTV_POS . UStVPo_USteuerbetrag = Math . r ound( kurs . EXCHANGE_EURTOCUR ( r . Cells ( " total_VAT_amount " ) . Value , USTV_ANTRAG . UStVAn_Währungscode , CDate ( USTV_POS . UStVPo_ReDat ) ) , 2 )
USTV_POS . UStVPo_Umrechnungskurs = Math . f loor( ( CDbl ( USTV_POS . UStVPo_USteuerbetrag ) / CDbl ( USTV_POS . UStVPo_USteuerbetragEUR ) * 100 + 0 . 5 ) ) / 100
USTV_POS . UStVPo_USteuerbetrag = Math . R ound( kurs . EXCHANGE_EURTOCUR ( r . Cells ( " total_VAT_amount " ) . Value , USTV_ANTRAG . UStVAn_Währungscode , CDate ( USTV_POS . UStVPo_ReDat ) ) , 2 )
USTV_POS . UStVPo_Umrechnungskurs = Math . F loor( ( CDbl ( USTV_POS . UStVPo_USteuerbetrag ) / CDbl ( USTV_POS . UStVPo_USteuerbetragEUR ) * 100 + 0 . 5 ) ) / 100
Else
USTV_POS . UStVPo_USteuerbetrag = VERAG_PROG_ALLGEMEIN . cProgramFunctions . fktEuro ( r . Cells ( " total_VAT_amount " ) . Value , r . Cells ( " total_VAT_currency " ) . Value , USTV_ANTRAG . UStVAn_Währungscode )
Dim kurs As New cEZB_Waehrungskurse ( USTV_ANTRAG . UStVAn_Währungscode )
USTV_POS . UStVPo_USteuerbetragEUR = Math . r ound( kurs . EXCHANGE_CURTOEUR ( r . Cells ( " total_VAT_amount " ) . Value , r . Cells ( " total_VAT_currency " ) . Value , CDate ( USTV_POS . UStVPo_ReDat ) ) , 2 )
USTV_POS . UStVPo_Umrechnungskurs = Math . f loor( ( CDbl ( USTV_POS . UStVPo_USteuerbetrag ) / CDbl ( USTV_POS . UStVPo_USteuerbetragEUR ) * 100 + 0 . 5 ) ) / 100
USTV_POS . UStVPo_USteuerbetragEUR = Math . R ound( kurs . EXCHANGE_CURTOEUR ( r . Cells ( " total_VAT_amount " ) . Value , r . Cells ( " total_VAT_currency " ) . Value , CDate ( USTV_POS . UStVPo_ReDat ) ) , 2 )
USTV_POS . UStVPo_Umrechnungskurs = Math . F loor( ( CDbl ( USTV_POS . UStVPo_USteuerbetrag ) / CDbl ( USTV_POS . UStVPo_USteuerbetragEUR ) * 100 + 0 . 5 ) ) / 100
End If
@@ -1833,10 +1834,10 @@ Public Class frmMDM_USTVAntrag
averageUmrechnungskurs = averageUmrechnungskurs / dgvUSTVPositionen . Rows . Count
End If
Dim abw As Double = Math . a bs( Math . r ound( GesamtUSteuer / averageUmrechnungskurs , 2 ) - Math . r ound( GesamtUSteuerEUR , 2 ) )
Dim abw As Double = Math . A bs( Math . R ound( GesamtUSteuer / averageUmrechnungskurs , 2 ) - Math . R ound( GesamtUSteuerEUR , 2 ) )
If abw >= 250 Then
MsgBox ( " Bitte Umrechnungskurs in den Antragspositionen kontrollieren! " & vbNewLine & " Der Steuerbetrag weicht um " & Math . r ound( abw , 2 ) & " € vom FW-Steuerbetrag ab! " )
MsgBox ( " Bitte Umrechnungskurs in den Antragspositionen kontrollieren! " & vbNewLine & " Der Steuerbetrag weicht um " & Math . R ound( abw , 2 ) & " € vom FW-Steuerbetrag ab! " )
End If
If Not invoicedateOK Then
@@ -4160,7 +4161,8 @@ Public Class frmMDM_USTVAntrag
Case " RO " , " R " : fileName = fileName & " .xml " : createXMLforRO ( ADR , KUNDE , KUNDE_ERW , FIRMA , BANK_OWNER , BANK_IBAN , BANK_BIC , fileName , filePath )
Case " DE " , " D " : fileName = fileName & " .csv " : createCSVforDE ( ADR , KUNDE , KUNDE_ERW , FIRMA , BANK_OWNER , BANK_IBAN , BANK_BIC , fileName , filePath ) 'ALTERNATIVE: ELMA5-Massendatenschnittstelle allerdings um einiges aufwendiger!
Case " HR " : fileName = fileName & " .xml " : createXMLforHR ( ADR , KUNDE , KUNDE_ERW , FIRMA , BANK_OWNER , BANK_IBAN , BANK_BIC , fileName , filePath )
Case Else
MsgBox ( " Für das Land " & ADR . LandKz & " wurde kein Export definiert " )
End Select
@@ -4291,11 +4293,7 @@ Public Class frmMDM_USTVAntrag
Dim UIDNrLeistender = " "
Dim LeistenderName As String = " "
Dim maut As Boolean = False
Dim diesel As Boolean = False
Dim parkplatz As Boolean = False
Dim zubeh As Boolean = False
Dim uebernachtung As Boolean = False
Dim listOfLeistungstyp As New List ( Of String )
If Not IsDBNull ( row . Cells ( " UstV_Leistender_UstNr " ) . Value ) AndAlso row . Cells ( " UstV_Leistender_UstNr " ) . Value IsNot Nothing AndAlso row . Cells ( " UstV_Leistender_UstNr " ) . Value <> " " IsNot Nothing Then
@@ -4311,53 +4309,20 @@ Public Class frmMDM_USTVAntrag
If Not IsDBNull ( row . Cells ( " UStVPo_Leistungsbezeichnung " ) . Value ) AndAlso row . Cells ( " UStVPo_Leistungsbezeichnung " ) . Value IsNot Nothing Then
Dim Bez As String = row . Cells ( " UStVPo_Leistungsbezeichnung " ) . Value
Bez = Bez . ToLower
If row . Cells ( " UStVPo_SchnittstellenNr " ) . Value = 10 Then
'UTA überspringen
ElseIf row . Cells ( " UStVPo_SchnittstellenNr " ) . Value = 9 Then
maut = True 'MSE immer MAUT
Else
If Bez . Contains ( " maut " ) Or Bez . Contains ( " toll " ) Then maut = True
If Bez . Contains ( " diesel " ) Or Bez . Contains ( " fuel " ) Then diesel = True
If Bez . Contains ( " parkplatz " ) Then parkplatz = True
If Bez . Contains ( " zubeh " ) Then zubeh = True
If Bez . Contains ( " übern " ) Then uebernachtung = True
End If
listOfLeistungstyp = getLeistungsTyp ( row . Cells ( " UStVPo_Leistungsbezeichnung " ) . Value , CInt ( row . Cells ( " UStVPo_SchnittstellenNr " ) . Value ) )
End If
Dim code As Integer = 0
Dim Subcode = " "
getCode ( Antrag_LandKz , listOfLeistungstyp ( 0 ) , code , Subcode , " RO " )
Dim goods As New GoodsDescription With { . GoodsItem = New List ( Of GoodsItem ) }
goods . GoodsItem . Add ( New GoodsItem With { . Code = code , . SubCode = Subcode , . FreeText = " " } )
If diesel Then
goods . GoodsItem . Add ( New GoodsItem With { . Code = 1 , . SubCode = " 1.1.2 " , . FreeText = " " } )
End If
If maut Then
goods . GoodsItem . Add ( New GoodsItem With { . Code = 4 , . SubCode = " 4.1 " , . FreeText = " " } )
End If
If zubeh Then
goods . GoodsItem . Add ( New GoodsItem With { . Code = 3 , . SubCode = " 3.1.5 " , . FreeText = " " } )
End If
If parkplatz Then
goods . GoodsItem . Add ( New GoodsItem With { . Code = 3 , . SubCode = " 3.1.4 " , . FreeText = " " } )
End If
If uebernachtung Then
goods . GoodsItem . Add ( New GoodsItem With { . Code = 6 , . SubCode = " 6.5 " , . FreeText = " " } )
End If
Select Case Antrag_LandKz
Case " DE " , " CZ " , " LU "
For Each good In goods . GoodsItem
good . SubCode = " " 'SUbcodes leeren
Next
End Select
app . PurchaseInformation . Invoices . Add ( New Invoice With {
@@ -4376,30 +4341,13 @@ Public Class frmMDM_USTVAntrag
}
} )
'[UStVAn_ID] , [UStVPo_ID], [UStVPo_ReDat], [UStVPo_ReNr], [UStVPo_Leistungsbezeichnung], [UStVPo_Leistender], leist.[UstV_Leistender_Strasse] + ' ' + leist.[UstV_Leistender_StrasseNr] as [UstV_Leistender_Strasse],leist.[UstV_Leistender_PLZ],leist.[UstV_Leistender_Stadt],leist.[UstV_Leistender_Land],leist.[UstV_Leistender_UstNr],[UStVPo_USteuerbetrag],[UStVPo_Schnittstelle],[UStVPo_SchnittstellenNr],[UStVPo_Umrechnungskurs],[UStVPo_USteuerbetragEUR],[UStVPo_Sachbearbeiter], [UStVPo_daId], [UStVPo_daId_loeschbar] ,[UStVPo_VZ],[UStVPo_VZ_RKID]
' =========================
' 3️ ⃣ ImportInformation hinzufügen (wenn vorhanden - OPTIONAL)
' =========================
' app.ImportInformation._Imports.Add(New Invoice With {
' .SequenceNumber = 17,
' .ReferenceNumber = "",
' .IssuingDate = "",
' .GoodsDescription = New GoodsDescription With {.GoodsItem = New GoodsItem With {.FreeText = "", .Code = 0, .SubCode = ""}},
' .Deduction = New Deduction With {.DeductibleVATAmount = "0.00", .ProRataRate = ""}
'})
counter += 1
Next
' =========================
' 4️ ⃣ Dokumente hinzufügen
' =========================
Dim list As New List ( Of String )
Dim pdfPathfinished As String = " "
@@ -4514,7 +4462,7 @@ Public Class frmMDM_USTVAntrag
Try
Dim list As New List ( Of String )
Dim fullFilePath As String = saveDialog . FileName
Dim directoryPath As String = Path . GetDirectoryName ( fullFilePath )
@@ -4523,13 +4471,13 @@ Public Class frmMDM_USTVAntrag
Directory . CreateDirectory ( directoryPath )
End If
Dim BankOwnerType = " "
Select Case Antrag_LandKz
Case " AT " , " DE " , " CZ " , " BE " , " SI "
BANK_OWNER = FIRMA . Firma_Bez
BANK_IBAN = FIRMA . Firma_IBAN1
BANK_BIC = FIRMA . Firma_BIC1
BankOwnerType = " applicant "
If BANK_BIC . ToString . Contains ( " BIC: " ) Then
BANK_BIC = BANK_BIC . ToString . Replace ( " BIC: " , " " )
BANK_BIC = BANK_BIC . Trim ( )
@@ -4553,7 +4501,7 @@ Public Class frmMDM_USTVAntrag
BANK_BIC = dtBank . Rows ( 0 ) . Item ( " bnk_bic " )
End If
'wenn nicht hinterlegt, dann leer lassen!
BankOwnerType = " representative "
End Select
Dim app As New GlobalVATRefundApplication_HR ( ) With {
@@ -4581,7 +4529,7 @@ Public Class frmMDM_USTVAntrag
} ,
. BankAccount = New BankAccount_ With {
. CurrencyISO = USTV_ANTRAG . UStVAn_Währungscode ,
. OwnerType = " representative " ,
. OwnerType = BankOwnerType ,
. OwnerName = BANK_OWNER ,
. IBAN = BANK_IBAN ,
. BIC = BANK_BIC
@@ -4595,14 +4543,7 @@ Public Class frmMDM_USTVAntrag
Dim counter As Integer = 1
Dim nummerierung As Boolean = False
Dim PDFExport As Boolean = False
Select Case MsgBox ( " Sollen die PDF-Daten in die XML eingebettet werden (wenn der Import zu lange dauert oder ein Fehler auftritt, dann sollte ohne PDF export werden) ? " , vbYesNoCancel )
Case vbYes : PDFExport = True
Case vbNo : PDFExport = False
Case Else : Return False
End Select
Dim PDFExportInXML As Boolean = False
Select Case MsgBox ( " Soll eine Nummerierung auf den PDF Dokumenten angegeben werden? " , vbYesNoCancel )
Case vbYes : nummerierung = True
@@ -4612,12 +4553,9 @@ Public Class frmMDM_USTVAntrag
app . RefundRequest = New RefundRequest_ With {
. RefundMemberState = Antrag_LandKz ,
. State = " N "
. State = " N " ' steht für New
}
@@ -4625,12 +4563,7 @@ Public Class frmMDM_USTVAntrag
Dim UIDNrLeistender = " "
Dim LeistenderName As String = " "
Dim maut As Boolean = False
Dim diesel As Boolean = False
Dim parkplatz As Boolean = False
Dim zubeh As Boolean = False
Dim uebernachtung As Boolean = False
Dim listOfLeistungstyp As New List ( Of String )
If Not IsDBNull ( row . Cells ( " UstV_Leistender_UstNr " ) . Value ) AndAlso row . Cells ( " UstV_Leistender_UstNr " ) . Value IsNot Nothing AndAlso row . Cells ( " UstV_Leistender_UstNr " ) . Value <> " " IsNot Nothing Then
@@ -4641,29 +4574,12 @@ Public Class frmMDM_USTVAntrag
LeistenderName = row . Cells ( " UStVPo_Leistender " ) . Value
LeistenderName = LeistenderName . ToString . Replace ( Antrag_LandKz , " " )
Dim Nettobetrag As Double = 0
If Not IsDBNull ( row . Cells ( " UStVPo_Nettobetrag " ) . Value ) AndAlso IsNumeric ( row . Cells ( " UStVPo_Nettobetrag " ) . Value ) Then Nettobetrag = CDbl ( row . Cells ( " UStVPo_Nettobetrag " ) . Value )
If Not IsDBNull ( row . Cells ( " UStVPo_Leistungsbezeichnung " ) . Value ) AndAlso row . Cells ( " UStVPo_Leistungsbezeichnung " ) . Value IsNot Nothing Then
Dim Bez As String = row . Cells ( " UStVPo_Leistungsbezeichnung " ) . Value
Bez = Bez . ToLower
If row . Cells ( " UStVPo_SchnittstellenNr " ) . Value = 10 Then
'UTA überspringen
ElseIf row . Cells ( " UStVPo_SchnittstellenNr " ) . Value = 9 Then
maut = True 'MSE immer MAUT
Else
Dim code As String = " "
If Bez . Contains ( " maut " ) Or Bez . Contains ( " toll " ) Then maut = True
If Bez . Contains ( " diesel " ) Or Bez . Contains ( " fuel " ) Then diesel = True
If Bez . Contains ( " parkplatz " ) Then parkplatz = True
If Bez . Contains ( " zubeh " ) Then zubeh = True
If Bez . Contains ( " übern " ) Then uebernachtung = True
End If
listOfLeistungstyp = getLeistungsTyp ( row . Cells ( " UStVPo_Leistungsbezeichnung " ) . Value , CInt ( row . Cells ( " UStVPo_SchnittstellenNr " ) . Value ) )
End If
@@ -4691,32 +4607,11 @@ Public Class frmMDM_USTVAntrag
}
}
Dim code As Integer = 0
Dim Subcode = " "
getCode ( Antrag_LandKz , listOfLeistungstyp ( 0 ) , code , Subcode )
If diesel Then
p . GoodsDescription = New GoodsDescription_ With { . Code = " 1.1.2 " }
End If
If maut Then
p . GoodsDescription = New GoodsDescription_ With { . Code = " 4.1 " }
End If
If zubeh Then
p . GoodsDescription = New GoodsDescription_ With { . Code = " 3.1.5 " }
End If
If parkplatz Then
p . GoodsDescription = New GoodsDescription_ With { . Code = " 3.1.4 " }
End If
If uebernachtung Then
p . GoodsDescription = New GoodsDescription_ With { . Code = " 6.5 " }
End If
If Not ( uebernachtung And parkplatz And zubeh And maut And diesel ) Then
p . GoodsDescription = New GoodsDescription_ With { . Code = " 1.1.2 " }
End If
p . GoodsDescription = New GoodsDescription_ With { . Code = code , . Subcode = Subcode }
Dim UstV_Leistender_Strasse = " "
@@ -4739,20 +4634,16 @@ Public Class frmMDM_USTVAntrag
. VATId = UIDNrLeistender
}
app . RefundRequest . PurchaseInformation . Add ( p )
Dim pdf As String = " "
If PDFExport Then
pdf = func . getPDF ( row . Cells ( " UStVPo_SchnittstellenNr " ) . Value , row . Cells ( " UStVPo_ReNr " ) . Value , row . Cells ( " UStVPo_ReDat " ) . Value , row . Cells ( " UStVPo_daId " ) . Value , IIf ( nummerierung , row . Cells ( " UStVPo_ID " ) . Value , - 1 ) , True , Antrag_LandKz , USTV_ANTRAG , New cFakturierung , False )
End If
pdf = func . getPDF ( row . Cells ( " UStVPo_SchnittstellenNr " ) . Value , row . Cells ( " UStVPo_ReNr " ) . Value , row . Cells ( " UStVPo_ReDat " ) . Value , row . Cells ( " UStVPo_daId " ) . Value , IIf ( nummerierung , row . Cells ( " UStVPo_ID " ) . Value , - 1 ) , True , Antrag_LandKz , USTV_ANTRAG , New cFakturierung , False )
If pdf <> " " Then list . Add ( pdf )
If pdf <> " " Then
If pdf <> " " And PDFExportInXML Then
Dim dc As New DocumentCopy_
dc . Description = row . Cells ( " UStVPo_ReNr " ) . Value
@@ -4784,12 +4675,234 @@ Public Class frmMDM_USTVAntrag
Console . WriteLine ( xmlString )
System . IO . File . WriteAllText ( filePath , xmlString )
Dim pdfFileName = fullFilePath . Replace ( " .xml " , " .pdf " )
If File . Exists ( pdfFileName ) Then
File . Delete ( pdfFileName )
End If
If list . Count > 1 Then
If FormularManagerNEU . MergePdfFiles ( list , pdfFileName ) Then
Process . Start ( pdfFileName )
End If
ElseIf list . Count = 1 Then
Dim PDFFile As String = list ( 0 )
System . IO . File . Move ( PDFFile , pdfFileName )
End If
Catch ex As Exception
VERAG_PROG_ALLGEMEIN . cErrorHandler . ERR ( ex . Message , ex . StackTrace , System . Reflection . MethodInfo . GetCurrentMethod . Name )
End Try
End Function
Private Function getLeistungsTyp ( LeistungsBez As String , SchnittstellenNr As Integer ) As List ( Of String )
Dim list As New List ( Of String )
LeistungsBez = LeistungsBez . ToLower
If SchnittstellenNr = 10 Then
'UTA überspringen
ElseIf SchnittstellenNr = 9 Then
LeistungsBez = " maut " 'MSE immer MAUT
Else
If LeistungsBez . Contains ( " maut " ) Or LeistungsBez . Contains ( " toll " ) Then
list . Add ( " maut " )
End If
If LeistungsBez . Contains ( " diesel " ) Or LeistungsBez . Contains ( " fuel " ) Then
list . Add ( " diesel " )
End If
If LeistungsBez . Contains ( " parkplatz " ) Then
list . Add ( " parkplatz " )
End If
If LeistungsBez . Contains ( " zubeh " ) Then
list . Add ( " zubehzubehör " )
End If
If LeistungsBez . Contains ( " übern " ) Then
list . Add ( " übernachtung " )
End If
End If
Return list
End Function
Private Sub getCode ( ByRef AntragLand As String , ByRef typ As String , ByRef Code As Integer , ByRef SubCode As String , Optional Portal As String = " " )
If Portal = " RO " Then
Select Case typ
Case " diesel "
Code = 1
SubCode = " 1.1.2 "
Case " maut "
Code = 4
SubCode = " 4.1 "
Case " zubehör "
Code = 3
SubCode = " 3.1.5 "
Case " parkplatz "
Code = 3
SubCode = " 3.1.4 "
Case " übernachtung "
Code = 6
SubCode = " 6.5 "
End Select
Exit Sub
End If
If Portal = " DE " Then
Select Case typ
Case " diesel "
Code = 1
SubCode = " 1.1.2 "
Case " maut "
Code = 4
SubCode = " 4.1 "
Case " zubehör "
Code = 3
SubCode = " 3.1.3 "
Case " parkplatz "
Code = 3
SubCode = " 3.1.4 "
Case " übernachtung "
Code = 6
SubCode = " 6.1 "
End Select
Exit Sub
End If
Select Case AntragLand
Case " AT "
If typ = " diesel " Then
Code = 1
SubCode = " 1.2.7 "
End If
If typ = " maut " Then
Code = 4
SubCode = " 4.1 "
End If
If typ = " parken " Then
Code = 3
SubCode = " 3.1 "
End If
If typ = " zubehör " Then
Code = 3
SubCode = " 1.3 "
End If
Case " BE "
If typ = " diesel " Then
Code = 1
SubCode = " 1.13 "
End If
If typ = " maut " Then
Code = 4
SubCode = " "
End If
If typ = " rest " Then
Code = 3
SubCode = " 3.13 "
End If
Case " ES "
If typ = " diesel " Then
Code = 1
SubCode = " 1.14 "
End If
If typ = " maut " Then
Code = 4
SubCode = " 4 "
End If
Case " SI "
If typ = " diesel " Then
Code = 1
SubCode = " 1.1 "
End If
If typ = " maut " Then
Code = 4
SubCode = " 4.1 "
End If
Case " PL "
If typ = " diesel " Then
Code = 1
SubCode = " 1.1.2 "
End If
If typ = " maut " Then
Code = 4
SubCode = " 4.2.2 "
End If
Case " FR " , " IT "
If typ = " diesel " Then
Code = 1
SubCode = " 1.1.2 "
End If
If typ = " maut " Then
Code = 4
SubCode = " 4 "
End If
Case " HU "
If typ = " diesel " Then
Code = 1
SubCode = " 1.1.2 "
End If
If typ = " maut " Then
Code = 4
SubCode = " 4.1 "
End If
Case " DK " , " SE "
If typ = " diesel " Then
Code = 1
SubCode = " 1.1 "
End If
If typ = " maut " Then
Code = 4
SubCode = " 4 "
End If
Case " DE " , " CZ " , " LU "
If typ = " diesel " Then
Code = 1
SubCode = " "
End If
If typ = " maut " Then
Code = 4
SubCode = " "
End If
Case Else
If typ = " diesel " Then
Code = 1
SubCode = " "
End If
If typ = " maut " Then
Code = 4
SubCode = " "
End If
End Select
End Sub
Private Function createCSVforDE ( ADR As cAdressen , KUNDE As cKunde , KUNDE_ERW As cKundenErweitert , FIRMA As cFirmen , BANK_OWNER As String , BANK_IBAN As String , BANK_BIC As String , filename As String , filePath As String )
@@ -4813,9 +4926,9 @@ Public Class frmMDM_USTVAntrag
Try
filePath = sPath & filename
If File . Exists( filePath) Then
File. Delete( filePath)
End If
'If File. Exists( filePath) Then
' File. Delete( filePath)
' End If
My . Computer . FileSystem . WriteAllBytes ( filePath , My . Resources . Ustveu_Rechnungsanlagen_DE , False )
@@ -4837,15 +4950,18 @@ Public Class frmMDM_USTVAntrag
Dim UIDNrLeistender = " "
Dim LeistenderName As String = " "
Dim listOfLeistungstyp As New List ( Of String )
Dim maut As Boolean = False
Dim diesel As Boolean = Fals e
Dim parkplatz As Boolean = False
Dim zubeh As Boolean = False
Dim uebernachtung As Boolean = False
Dim Strasse As String = " "
If Not IsDBNull ( row . Cells ( " UstV_Leistender_Strasse " ) . Value ) AndAlso row . Cells ( " UstV_Leistender_Strasse " ) . Value IsNot Nothing AndAlso row . Cells ( " UstV_Leistender_Strasse " ) . Value <> " " Then Strasse = row . Cells ( " UstV_Leistender_Strasse " ) . Valu e
Dim Ort As String = " "
If Not IsDBNull ( row . Cells ( " UstV_Leistender_Stadt " ) . Value ) AndAlso row . Cells ( " UstV_Leistender_Stadt " ) . Value IsNot Nothing AndAlso row . Cells ( " UstV_Leistender_Stadt " ) . Value <> " " Then Ort = row . Cells ( " UstV_Leistender_Stadt " ) . Value
If Not IsDBNull ( row . Cells ( " UstV_Leistender_UstNr " ) . Value ) AndAlso row . Cells ( " UstV_Leistender_UstNr " ) . Value IsNot Nothing AndAlso row . Cells ( " UstV_Leistender_UstNr " ) . Value <> " " IsNot Nothing Then
Dim PLZ As String = " "
If Not IsDBNull ( row . Cells ( " UstV_Leistender_PLZ " ) . Value ) AndAlso row . Cells ( " UstV_Leistender_PLZ " ) . Value IsNot Nothing AndAlso row . Cells ( " UstV_Leistender_PLZ " ) . Value <> " " Then PLZ = row . Cells ( " UstV_Leistender_PLZ " ) . Value
If Not IsDBNull ( row . Cells ( " UstV_Leistender_UstNr " ) . Value ) AndAlso row . Cells ( " UstV_Leistender_UstNr " ) . Value IsNot Nothing AndAlso row . Cells ( " UstV_Leistender_UstNr " ) . Value <> " " Then
UIDNrLeistender = row . Cells ( " UstV_Leistender_UstNr " ) . Value
'UIDNrLeistender = UIDNrLeistender.ToString.Replace(Antrag_LandKz, "") DEU wollen das Land dabei!
End If
@@ -4880,10 +4996,10 @@ Public Class frmMDM_USTVAntrag
Blatt . Range ( " E " & counter + 1 ) . Value = Steuerbetrag . ToString ( " 0.00 " , CultureInfo . InvariantCulture )
Blatt . Range ( " F " & counter + 1 ) . Value = Steuerbetrag . ToString ( " 0.00 " , CultureInfo . InvariantCulture )
Blatt . Range ( " H " & counter + 1 ) . Value = " false "
Blatt . Range ( " I " & counter + 1 ) . Value = LeistenderName
Blatt . Range ( " J " & counter + 1 ) . Value = row . Cells ( " UstV_Leistender_Strasse " ) . Value
Blatt . Range ( " M " & counter + 1 ) . Value = row . Cells ( " UstV_Leistender_PLZ " ) . Value
Blatt . Range ( " N " & counter + 1 ) . Value = row . Cells ( " UstV_Leistender_Stadt " ) . Value
Blatt . Range ( " I " & counter + 1 ) . Value = VERAG_PROG_ALLGEMEIN . cDATENSERVER . replaceInvalidCahr ( LeistenderName)
Blatt . Range ( " J " & counter + 1 ) . Value = VERAG_PROG_ALLGEMEIN . cDATENSERVER . replaceInvalidCahr ( Strasse )
Blatt . Range ( " M " & counter + 1 ) . Value = PLZ
Blatt . Range ( " N " & counter + 1 ) . Value = Ort
Blatt . Range ( " O " & counter + 1 ) . Value = iso2Land
Blatt . Range ( " P " & counter + 1 ) . Value = UIDNrLeistender
@@ -4893,53 +5009,21 @@ Public Class frmMDM_USTVAntrag
If Not IsDBNull ( row . Cells ( " UStVPo_Leistungsbezeichnung " ) . Value ) AndAlso row . Cells ( " UStVPo_Leistungsbezeichnung " ) . Value IsNot Nothing Then
Dim Bez As String = row . Cells ( " UStVPo_Leistungsbezeichnung " ) . Value
Bez = Bez . ToLower
If row . Cells ( " UStVPo_SchnittstellenNr " ) . Value = 10 Then
'UTA überspringen
ElseIf row . Cells ( " UStVPo_SchnittstellenNr " ) . Value = 9 Then
maut = True 'MSE immer MAUT
Else
If Bez . Contains ( " maut " ) Or Bez . Contains ( " toll " ) Then maut = True
If Bez . Contains ( " diesel " ) Or Bez . Contains ( " fuel " ) Then diesel = True
If Bez . Contains ( " parkplatz " ) Then parkplatz = True
If Bez . Contains ( " zubeh " ) Then zubeh = True
If Bez . Contains ( " übern " ) Then uebernachtung = True
End If
listOfLeistungstyp = getLeistungsTyp ( row . Cells ( " UStVPo_Leistungsbezeichnung " ) . Value , row . Cells ( " UStVPo_SchnittstellenNr " ) . Value )
For Each listEntry In listOfLeistungstyp
Dim code As Integer = 0
Dim Subcode = " "
getCode ( Antrag_LandKz , listEntry , code , Subcode , " DE " )
If diesel Then
Blatt . Range ( " A " & counterLeistungen + 1 ) . Value = counter
Blatt . Range ( " B " & counterLeistungen + 1 ) . Value = " 1.1.2 "
Blatt . Range ( " B " & counterLeistungen + 1 ) . Value = Subcode 'nur Subcodes!
counterLeistungen += 1
End If
If maut Then
Blatt . Range ( " A " & counterLeistungen + 1 ) . Value = counter
Blatt . Range ( " B " & counterLeistungen + 1 ) . Value = " 4.1 "
counterLeistungen += 1
End If
If zubeh Then
Blatt . Range ( " A " & counterLeistungen + 1 ) . Value = counter
Blatt . Range ( " B " & counterLeistungen + 1 ) . Value = " 3.1.3 "
counterLeistungen += 1
End If
If parkplatz Then
Blatt . Range ( " A " & counterLeistungen + 1 ) . Value = counter
Blatt . Range ( " B " & counterLeistungen + 1 ) . Value = " 3.1.4 "
counterLeistungen += 1
End If
If uebernachtung Then
Blatt . Range ( " A " & counterLeistungen + 1 ) . Value = counter
Blatt . Range ( " B " & counterLeistungen + 1 ) . Value = " 6.1 "
counterLeistungen += 1
End If
Next
End If