Plose date, etc.

This commit is contained in:
2025-11-20 13:50:00 +01:00
parent c1c1bf413f
commit e13dcd095e
4 changed files with 248 additions and 40 deletions

View File

@@ -8,7 +8,9 @@ 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
@@ -6918,7 +6920,11 @@ repeatRequest:
Dim sql_query = ""
Dim sql_query_keineMWST = ""
'alle ab 2025!
Dim test As String = " AND Adressen.AdressenNr = 401026"
Select Case Lieferant
Case "IDS"
@@ -6926,40 +6932,108 @@ repeatRequest:
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"
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
inner join tblKundenErweitert on tblKundenErweitert.kde_KundenNr = 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 and kde_keineMWSt = 1"
Case "MSE"
sql_query = " select partner_customer_number as KundenNr,invoice_id,LandKz as KundenLandKz, total_vat_amount_euro as MWST, country as RELandKz FROM tblMSEInvoices
sql_query = " select customer_number as KundenNr,invoice_id,LandKz as KundenLandKz, total_vat_amount_euro as MWST, country as RELandKz FROM tblMSEInvoices
inner join tblMSECustomers on customer_id = [customer_number]
inner join Adressen on Adressen.AdressenNr = partner_customer_number
where tblMSEInvoices.InvToCustomer is null and Year()"
where tblMSEInvoices.InvToCustomer is null and Year(invoice_date) > 2024"
sql_query_keineMWST = "select distinct(customer_number) as KundenNr FROM tblMSEInvoices
inner join tblMSECustomers on customer_id = [customer_number]
inner join tblKundenErweitert on tblKundenErweitert.kde_KundenNr = partner_customer_number
where tblMSEInvoices.InvToCustomer is null and Year(invoice_date) > 2024 and kde_keineMWSt = 1"
Case "PLOSE"
sql_query = " select Adressen.AdressenNr as KundenNr, [plInv_Id] as invoice_id,LandKz as KundenLandKz ,[plInv_MWSTBetrag] as MWST, [plInv_SupplierCountry] as RELandKz FROM tblPLOSE_Inv_Data
Dim kdNrPlose As String = ""
If txtPLoseKdNr.Text <> "" AndAlso IsNumeric(txtPLoseKdNr.Text) Then
kdNrPlose = " AND plInv_PLOSEKundennummer = " & txtPLoseKdNr.Text
End If
sql_query = " select plInv_PLOSEKundennummer as KundenNr, [plInv_Id] as invoice_id,LandKz as KundenLandKz ,[plInv_MWSTBetrag] as MWST, [plInv_SupplierCountry] as RELandKz FROM tblPLOSE_Inv_Data
inner join Adressen on Adressen.PLOSEKundenNr = plInv_PLOSEKundennummer
where plInv_InvToCustomer is null"
where plInv_InvToCustomer is null and YEAR(plInv_SupplierRechnungsDatum) > 2024" & kdNrPlose
sql_query_keineMWST = "select distinct(plInv_PLOSEKundennummer) as KundenNr FROM tblPLOSE_Inv_Data
inner join tblKundenErweitert on tblKundenErweitert.kde_KundenNr = plInv_PLOSEKundennummer
where plInv_InvToCustomer is null and YEAR(plInv_SupplierRechnungsDatum) > 2024 and kde_keineMWSt = 1 "
Case "UTA"
sql_query = " select Adressen.AdressenNr as KundenNr,[Rechnungsnummer_pro_Lieferland] as invoice_id,LandKz as KundenLandKz, SUM(Gesamtbetrag_Umsatzsteuer_in_Darstellwährung) as MWSt,[Lieferland_ISO2] as RELandKz FROM [VERAG].[dbo].[tblUTAImportNew]
inner join adressen on Kundennummer = UTAKundenNr
where InvToCustomer is null
group by Adressen.AdressenNr,[Rechnungsnummer_pro_Lieferland],LandKz,[Lieferland_ISO2]"
sql_query = " select Adressen.UTAKundenNr as KundenNr,[Rechnungsnummer_pro_Lieferland] as invoice_id,LandKz as KundenLandKz, SUM(Gesamtbetrag_Umsatzsteuer_in_Darstellwährung) as MWSt,[Lieferland_ISO2] as RELandKz FROM [VERAG].[dbo].[tblUTAImportNew]
inner join Adressen on Adressen.UTAKundenNr= [tblUTAImportNew].Kundennummer
inner join tblKundenErweitert on tblKundenErweitert.kde_KundenNr = Adressen.AdressenNr
where InvToCustomer is null and Year(Rechnungsdatum) > 2024
group by Adressen.UTAKundenNr ,[Rechnungsnummer_pro_Lieferland],LandKz,[Lieferland_ISO2]"
sql_query_keineMWST = "select distinct(Adressen.UTAKundenNr) as KundenNr FROM [VERAG].[dbo].[tblUTAImportNew]
inner join Adressen on Adressen.UTAKundenNr= [tblUTAImportNew].Kundennummer
inner join tblKundenErweitert on tblKundenErweitert.kde_KundenNr = Adressen.AdressenNr
where InvToCustomer is null and Year(Rechnungsdatum) > 2024 and kde_keineMWSt = 1
group by Adressen.UTAKundenNr "
Case "RMC"
sql_query = " select Adressen.AdressenNr as KundenNr,rmc_id as invoice_id,LandKz as KundenLandKz,[rmc_betragMWST] as MWST,rmc_landKZ as RELandKz
sql_query = " select Adressen.WölflKundenNr as KundenNr,rmc_id as invoice_id,LandKz as KundenLandKz,[rmc_betragMWST] as MWST,rmc_landKZ as RELandKz
FROM [VERAG].[dbo].[tblRMCImport]
inner join Adressen on Adressen.WölflKundenNr = rmc_kdNr
where InvToCustomer is null"
inner join Adressen on Adressen.WölflKundenNr = rmc_kdNr
where InvToCustomer is null and Year(rmc_reDatum) > 2024"
sql_query_keineMWST = "select distinct(Adressen.WölflKundenNr) as KundenNr FROM [VERAG].[dbo].[tblRMCImport]
inner join Adressen on Adressen.WölflKundenNr = rmc_kdNr
inner join tblKundenErweitert on tblKundenErweitert.kde_KundenNr = Adressen.AdressenNr
where InvToCustomer is null and Year(rmc_reDatum) > 2024 and kde_keineMWSt = 1"
End Select
Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL
Dim dt_keineMWST As DataTable = SQL.loadDgvBySql(sql_query_keineMWST, "FMZOLL")
'zuerst alle setzen, MWST nicht MDM uns machen!
For Each r In dt_keineMWST.Rows
If Not IsDBNull(r.Item("KundenNr")) AndAlso IsNumeric(r.Item("KundenNr")) Then
Select Case Lieferant
Case "IDS" 'OK
Dim IDS As cIDS
IDS.setBackToCustomerCustomerID(SQL, True, r.Item("KundenNr"))
Case "MSE" 'OK
Dim MSE As cMSEAPI
MSE.setBackToCustomerCustomerID(SQL, True, r.Item("KundenNr"))
Case "PLOSE"
Dim ploseRE As cPLOSE_Inv_Data
ploseRE.setBackToCustomerCustomerID(SQL, True, r.Item("KundenNr"))
Case "UTA"
Dim uta As cUTA
uta.setBackToCustomerCustomerID(SQL, True, r.Item("KundenNr"))
Case "RMC"
Dim rmc As cRMC
rmc.setBackToCustomerCustomerID(SQL, True, r.Item("KundenNr"))
End Select
End If
Next
Dim dtnichtGesetzteInvToCustomer As DataTable = SQL.loadDgvBySql(sql_query, "FMZOLL")
@@ -6968,7 +7042,6 @@ repeatRequest:
'checks!
'ORIGINAL-RECHNUNG setzen:
If Not IsDBNull(r.Item("MWST")) AndAlso IsNumeric(r.Item("MWST")) AndAlso CDbl(r.Item("MWST")) = 0 Then
'wenn die Rechnung die MWST-SUMME 0 aufweist!!!
@@ -7026,14 +7099,32 @@ repeatRequest:
Next
Select Case Lieferant
Case "IDS" : SQL.doSQL("update tblIDSInvoicesNewSplittedByCountry set InvToCustomer = 0 where InvToCustomer is null", "FMZOLL")
Case "MSE" : SQL.doSQL("update tblMSEInvoices set InvToCustomer = 0 where InvToCustomer is null", "FMZOLL")
Case "PLOSE" : SQL.doSQL("update tblPLOSE_Inv_Data set plInv_InvToCustomer = 0 where plInv_InvToCustomer is null", "FMZOLL")
Case "UTA" : SQL.doSQL("update tblUTAImportNew set InvToCustomer = 0 where InvToCustomer is null", "FMZOLL")
Case "RMC" : SQL.doSQL("update tblRMCImport set InvToCustomer = 0 where InvToCustomer is null", "FMZOLL")
Case "IDS"
Dim IDS As cIDS
IDS.setBackToCustomerInvoiceID(SQL, False)
Case "MSE"
Dim MSE As cMSEAPI
MSE.setBackToCustomerInvoiceID(SQL, False)
Case "PLOSE"
Dim ploseRE As cPLOSE_Inv_Data
ploseRE.setBackToCustomerInvoiceID(SQL, False)
Case "UTA"
Dim uta As cUTA
uta.setBackToCustomerInvoiceID(SQL, False)
Case "RMC"
Dim rmc As cRMC
rmc.setBackToCustomerInvoiceID(SQL, False)
End Select
End Sub
@@ -7042,11 +7133,30 @@ repeatRequest:
Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL
Select Case Lieferant
Case "IDS" : SQL.doSQL("update tblIDSInvoicesNewSplittedByCountry set InvToCustomer = 1 where invoice_id = '" & InvoiceID & "'", "FMZOLL")
Case "MSE" : SQL.doSQL("update tblMSEInvoices set InvToCustomer = 1 where invoice_id = '" & InvoiceID & "'", "FMZOLL")
Case "PLOSE" : SQL.doSQL("update tblPLOSE_Inv_Data set plInv_InvToCustomer = 1 where plInv_Id = '" & InvoiceID & "'", "FMZOLL")
Case "UTA" : SQL.doSQL("update tblUTAImportNew set InvToCustomer = 1 where [Rechnungsnummer_pro_Lieferland] = '" & InvoiceID & "'", "FMZOLL")
Case "RMC" : SQL.doSQL("update tblRMCImport set InvToCustomer = 1 where rmc_id = '" & InvoiceID & "'", "FMZOLL")
Case "IDS"
Dim IDS As cIDS
IDS.setBackToCustomerInvoiceID(SQL, True, InvoiceID)
Case "MSE"
Dim MSE As cMSEAPI
MSE.setBackToCustomerInvoiceID(SQL, True, InvoiceID)
Case "PLOSE"
Dim ploseRE As cPLOSE_Inv_Data
ploseRE.setBackToCustomerInvoiceID(SQL, True, InvoiceID)
Case "UTA"
Dim uta As cUTA
uta.setBackToCustomerInvoiceID(SQL, True, InvoiceID)
Case "RMC"
Dim rmc As cRMC
rmc.setBackToCustomerInvoiceID(SQL, True, InvoiceID)
End Select