diff --git a/initATLASAufschubkonten/cWorker_Verwahrung.vb b/initATLASAufschubkonten/cWorker_Verwahrung.vb index 3a5748c..0887904 100644 --- a/initATLASAufschubkonten/cWorker_Verwahrung.vb +++ b/initATLASAufschubkonten/cWorker_Verwahrung.vb @@ -1,7 +1,4 @@ -Imports com.sun.org.apache.bcel.internal.generic -Imports DocumentFormat.OpenXml.Wordprocessing -Imports Spire.Pdf -Imports VERAG_PROG_ALLGEMEIN +Imports VERAG_PROG_ALLGEMEIN Public Class cWorker_Verwahrung Public Shared Dateiname = "" @@ -99,15 +96,15 @@ Public Class cWorker_Verwahrung Dim Standort As String = "" If BezugsNr.Length > 4 Then Select Case BezugsNr.Substring(0, 4) - Case 4803, 4809 + Case "4803", "4809" Standort = "VERAG AG" 'Case 5601 ' Standort = "UNISPED GmbH" 'Case 5701 ' Standort = "AMBAR GmbH" - Case 4810, 5103, 5901 + Case "4810", "5103", "5901" Standort = "VERAG GmbH" - Case 5501 + Case "5501" Standort = "IMEX" Case Else GoTo Anzeige @@ -151,10 +148,8 @@ Public Class cWorker_Verwahrung Dim GesSichRef = New VERAG_PROG_ALLGEMEIN.cAufschubKonten(Standort) - Dim saldo = GesSichRef.CalcSaldo() - If SND.FilialenNr > 0 Then filiale = SND.FilialenNr If SND.AbfertigungsNr > 0 Then abfertigungsnummer = SND.AbfertigungsNr @@ -208,6 +203,7 @@ Public Class cWorker_Verwahrung .gs_freitext = "" .gs_saldo = saldo .gs_atr = "" + .gs_systemuser = "DAKOSY-AUTO" .gs_zollsatz = GesSichRef.brgakto_gs_zollsatz .gs_avisoId = SND.tblSnd_AvisoID @@ -237,7 +233,7 @@ Public Class cWorker_Verwahrung Anzeige: FORM.addDGVEinarbeitung("VW: Verwahrungsinfo", STATUS.dySt_BezugsNr) - End If + End If Catch ex As Exception VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace & vbNewLine & "Datei: " & Dateiname, System.Reflection.MethodInfo.GetCurrentMethod.Name) @@ -252,6 +248,8 @@ Anzeige: Dim EZA As DAKOSY_Worker.SumAErledigungsinformationVorpapier_005.SumAErledigungsinformationVorpapierSIVRPTyp = DAKOSY_Worker.SumAErledigungsinformationVorpapier_005.SumAErledigungsinformationVorpapierSIVRPTyp.LoadFromFile(d) Dim ART = "" + Dim RegistriernummerATLAS = "" + ' Dim details = "" Dim zp As Object = Nothing @@ -319,40 +317,133 @@ Anzeige: If DY_TMP IsNot Nothing Then STATUS.dySt_dyId = DY_TMP.dy_Id STATUS.SAVE() - - '---------------------------------------------------------------- - 'Verwahrung ABSCHREIBUNG If saveAbschreibung Then - Try + Dim BezugsNr = readEZA_SumAErledigungsinformationVorpapier_005 + + Dim Standort As String = "" + If BezugsNr.Length > 4 Then + Select Case BezugsNr.Substring(0, 4) + Case "4803", "4809" + Standort = "VERAG AG" + 'Case 5601 + ' Standort = "UNISPED GmbH" + 'Case 5701 + ' Standort = "AMBAR GmbH" + Case "4810", "5103", "5901" + Standort = "VERAG GmbH" + Case "5501" + Standort = "IMEX" + Case Else + GoTo Anzeige + End Select + + Dim filiale = IIf(BezugsNr.Length > 4, BezugsNr.Substring(0, 4), "") + Dim abfertigungsnummer = IIf(BezugsNr.Length >= 14, BezugsNr.Substring(5, 8), "") + Dim dy_SendungsId = EZA.Transaktion.IOReferenz + If filiale <> "" AndAlso abfertigungsnummer <> "" AndAlso IsNumeric(filiale) AndAlso IsNumeric(abfertigungsnummer) Then + Dim SND = VERAG_PROG_ALLGEMEIN.cSendungen.LOADByFilialenNrAbfertigungsNr(filiale, abfertigungsnummer) + + If SND IsNot Nothing AndAlso SND.tblSnd_Abfertigungsart_ID = 44 Then + + Dim existingEntryID As Integer = 0 + existingEntryID = CInt((New SQL).getValueTxtBySql("Select count(*) From [tblGesamtsicherheitsPositionen] inner join [tblGesamtsicherheit] on gs_gsId = gsp_gsId where [gs_ATBNr] = '" & RegistriernummerATLAS & "' order by gs_datum desc")) + If existingEntryID > 0 Then GoTo Anzeige + existingEntryID = CInt((New SQL).getValueTxtBySql("Select count(*) From [tblGesamtsicherheitsPositionen] inner join [tblGesamtsicherheit] on gs_gsId = gsp_gsId where ([gs_filialenNr] = '" & SND.FilialenNr & "' and [gs_abfertigungsNr] = " & SND.AbfertigungsNr & " ) or gs_avisoId = '" & SND.tblSnd_AvisoID & "' order by gs_datum desc")) + If existingEntryID > 0 Then GoTo Anzeige + + Dim gsNr As Integer = 0 + gsNr = CInt((New SQL).getValueTxtBySql("Select gsNr From [tblGesamtsicherheit] where [gs_ATBNr] = '" & RegistriernummerATLAS & "' order by gs_datum desc")) + If gsNr > 0 Then GoTo Insert + gsNr = CInt((New SQL).getValueTxtBySql("Select gsNr From [tblGesamtsicherheit] where ([gs_filialenNr] = '" & SND.FilialenNr & "' and [gs_abfertigungsNr] = " & SND.AbfertigungsNr & " ) or gs_avisoId = '" & SND.tblSnd_AvisoID & "' order by gs_datum desc")) + If gsNr > 0 Then + GoTo Insert + Else + GoTo Anzeige + End If + + + ''sonderfälle lt. Mestan + If SND.tblSnd_Zollsystem_Land = "DE" Then + + Select Case SND.FilialenNr + Case 5501, 4803, 4809, 5103 + Standort = "VERAG GmbH" + End Select + + ElseIf SND.tblSnd_Zollsystem_Land = "AT" Then + + If SND.tblSnd_Abfertigungsart_ID = 1 Then 'ZA + Standort = "VERAG CS" + ElseIf SND.tblSnd_Abfertigungsart_ID = 38 Then 'EV-Verz + Select Case SND.FilialenNr + Case 4803, 5303, 4809, 5103 + Standort = "VERAG CS" + End Select + + End If + + End If + +Insert: + + Dim GesSichRef = New VERAG_PROG_ALLGEMEIN.cAufschubKonten(Standort) + Dim saldo = GesSichRef.CalcSaldo() + + + Try + + + Dim SicherheitsPos As New cGesamtsicherheitsPositionen() + With SicherheitsPos + '.gsp_gsId = gs_gsId + ''.gsp_gspPosId = Me.getLatestPosNr(currentSicherheit.gs_gsNr, ) + 1 + '.gsp_gspPosId = OPEN.gs_posNr + '.gsp_warenwert = Double.Parse(txtPosWarenwert.Text) + '.gsp_sicherheitsbetrag = Double.Parse(txtPosSicherheitsbetrag.Text) + '.gsp_freitext = txtPosFreitext.Text + '.gsp_filialenNr = currentSicherheit.gs_filialenNr + '.gsp_art = "CLOSE" + .gsp_gsNr = gsNr + '.gsp_abfertigungsNr = currentSicherheit.gs_abfertigungsnr + .gsp_datum = 'DateTimeString2DateTimeKonvertinator(txtPosDat.Text, txtPosTime.Text) + .gsp_erstellungsdatum = DateTime.Now + .gsp_ust = 'currentSicherheit.gs_ust + .gsp_ATCNr = 'txtPositionenCRN.Text + .gsp_avisoId = 'Me.avisoID' + .gsp_systemuser = "DAKOSY-AUTO" + End With + + VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM = True + SicherheitsPos.SAVE() + VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM = False + + Catch ex As Exception + + + End Try - Catch ex As Exception - - VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM = False - End Try - - VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM = False + End If + End If + End If +Anzeige: + FORM.addDGVEinarbeitung("VW: Erledigungsinformation-Vorpapier", STATUS.dySt_BezugsNr) End If - - '---------------------------------------------------------------- - - - - - FORM.addDGVEinarbeitung("VW: Erledigungsinformation-Vorpapier", STATUS.dySt_BezugsNr) End If + + Catch ex As Exception VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace & vbNewLine & "Datei: " & Dateiname, System.Reflection.MethodInfo.GetCurrentMethod.Name) readEZA_SumAErledigungsinformationVorpapier_005 = "" diff --git a/initATLASAufschubkonten/frmStartOptions.vb b/initATLASAufschubkonten/frmStartOptions.vb index a9d6539..3b3fdb9 100644 --- a/initATLASAufschubkonten/frmStartOptions.vb +++ b/initATLASAufschubkonten/frmStartOptions.vb @@ -6,11 +6,6 @@ Imports System.Security.Cryptography.X509Certificates Imports System.Text Imports System.Threading Imports System.Xml -Imports com.sun.crypto.provider -Imports com.sun.org.apache.bcel.internal.generic -Imports com.sun.org.apache.xpath.internal.operations -Imports com.sun.xml.internal.rngom -Imports io.konik.zugferd Imports MDM_Worker Imports Renci.SshNet Imports VERAG_PROG_ALLGEMEIN @@ -323,7 +318,7 @@ Public Class frmStartOptions f.Show() VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM = False Dim finanzonline = True - getUID_Pruefung(MyTextBox1.Text, finanzonline) + getUID_Pruefung(15000, finanzonline) 'max 15.000 wegen Zeit (Routine wird alle 24h wiederholt, 15 Abfragen pro Minute -> 21.600 pro 24h) closeMe() Case "WOELFL_USTVAntraege" Dim f As New frmInfo(PARAM) @@ -692,7 +687,7 @@ Public Class frmStartOptions Else counTrans += dt.Rows.Count End If - i = i + 1 + 'i = i + 1 -> In a VB For loop, the loop automatically increases i by 1 each iteration. pages &= " " & i Next End If @@ -5210,7 +5205,7 @@ Public Class frmStartOptions Exit Sub End If - i = i + 1 + 'i = i + 1 In a VB For loop, the loop automatically increases i by 1 each iteration. pages &= " " & i Next @@ -5608,7 +5603,7 @@ Public Class frmStartOptions ' Exit Sub ' End If - ' i = i + 1 + ' 'i = i + 1 In a VB For loop, the loop automatically increases i by 1 each iteration. ' Next @@ -6932,15 +6927,13 @@ repeatRequest: 'alle ab 2025! - Dim test As String = " AND Adressen.AdressenNr = 139999" - Select Case Lieferant Case "IDS" sql_query = " select Adressen.AdressenNr as KundenNr,Adressen.AdressenNr as KundenNrVerag, invoice_id, LandKz as KundenLandKz, VATAmount as MWST, Country as RELandKz FROM tblIDSInvoicesNewSplittedByCountry inner join [VERAG].[dbo].[tbl_IDS_Kunden] on tblIDSInvoicesNewSplittedByCountry.CustomerCode = tbl_IDS_Kunden.CustomerCode inner join Adressen on Adressen.AdressenNr = KdNrVERAG WHERE tblIDSInvoicesNewSplittedByCountry.[CustomerCode] in (SELECT distinct([CustomerCode]) FROM [VERAG].[dbo].[tbl_IDS_Kunden] - WHERE 1 = 1 AND isnull([tbl_IDS_Kunden].KdNrAlt, 0) = 0) AND tblIDSInvoicesNewSplittedByCountry.InvToCustomer is null and Year(YearMonthDay) > 2024" '& test + WHERE 1 = 1 AND isnull([tbl_IDS_Kunden].KdNrAlt, 0) = 0) AND tblIDSInvoicesNewSplittedByCountry.InvToCustomer is null and Year(YearMonthDay) > 2024" sql_query_keineMWST = "select distinct(tblKundenErweitert.kde_KundenNr) as KundenNr FROM tblIDSInvoicesNewSplittedByCountry inner join [VERAG].[dbo].[tbl_IDS_Kunden] on tblIDSInvoicesNewSplittedByCountry.CustomerCode = tbl_IDS_Kunden.CustomerCode