UID-Prüfung, etc.

This commit is contained in:
2025-10-27 16:00:32 +01:00
parent 4e6e44e72e
commit 8a8919e44c
6 changed files with 810 additions and 633 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -4,6 +4,7 @@ Imports System.Windows.Media.Animation
Imports com.sun.crypto.provider
Imports com.sun.xml.internal.rngom
Imports GrapeCity.ActiveReports.ReportsCore.Tools
Imports jdk.nashorn.internal.objects.annotations
Imports VERAG_PROG_ALLGEMEIN
Public Class usrCntlBH
@@ -33,7 +34,12 @@ Public Class usrCntlBH
cboAbfVerbFirma.fillWithSQL(" SELECT distinct([Firma]) FROM [VERAG].[dbo].[Filialen] order by [Firma]", False, "FMZOLL", True)
cboAbfVerbFirma.changeItem(VERAG_PROG_ALLGEMEIN.cAllgemein.FIRMA)
cbxFirmaUID.fillWithSQL(" SELECT distinct([Firma]) FROM [VERAG].[dbo].[Filialen] order by [Firma]", False, "FMZOLL", True)
cbxFirmaUID.Items.Add(New MyListItem("AMBAR", "AMBAR"))
cbxFirmaUID.Items.Add(New MyListItem("IMEX", "IMEX"))
cbxFirmaUID.Items.Add(New MyListItem("ATILLA", "ATILLA"))
cbxFirmaUID.Items.Add(New MyListItem("UNISPED", "UNISPED"))
cbxFirmaUID.Items.Add(New MyListItem("VERAG", "VERAG"))
cbxFirmaUID.Items.Add(New MyListItem("", ""))
cbxFirmaUID.changeItem(VERAG_PROG_ALLGEMEIN.cAllgemein.FIRMA)
txtUID_Jahr.Text = Now().Year
@@ -1279,14 +1285,14 @@ Public Class usrCntlBH
If txtUID_Monat.Text = "" OrElse txtUID_Monat.Text <> "" AndAlso IsNumeric(txtUID_Monat.Text) AndAlso CInt(txtUID_Monat.Text) > 0 AndAlso CInt(txtUID_Monat.Text) < 13 Then
Dim SQL_UID As String = "SELECT [uid_KundenNr] as KdNr , Adressen.[Name 1],[uid_UstIdKz] as UstIdKz,[uid_UstIdNr] as UstIdnr, case when [uid_valid] = 1 then 'GUELTIG' else 'UNGUELTIG' end as Ergebnis, cast([uid_Datum] as date) as Pruefdatum,Convert(varchar(8), [uid_Datum], 108) As Pruefzeit, [firma] as Firma, cast(Adressen.UstIdGeprüft as date) as [letzte Prüfung], uid_pruefungstool as Quelle, uid_Sachbearbeiter as Sachbearbeiter
FROM [VERAG].[dbo].[tblUIDPruefung] inner join Adressen on Adressen.AdressenNr = [uid_KundenNr]
where YEAR(uid_Datum) = " & txtUID_Jahr.Text & IIf(txtUID_Monat.Text <> "", " AND MONTH(uid_Datum) = " & txtUID_Monat.Text, "") & IIf(cbxFirmaUID._value <> "", " And [firma] = '" & cbxFirmaUID._value & "'", "") & IIf(cbx_nur_ungueltige.Checked, " AND [uid_valid] = 0 ", "")
Dim SQL_UID As String = "SELECT [uid_KundenNr] as KdNr , Adressen.[Name 1],[uid_UstIdKz] as UstIdKz,[uid_UstIdNr] as UstIdnr, case when [uid_valid] = 1 then 'GUELTIG' else 'UNGUELTIG' end as Ergebnis, cast([uid_Datum] as date) as Pruefdatum,Convert(varchar(8), [uid_Datum], 108) As Pruefzeit, [tblUIDPruefung].[firma] as Firma, cast(Adressen.UstIdGeprüft as date) as [letzte Prüfung], uid_pruefungstool as Quelle, uid_Sachbearbeiter as Sachbearbeiter, Filialen.FilialenNr
FROM [VERAG].[dbo].[tblUIDPruefung] inner join Adressen on Adressen.AdressenNr = [uid_KundenNr] inner Join kunden On KundenNr=AdressenNr inner join Filialen On Filialen.FilialenNr=Kunden.FilialenNr
where YEAR(uid_Datum) = " & txtUID_Jahr.Text & IIf(txtUID_Monat.Text <> "", " AND MONTH(uid_Datum) = " & txtUID_Monat.Text, "") & IIf(cbxFirmaUID._value <> "", " And [tblUIDPruefung].[firma] = '" & cbxFirmaUID._value & "'", "") & IIf(cbx_nur_ungueltige.Checked, " AND [uid_valid] = 0 ", "") & " ORDER BY Filialen.FilialenNr "
Me.Cursor = Cursors.WaitCursor
Dim dt_UID As DataTable = SQL.loadDgvBySql(SQL_UID, "FMZOLL")
If dt_UID.Rows.Count > 0 Then
cProgramFunctions.genExcelFromDT_NEW(dt_UID,,,,,, True)
cProgramFunctions.genExcelFromDT_NEW(dt_UID)
Me.Cursor = Cursors.Default
Else
MsgBox("keine Daten für den ausgewählten Zeitraum!")
@@ -1303,4 +1309,43 @@ Public Class usrCntlBH
Me.Cursor = Cursors.Default
End Try
End Sub
Private Sub txtUID_Monat_TextChanged(sender As Object, e As EventArgs) Handles txtUID_Monat.TextChanged
calcUIDPruefungen()
End Sub
Private Sub cbxFirmaUID_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cbxFirmaUID.SelectedIndexChanged
calcUIDPruefungen()
End Sub
Private Sub calcUIDPruefungen()
If txtUID_Jahr.Text <> "" AndAlso IsNumeric(txtUID_Jahr.Text) AndAlso txtUID_Jahr.Text.Length = 4 Then
If txtUID_Monat.Text = "" OrElse txtUID_Monat.Text <> "" AndAlso IsNumeric(txtUID_Monat.Text) AndAlso CInt(txtUID_Monat.Text) > 0 AndAlso CInt(txtUID_Monat.Text) < 13 Then
Dim SQL_FIRMA As String = ""
Select Case cbxFirmaUID._value
Case "AMBAR" : SQL_FIRMA = " And Filialen.FilialenNr IN (5701)"
Case "IMEX" : SQL_FIRMA = " And Filialen.FilialenNr IN (5501)"
Case "ATILLA" : SQL_FIRMA = " And Filialen.FilialenNr IN (4801)"
Case "UNISPED" : SQL_FIRMA = " AND Filialen.firma='UNISPED' "
Case "VERAG" : SQL_FIRMA = " AND Filialen.firma='VERAG' "
Case Else : SQL_FIRMA = ""
End Select
Dim Month As Integer = CInt(txtUID_Monat.Text).ToString("D2")
Dim Year As Integer = CInt(txtUID_Jahr.Text)
Dim datum = CDate("15." & Month & "." & Year).AddMonths(-1)
Dim SQL_UID_zupruefen As String = "Select count(*) From [Adressen] inner Join kunden On KundenNr=AdressenNr inner join Filialen On Filialen.FilialenNr=Kunden.FilialenNr where(UstIdGeprüft <= '" & datum & "' OR UstIdGeprüft is null) and (Adressen.UstIdKz is not null And Auswahl='A'" & SQL_FIRMA & ")"
lblUID_zupruefen.Text = "nicht geprüft: " & SQL.getValueTxtBySql(SQL_UID_zupruefen, "FMZOLL",,, "0")
End If
End If
End Sub
End Class