From b4d25e6ea1880a069ee020d4bef0f1c0c755d05e Mon Sep 17 00:00:00 2001 From: Andreas Luxbauer Date: Mon, 5 Dec 2022 14:17:34 +0100 Subject: [PATCH] MA Anzeige Hauptfirma, div. Fixes --- MDM_Worker/cPLOSE_Inv_Data.vb | 2 +- UID/Mitarbeiter/usrCntlMitarbeiter.vb | 2 +- initATLASAufschubkonten/cGetMsgType.vb | 7 +- .../frmDYNachrichtenVerarbeitung.vb | 150 ++++++++++-------- .../frmMDMNachrichtenVerarbeitung.vb | 12 +- 5 files changed, 104 insertions(+), 69 deletions(-) diff --git a/MDM_Worker/cPLOSE_Inv_Data.vb b/MDM_Worker/cPLOSE_Inv_Data.vb index cd792f2..aeba720 100644 --- a/MDM_Worker/cPLOSE_Inv_Data.vb +++ b/MDM_Worker/cPLOSE_Inv_Data.vb @@ -4,7 +4,7 @@ Imports System.Reflection Public Class cPLOSE_Inv_Data Property plInv_Id As Integer - Property plInv_SupplierRechnungsDatum As Date + Property plInv_SupplierRechnungsDatum As Object = Nothing Property plInv_SupplierRechnungsNr As String Property plInv_SupplierCountry As Object = Nothing Property plInv_Lieferant As Object = Nothing diff --git a/UID/Mitarbeiter/usrCntlMitarbeiter.vb b/UID/Mitarbeiter/usrCntlMitarbeiter.vb index 7411cae..ac96e6e 100644 --- a/UID/Mitarbeiter/usrCntlMitarbeiter.vb +++ b/UID/Mitarbeiter/usrCntlMitarbeiter.vb @@ -51,7 +51,7 @@ Public Class usrCntlMitarbeiter - Dim sql As String = "SELECT mit_id,mit_username,mit_vname, mit_nname ,mit_niederlassung,mit_abteilung,mit_email,mit_durchwahl,mit_gekuendigt FROM tblMitarbeiter WHERE (mit_firma='" & firma & "' OR mit_firma='ALL') " + Dim sql As String = "SELECT mit_id,mit_username,mit_vname, mit_nname ,mit_niederlassung,mit_abteilung,mit_email,mit_durchwahl,mit_gekuendigt FROM tblMitarbeiter WHERE (mit_firma='" & firma & "' OR (mit_firma='ALL' AND mit_FirmaHaupt='" & firma & "' )) " If txtSuche.Text <> "" Then sql &= " AND (mit_username LIKE '%" & txtSuche.Text & "%' OR mit_nname LIKE '%" & txtSuche.Text & "%' OR mit_vname LIKE '%" & txtSuche.Text & "%') " diff --git a/initATLASAufschubkonten/cGetMsgType.vb b/initATLASAufschubkonten/cGetMsgType.vb index d31fe79..fc89939 100644 --- a/initATLASAufschubkonten/cGetMsgType.vb +++ b/initATLASAufschubkonten/cGetMsgType.vb @@ -570,7 +570,7 @@ Public Class cGetMsgType Shared Function isPLOSE_Detail(doc As String) As Boolean Dim lines() As String = IO.File.ReadAllLines(doc) If lines.Count > 0 Then - If lines(0).ToString.StartsWith("TR5") Or (lines.Count > 1 AndAlso (lines(0).ToString.StartsWith("TR1") And lines(1).ToString.StartsWith("TR5"))) Then + If lines(0).ToString.Replace("""", "").StartsWith("TR5") Or (lines.Count > 1 AndAlso (lines(0).ToString.Replace("""", "").StartsWith("TR1") And lines(1).ToString.Replace("""", "").StartsWith("TR5"))) Then Return True End If End If @@ -579,7 +579,7 @@ Public Class cGetMsgType Shared Function isPLOSE_Header(doc As String) As Boolean Dim lines() As String = IO.File.ReadAllLines(doc) If lines.Count > 0 Then - If lines(0).ToString.StartsWith("TR6") Then + If lines(0).ToString.Replace("""", "").StartsWith("TR6") Then Return True End If End If @@ -587,8 +587,9 @@ Public Class cGetMsgType End Function Shared Function isPLOSE_INVData(doc As String) As Boolean Dim lines() As String = IO.File.ReadAllLines(doc) + If lines.Count > 0 Then - If lines(0).ToString.StartsWith("PloseCode") Then + If lines(0).ToString.Replace("""", "").StartsWith("PloseCode") Then Return True End If End If diff --git a/initATLASAufschubkonten/frmDYNachrichtenVerarbeitung.vb b/initATLASAufschubkonten/frmDYNachrichtenVerarbeitung.vb index 2ce72e9..ef0f711 100644 --- a/initATLASAufschubkonten/frmDYNachrichtenVerarbeitung.vb +++ b/initATLASAufschubkonten/frmDYNachrichtenVerarbeitung.vb @@ -3342,40 +3342,55 @@ Public Class frmDYNachrichtenVerarbeitung 'Erwerber --> NEU!!! = zusätzl. Steuerl. Angaben If FCFCDE.Body IsNot Nothing AndAlso FCFCDE.Body.AdditionalDutyReferences IsNot Nothing AndAlso FCFCDE.Body.AdditionalDutyReferences.Count > 0 AndAlso FCFCDE.Body.AdditionalDutyReferences(0).DutyInterestedParty IsNot Nothing Then - Dim ADR As New DAKOSY_Worker.cDakosy_EZA_Adressen - ADR.ezaAd_AdressTyp = "UC" - If FCFCDE.Body.AdditionalDutyReferences(0).DutyInterestedParty.Name IsNot Nothing Then - If FCFCDE.Body.AdditionalDutyReferences(0).DutyInterestedParty.Name.ToString.Length > 40 Then - If FCFCDE.Body.AdditionalDutyReferences(0).DutyInterestedParty.Name.ToString.Length > 80 Then - ADR.ezaAd_NameFirma1 = FCFCDE.Body.AdditionalDutyReferences(0).DutyInterestedParty.Name.ToString.Substring(0, 40) - ADR.ezaAd_NameFirma2 = FCFCDE.Body.AdditionalDutyReferences(0).DutyInterestedParty.Name.ToString.Substring(40, 40) - ADR.ezaAd_NameFirma3 = FCFCDE.Body.AdditionalDutyReferences(0).DutyInterestedParty.Name.ToString.Substring(80, FCFCDE.Body.AdditionalDutyReferences(0).DutyInterestedParty.Name.ToString.Length - 80) - End If - ADR.ezaAd_NameFirma1 = FCFCDE.Body.AdditionalDutyReferences(0).DutyInterestedParty.Name.ToString.Substring(0, 40) - ADR.ezaAd_NameFirma2 = FCFCDE.Body.AdditionalDutyReferences(0).DutyInterestedParty.Name.ToString.Substring(40, FCFCDE.Body.AdditionalDutyReferences(0).DutyInterestedParty.Name.ToString.Length - 40) - Else - ADR.ezaAd_NameFirma1 = FCFCDE.Body.AdditionalDutyReferences(0).DutyInterestedParty.Name - End If - End If - If FCFCDE.Body.AdditionalDutyReferences(0).ReferenceNumber IsNot Nothing Then - ADR.ezaAd_UStIDAnmelder = FCFCDE.Body.AdditionalDutyReferences(0).ReferenceNumber - EZA.eza_UstIdAnmelder = FCFCDE.Body.AdditionalDutyReferences(0).ReferenceNumber - End If + For Each ADDREF In FCFCDE.Body.AdditionalDutyReferences + If ADDREF.ReferenceNumber IsNot Nothing Then + If ADDREF.ReferenceNumber.ToString.StartsWith("FR2") Then 'ERWERBER + + Dim UIDNR = ADDREF.ReferenceNumber.Substring(3) ' ohne FR2 + Dim ADR As New DAKOSY_Worker.cDakosy_EZA_Adressen + ADR.ezaAd_AdressTyp = "UC" 'ERWERBER + If ADDREF.DutyInterestedParty.Name IsNot Nothing Then + If ADDREF.DutyInterestedParty.Name.ToString.Length > 40 Then + If ADDREF.DutyInterestedParty.Name.ToString.Length > 80 Then + ADR.ezaAd_NameFirma1 = ADDREF.DutyInterestedParty.Name.ToString.Substring(0, 40) + ADR.ezaAd_NameFirma2 = ADDREF.DutyInterestedParty.Name.ToString.Substring(40, 40) + ADR.ezaAd_NameFirma3 = ADDREF.DutyInterestedParty.Name.ToString.Substring(80, ADDREF.DutyInterestedParty.Name.ToString.Length - 80) + End If + ADR.ezaAd_NameFirma1 = ADDREF.DutyInterestedParty.Name.ToString.Substring(0, 40) + ADR.ezaAd_NameFirma2 = ADDREF.DutyInterestedParty.Name.ToString.Substring(40, ADDREF.DutyInterestedParty.Name.ToString.Length - 40) + Else + ADR.ezaAd_NameFirma1 = ADDREF.DutyInterestedParty.Name + End If + End If + + ADR.ezaAd_UStIDAnmelder = UIDNR + EZA.eza_UstIdAnmelder = UIDNR + + If ADDREF.DutyInterestedParty.Identification IsNot Nothing Then + ADR.ezaAd_TeilnehmerEORI = ADDREF.DutyInterestedParty.Identification.ReferenceNumber + 'ADR.ezaAd_TeilnehmerNLNR = ADDREF.DutyInterestedParty.Identification.ReferenceNumber + End If + If ADDREF.DutyInterestedParty.Address IsNot Nothing Then + ADR.ezaAd_StrasseHausNr1 = ADDREF.DutyInterestedParty.Address.Line + ADR.ezaAd_StrasseHausNr2 = Nothing + ADR.ezaAd_Ort = ADDREF.DutyInterestedParty.Address.City + ADR.ezaAd_PLZ = ADDREF.DutyInterestedParty.Address.Postcode + ADR.ezaAd_LandCode = ADDREF.DutyInterestedParty.Address.Country + End If + EZA.eza_ADRESSEN.Add(ADR) + + + + ElseIf ADDREF.ReferenceNumber.ToString.StartsWith("FR2") Then 'ERWERBER + 'Fiskalvertreter + End If + End If + Next + - If FCFCDE.Body.AdditionalDutyReferences(0).DutyInterestedParty.Identification IsNot Nothing Then - ADR.ezaAd_TeilnehmerEORI = FCFCDE.Body.AdditionalDutyReferences(0).DutyInterestedParty.Identification.ReferenceNumber - 'ADR.ezaAd_TeilnehmerNLNR = FCFCDE.Body.AdditionalDutyReferences(0).DutyInterestedParty.Identification.ReferenceNumber - End If - If FCFCDE.Body.AdditionalDutyReferences(0).DutyInterestedParty.Address IsNot Nothing Then - ADR.ezaAd_StrasseHausNr1 = FCFCDE.Body.AdditionalDutyReferences(0).DutyInterestedParty.Address.Line - ADR.ezaAd_StrasseHausNr2 = Nothing - ADR.ezaAd_Ort = FCFCDE.Body.AdditionalDutyReferences(0).DutyInterestedParty.Address.City - ADR.ezaAd_PLZ = FCFCDE.Body.AdditionalDutyReferences(0).DutyInterestedParty.Address.Postcode - ADR.ezaAd_LandCode = FCFCDE.Body.AdditionalDutyReferences(0).DutyInterestedParty.Address.Country - End If - EZA.eza_ADRESSEN.Add(ADR) End If + 'Versender/Ausführer If FCFCDE.Body IsNot Nothing AndAlso FCFCDE.Body.Consignor IsNot Nothing Then Dim ADR As New DAKOSY_Worker.cDakosy_EZA_Adressen @@ -3961,38 +3976,49 @@ Public Class frmDYNachrichtenVerarbeitung 'Erwerber --> NEU!!! = zusätzl. Steuerl. Angaben If FCFCDF.Body IsNot Nothing AndAlso FCFCDF.Body.AdditionalDutyReferences IsNot Nothing AndAlso FCFCDF.Body.AdditionalDutyReferences.Count > 0 AndAlso FCFCDF.Body.AdditionalDutyReferences(0).DutyInterestedParty IsNot Nothing Then - Dim ADR As New DAKOSY_Worker.cDakosy_EZA_Adressen - ADR.ezaAd_AdressTyp = "UC" - If FCFCDF.Body.AdditionalDutyReferences(0).DutyInterestedParty.Name IsNot Nothing Then - If FCFCDF.Body.AdditionalDutyReferences(0).DutyInterestedParty.Name.ToString.Length > 40 Then - If FCFCDF.Body.AdditionalDutyReferences(0).DutyInterestedParty.Name.ToString.Length > 80 Then - ADR.ezaAd_NameFirma1 = FCFCDF.Body.AdditionalDutyReferences(0).DutyInterestedParty.Name.ToString.Substring(0, 40) - ADR.ezaAd_NameFirma2 = FCFCDF.Body.AdditionalDutyReferences(0).DutyInterestedParty.Name.ToString.Substring(40, 40) - ADR.ezaAd_NameFirma3 = FCFCDF.Body.AdditionalDutyReferences(0).DutyInterestedParty.Name.ToString.Substring(80, FCFCDF.Body.AdditionalDutyReferences(0).DutyInterestedParty.Name.ToString.Length - 80) - End If - ADR.ezaAd_NameFirma1 = FCFCDF.Body.AdditionalDutyReferences(0).DutyInterestedParty.Name.ToString.Substring(0, 40) - ADR.ezaAd_NameFirma2 = FCFCDF.Body.AdditionalDutyReferences(0).DutyInterestedParty.Name.ToString.Substring(40, FCFCDF.Body.AdditionalDutyReferences(0).DutyInterestedParty.Name.ToString.Length - 40) - Else - ADR.ezaAd_NameFirma1 = FCFCDF.Body.AdditionalDutyReferences(0).DutyInterestedParty.Name - End If - End If - If FCFCDF.Body.AdditionalDutyReferences(0).ReferenceNumber IsNot Nothing Then - ADR.ezaAd_UStIDAnmelder = FCFCDF.Body.AdditionalDutyReferences(0).ReferenceNumber - EZA.eza_UstIdAnmelder = FCFCDF.Body.AdditionalDutyReferences(0).ReferenceNumber - End If + For Each ADDREF In FCFCDF.Body.AdditionalDutyReferences + If ADDREF.ReferenceNumber IsNot Nothing Then + If ADDREF.ReferenceNumber.ToString.StartsWith("FR2") Then 'ERWERBER + + Dim UIDNR = ADDREF.ReferenceNumber.Substring(3) ' ohne FR2 + Dim ADR As New DAKOSY_Worker.cDakosy_EZA_Adressen + ADR.ezaAd_AdressTyp = "UC" 'ERWERBER + If ADDREF.DutyInterestedParty.Name IsNot Nothing Then + If ADDREF.DutyInterestedParty.Name.ToString.Length > 40 Then + If ADDREF.DutyInterestedParty.Name.ToString.Length > 80 Then + ADR.ezaAd_NameFirma1 = ADDREF.DutyInterestedParty.Name.ToString.Substring(0, 40) + ADR.ezaAd_NameFirma2 = ADDREF.DutyInterestedParty.Name.ToString.Substring(40, 40) + ADR.ezaAd_NameFirma3 = ADDREF.DutyInterestedParty.Name.ToString.Substring(80, ADDREF.DutyInterestedParty.Name.ToString.Length - 80) + End If + ADR.ezaAd_NameFirma1 = ADDREF.DutyInterestedParty.Name.ToString.Substring(0, 40) + ADR.ezaAd_NameFirma2 = ADDREF.DutyInterestedParty.Name.ToString.Substring(40, ADDREF.DutyInterestedParty.Name.ToString.Length - 40) + Else + ADR.ezaAd_NameFirma1 = ADDREF.DutyInterestedParty.Name + End If + End If + + ADR.ezaAd_UStIDAnmelder = UIDNR + EZA.eza_UstIdAnmelder = UIDNR + + If ADDREF.DutyInterestedParty.Identification IsNot Nothing Then + ADR.ezaAd_TeilnehmerEORI = ADDREF.DutyInterestedParty.Identification.ReferenceNumber + 'ADR.ezaAd_TeilnehmerNLNR = ADDREF.DutyInterestedParty.Identification.ReferenceNumber + End If + If ADDREF.DutyInterestedParty.Address IsNot Nothing Then + ADR.ezaAd_StrasseHausNr1 = ADDREF.DutyInterestedParty.Address.Line + ADR.ezaAd_StrasseHausNr2 = Nothing + ADR.ezaAd_Ort = ADDREF.DutyInterestedParty.Address.City + ADR.ezaAd_PLZ = ADDREF.DutyInterestedParty.Address.Postcode + ADR.ezaAd_LandCode = ADDREF.DutyInterestedParty.Address.Country + End If + EZA.eza_ADRESSEN.Add(ADR) + + + End If + End If + Next + - If FCFCDF.Body.AdditionalDutyReferences(0).DutyInterestedParty.Identification IsNot Nothing Then - ADR.ezaAd_TeilnehmerEORI = FCFCDF.Body.AdditionalDutyReferences(0).DutyInterestedParty.Identification.ReferenceNumber - 'ADR.ezaAd_TeilnehmerNLNR = FCFCDF.Body.AdditionalDutyReferences(0).DutyInterestedParty.Identification.ReferenceNumber - End If - If FCFCDF.Body.AdditionalDutyReferences(0).DutyInterestedParty.Address IsNot Nothing Then - ADR.ezaAd_StrasseHausNr1 = FCFCDF.Body.AdditionalDutyReferences(0).DutyInterestedParty.Address.Line - ADR.ezaAd_StrasseHausNr2 = Nothing - ADR.ezaAd_Ort = FCFCDF.Body.AdditionalDutyReferences(0).DutyInterestedParty.Address.City - ADR.ezaAd_PLZ = FCFCDF.Body.AdditionalDutyReferences(0).DutyInterestedParty.Address.Postcode - ADR.ezaAd_LandCode = FCFCDF.Body.AdditionalDutyReferences(0).DutyInterestedParty.Address.Country - End If - EZA.eza_ADRESSEN.Add(ADR) End If 'Versender/Ausführer diff --git a/initATLASAufschubkonten/frmMDMNachrichtenVerarbeitung.vb b/initATLASAufschubkonten/frmMDMNachrichtenVerarbeitung.vb index f5a36aa..f51eab8 100644 --- a/initATLASAufschubkonten/frmMDMNachrichtenVerarbeitung.vb +++ b/initATLASAufschubkonten/frmMDMNachrichtenVerarbeitung.vb @@ -774,7 +774,6 @@ Public Class frmMDMNachrichtenVerarbeitung Dim currentRow As String() - Dim fi As FileInfo = New FileInfo(d) While Not MyReader.EndOfData @@ -784,8 +783,10 @@ Public Class frmMDMNachrichtenVerarbeitung If currentRow(0) <> "PloseCode" Then ' Header If currentRow.Length >= 15 Then Dim PLOSE_INV As New MDM_Worker.cPLOSE_Inv_Data - + ' MsgBox(SQL.isleernothingDateFormatstring(currentRow(7))) + ' MsgBox(currentRow(7)) PLOSE_INV.plInv_SupplierRechnungsDatum = SQL.isleernothingDateFormatstring(currentRow(7)) + ' MsgBox(PLOSE_INV.plInv_SupplierRechnungsDatum) PLOSE_INV.plInv_SupplierRechnungsNr = SQL.isleernothing(currentRow(8)) PLOSE_INV.plInv_SupplierCountry = SQL.isleernothing(currentRow(6)) PLOSE_INV.plInv_Lieferant = SQL.isleernothing(currentRow(4)) @@ -793,6 +794,9 @@ Public Class frmMDMNachrichtenVerarbeitung PLOSE_INV.plInv_LieferantUID = SQL.isleernothing(currentRow(5)) 'PLOSE_INV.plInv_RechnungsJahr = SQL.isleernothing(currentRow(7)) --> JAHR PLOSE_INV.plInv_PdfFileName = SQL.isleernothing(currentRow(14)) + If If(PLOSE_INV.plInv_PdfFileName, "") <> "" Then + If Not PLOSE_INV.plInv_PdfFileName.ToString.ToLower.EndsWith(".pdf") Then PLOSE_INV.plInv_PdfFileName += ".pdf" ' Falls Endung nciht .pdf --> anfügen + End If PLOSE_INV.plInv_Einlesedatum = Now.ToShortDateString PLOSE_INV.plInv_Datensatztyp = "PDF" PLOSE_INV.plInv_PLOSEKundennummer = SQL.isleernothing(currentRow(0)) @@ -807,6 +811,10 @@ Public Class frmMDMNachrichtenVerarbeitung ' [plInv_daId] + 'If If(PLOSE_INV.plInv_PdfFileName, "") <> "" Then 'And PLOSE_INV.plInv_daId Is Nothing Then + ' PLOSE_INV.plInv_daId = SQL.getValueTxtBySql("SELECT TOP (1) [da_id] FROM [tblDatenarchiv] where da_kategorie = 'MDM' AND da_ordner='MDM_DATEN' and da_name='" & PLOSE_INV.plInv_PdfFileName & "' order by da_id desc", "FMZOLL",,, Nothing) + 'End If + PLOSE_INV.plInv_Dateiname = fi.Name