Proc, etc.
This commit is contained in:
@@ -331,7 +331,7 @@ Public Class cPLOSE_Inv_Data
|
||||
|
||||
For Each r As DataRow In dtREohneWahrung.Rows
|
||||
|
||||
Dim Waehrungtabelle As DataTable = SQL.loadDgvBySql("Select plose_WaehrungAbbuchung, plose_WaehrungLandDiesntleistung, plp_Land from tblPLOSE_Details INNER JOIN tblPLOSE_Produktbeschreibung ON [plp_ProductCode]=[plose_ProduktCode] WHERE plose_RechnungsNr = '" & r.Item("plInv_SupplierRechnungsNr") & "' And plose_RechnungsDatum = '" & r.Item("plInv_SupplierRechnungsDatum") & "' group by plose_WaehrungAbbuchung, plose_WaehrungLandDiesntleistung, plp_Land", "FMZOLL")
|
||||
Dim Waehrungtabelle As DataTable = SQL.loadDgvBySql("Select plose_WaehrungAbbuchung, plose_WaehrungLandDiesntleistung, plp_Land from tblPLOSE_Details INNER JOIN tblPLOSE_Produktbeschreibung ON [plp_ProductCode]=[plose_ProduktCode] WHERE plose_SupplierRechnungsNr = '" & r.Item("plInv_SupplierRechnungsNr") & "' And plose_SupplierRechnungsDatum = '" & r.Item("plInv_SupplierRechnungsDatum") & "' group by plose_WaehrungAbbuchung, plose_WaehrungLandDiesntleistung, plp_Land", "FMZOLL")
|
||||
|
||||
If Waehrungtabelle.Rows.Count = 1 Then
|
||||
If Waehrungtabelle.Rows(0).Item("plose_WaehrungAbbuchung") = Waehrungtabelle.Rows(0).Item("plose_WaehrungLandDiesntleistung") And Waehrungtabelle.Rows(0).Item("plp_Land").ToString.Trim = r.Item("plInv_SupplierCountry").ToString.Trim Then
|
||||
@@ -359,6 +359,66 @@ Public Class cPLOSE_Inv_Data
|
||||
|
||||
End Function
|
||||
|
||||
Public Shared Function checkAndsetArchivFromUSTVAPos(jahr As Integer, Optional message As Boolean = False, Optional kdNr As Integer = -1) As Boolean
|
||||
|
||||
If jahr > Now.Year Then Return False
|
||||
If jahr < 2020 Then Return False
|
||||
|
||||
|
||||
Dim nichtEingearbetieteEintrage As String = "select * from tblPLOSE_Details where Year(plose_RechnungsDatum) = " & jahr & " and UStVAn_ID is null and plose_ArchiviertDatum is null and plose_Archiv = 0 " & IIf(kdNr > 0, " And plose_POLSEKundennummer = " & kdNr, "")
|
||||
|
||||
|
||||
Dim REohneWaehrung As String = "SELECT [plInv_SupplierRechnungsDatum],[plInv_SupplierRechnungsNr],[plInv_SupplierCountry],[plInv_Lieferant]
|
||||
FROM [VERAG].[dbo].[tblPLOSE_Inv_Data]
|
||||
where YEAR( [plInv_SupplierRechnungsDatum]) = " & jahr & " and plInv_Currency is null " & "
|
||||
Group by [plInv_SupplierCountry],[plInv_Lieferant],[plInv_SupplierRechnungsDatum],[plInv_SupplierRechnungsNr]"
|
||||
|
||||
Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL
|
||||
Dim dtREohneWahrung As DataTable = SQL.loadDgvBySql(REohneWaehrung, "FMZOLL")
|
||||
|
||||
'TODO: umbauen auf checkAndSet
|
||||
|
||||
|
||||
'If dtREohneWahrung.Rows.Count > 0 Then
|
||||
|
||||
' If vbYes = MsgBox("Details der fehlenden Währungen anzeigen?", vbYesNo) Then
|
||||
' cProgramFunctions.genExcelFromDT_NEW(dtREohneWahrung,,, "Fehlende Währung in Rechnungen: " & jahr)
|
||||
' End If
|
||||
|
||||
|
||||
' If IIf(message, vbYes = MsgBox("Bei " & dtREohneWahrung.Rows.Count & " PLOSE-Rechnungen fehlt die Währungsbezeichnung in den Rechnungen." & vbNewLine & "Währung setzen?", vbYesNoCancel), True) Then
|
||||
|
||||
' For Each r As DataRow In dtREohneWahrung.Rows
|
||||
|
||||
' Dim Waehrungtabelle As DataTable = SQL.loadDgvBySql("Select plose_WaehrungAbbuchung, plose_WaehrungLandDiesntleistung, plp_Land from tblPLOSE_Details INNER JOIN tblPLOSE_Produktbeschreibung ON [plp_ProductCode]=[plose_ProduktCode] WHERE plose_SupplierRechnungsNr = '" & r.Item("plInv_SupplierRechnungsNr") & "' And plose_SupplierRechnungsDatum = '" & r.Item("plInv_SupplierRechnungsDatum") & "' group by plose_WaehrungAbbuchung, plose_WaehrungLandDiesntleistung, plp_Land", "FMZOLL")
|
||||
|
||||
' If Waehrungtabelle.Rows.Count = 1 Then
|
||||
' If Waehrungtabelle.Rows(0).Item("plose_WaehrungAbbuchung") = Waehrungtabelle.Rows(0).Item("plose_WaehrungLandDiesntleistung") And Waehrungtabelle.Rows(0).Item("plp_Land").ToString.Trim = r.Item("plInv_SupplierCountry").ToString.Trim Then
|
||||
' Dim Waehrung As String = IIf(IsDBNull(Waehrungtabelle.Rows(0).Item("plose_WaehrungAbbuchung")), "", Waehrungtabelle.Rows(0).Item("plose_WaehrungAbbuchung"))
|
||||
' If Waehrung <> "" Then
|
||||
' SQL.doSQL("UPDATE [tblPLOSE_Inv_Data] SET plInv_Currency = '" & Waehrung & "' WHERE plInv_Currency is null and [plInv_SupplierRechnungsDatum] = '" & r.Item("plInv_SupplierRechnungsDatum") & "' AND [plInv_SupplierRechnungsNr] = '" & r.Item("plInv_SupplierRechnungsNr") & "' and [plInv_SupplierCountry] ='" & r.Item("plInv_SupplierCountry") & "'", "FMZOLL")
|
||||
' End If
|
||||
' End If
|
||||
' End If
|
||||
|
||||
' Next
|
||||
|
||||
|
||||
' If message Then MsgBox("alle Währungen gesetzt!")
|
||||
' Return True
|
||||
' End If
|
||||
|
||||
'Else
|
||||
' If message Then MsgBox("keine fehlenden Währungen vorhanden!")
|
||||
' Return False
|
||||
'End If
|
||||
|
||||
|
||||
|
||||
|
||||
End Function
|
||||
|
||||
|
||||
|
||||
End Class
|
||||
|
||||
|
||||
Reference in New Issue
Block a user