Mitarbeiter, etc,
This commit is contained in:
@@ -6924,7 +6924,7 @@ repeatRequest:
|
||||
|
||||
'alle ab 2025!
|
||||
|
||||
Dim test As String = " AND Adressen.AdressenNr = 401026"
|
||||
Dim test As String = " AND Adressen.AdressenNr = 139999"
|
||||
|
||||
Select Case Lieferant
|
||||
Case "IDS"
|
||||
@@ -6932,7 +6932,7 @@ 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 and Year(YearMonthDay) > 2024"
|
||||
WHERE 1 = 1 AND isnull([tbl_IDS_Kunden].KdNrAlt, 0) = 0) AND tblIDSInvoicesNewSplittedByCountry.InvToCustomer is null and Year(YearMonthDay) > 2024" '& test
|
||||
|
||||
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
|
||||
@@ -6964,7 +6964,8 @@ repeatRequest:
|
||||
|
||||
|
||||
sql_query_keineMWST = "select distinct(plInv_PLOSEKundennummer) as KundenNr FROM tblPLOSE_Inv_Data
|
||||
inner join tblKundenErweitert on tblKundenErweitert.kde_KundenNr = plInv_PLOSEKundennummer
|
||||
inner join Adressen on Adressen.PLOSEKundenNr = plInv_PLOSEKundennummer
|
||||
inner join tblKundenErweitert on tblKundenErweitert.kde_KundenNr = Adressen.AdressenNr
|
||||
where plInv_InvToCustomer is null and YEAR(plInv_SupplierRechnungsDatum) > 2024 and kde_keineMWSt = 1 "
|
||||
|
||||
Case "UTA"
|
||||
@@ -7036,6 +7037,11 @@ repeatRequest:
|
||||
|
||||
Dim dtnichtGesetzteInvToCustomer As DataTable = SQL.loadDgvBySql(sql_query, "FMZOLL")
|
||||
|
||||
Dim rows_fehlendesErstattungsland() As DataRow = dtnichtGesetzteInvToCustomer.Select("RELandKz is null")
|
||||
If rows_fehlendesErstattungsland.Length > 0 Then
|
||||
MsgBox("Rechnungsland fehlt noch bei " & rows_fehlendesErstattungsland.Length & " Einträgen von " & Lieferant & vbNewLine & "Bitte Ländercode ISO2 einfügen!")
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
For Each r In dtnichtGesetzteInvToCustomer.Rows
|
||||
|
||||
@@ -7045,7 +7051,7 @@ repeatRequest:
|
||||
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!!!
|
||||
UpdateLieferantInvToCustomer(Lieferant, r.Item("invoice_id"))
|
||||
UpdateLieferantInvToCustomer(Lieferant, r.Item("invoice_id"), r.Item("KundenNr"))
|
||||
Continue For
|
||||
Else
|
||||
|
||||
@@ -7063,37 +7069,39 @@ repeatRequest:
|
||||
landKZiso2 = VERAG_PROG_ALLGEMEIN.cProgramFunctions.getISO2LandFromISO1Land(LandKz)
|
||||
End If
|
||||
|
||||
If IsDBNull(r.Item("RELandKz")) Then Continue For
|
||||
|
||||
Dim Erstattungsland As String = r.Item("RELandKz")
|
||||
|
||||
If landKZiso2 = r.Item("RELandKz") Then
|
||||
If landKZiso2 = Erstattungsland Then
|
||||
'wenn die Rechnung in dem Land in dem er ansässig ist ausgestellt wurde (rumän. Kunde – Rechnung ausgestellt in Rumänien = z.B. IDS in RO getankt…)
|
||||
UpdateLieferantInvToCustomer(Lieferant, r.Item("invoice_id"))
|
||||
UpdateLieferantInvToCustomer(Lieferant, r.Item("invoice_id"), r.Item("KundenNr"))
|
||||
Continue For
|
||||
End If
|
||||
|
||||
|
||||
If landKZiso2 <> "" AndAlso dtkeineMWST.Rows.Count > 0 Then
|
||||
'Rechnungen der Länder in denen der Kunde keine MWST erstattet bekommt
|
||||
Dim rows_keineMWST() As DataRow = dtkeineMWST.Select("Land = '" & landKZiso2 & "' AND Erstattungsland= '" & r.Item("RELandKz") & "'" & IIf(Lieferant <> "IDS", " AND Lieferant <> 'IDS'", ""))
|
||||
If rows_keineMWST.Length > 0 Then
|
||||
UpdateLieferantInvToCustomer(Lieferant, r.Item("invoice_id"))
|
||||
Continue For
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
'Rechnungen der Länder, in denen der Kunde selber MWST beantragt
|
||||
If landKZiso2 <> "" AndAlso dtKundeMWST.Rows.Count > 0 Then
|
||||
Dim rows_KundeMWST() As DataRow = dtKundeMWST.Select("LandKz = '" & r.Item("RELandKz") & "' AND KdNr =" & kdnr)
|
||||
If rows_KundeMWST.Length > 0 Then
|
||||
UpdateLieferantInvToCustomer(Lieferant, r.Item("invoice_id"))
|
||||
If landKZiso2 <> "" AndAlso dtkeineMWST.Rows.Count > 0 Then
|
||||
'Rechnungen der Länder in denen der Kunde keine MWST erstattet bekommt
|
||||
Dim rows_keineMWST() As DataRow = dtkeineMWST.Select("Land = '" & landKZiso2 & "' AND Erstattungsland= '" & Erstattungsland & "'" & IIf(Lieferant <> "IDS", " AND Lieferant <> 'IDS'", ""))
|
||||
If rows_keineMWST.Length > 0 Then
|
||||
UpdateLieferantInvToCustomer(Lieferant, r.Item("invoice_id"), r.Item("KundenNr"))
|
||||
Continue For
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
'Rechnungen der Länder, in denen der Kunde selber MWST beantragt
|
||||
If landKZiso2 <> "" AndAlso dtKundeMWST.Rows.Count > 0 Then
|
||||
Dim rows_KundeMWST() As DataRow = dtKundeMWST.Select("LandKz = '" & Erstattungsland & "' AND KdNr =" & kdnr)
|
||||
If rows_KundeMWST.Length > 0 Then
|
||||
UpdateLieferantInvToCustomer(Lieferant, r.Item("invoice_id"), r.Item("KundenNr"))
|
||||
Continue For
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
End If
|
||||
|
||||
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
Next
|
||||
@@ -7128,7 +7136,7 @@ repeatRequest:
|
||||
End Sub
|
||||
|
||||
|
||||
Private Sub UpdateLieferantInvToCustomer(Lieferant As String, InvoiceID As String)
|
||||
Private Sub UpdateLieferantInvToCustomer(Lieferant As String, InvoiceID As String, Optional CustomerNr As String = "")
|
||||
|
||||
Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL
|
||||
|
||||
@@ -7141,7 +7149,7 @@ repeatRequest:
|
||||
|
||||
Case "MSE"
|
||||
Dim MSE As cMSEAPI
|
||||
MSE.setBackToCustomerInvoiceID(SQL, True, InvoiceID)
|
||||
MSE.setBackToCustomerInvoiceID(SQL, True, InvoiceID, CustomerNr) 'bei MSE ist die InvoiceID nur in Verbindung mit dem CustomerCode eindeutig!
|
||||
|
||||
|
||||
Case "PLOSE"
|
||||
|
||||
Reference in New Issue
Block a user