684 lines
29 KiB
VB.net
684 lines
29 KiB
VB.net
Imports System.Security.Claims
|
|
Imports DAKOSY_Worker.DEXPSD
|
|
Imports DocumentFormat.OpenXml.Drawing.Diagrams
|
|
Imports VERAG_PROG_ALLGEMEIN
|
|
|
|
Public Class usrCntlQualitaetskontrolle
|
|
Implements FormualrInterface
|
|
|
|
Public Event CHANGED(name, value)
|
|
Public Event KDNR_CHANGED(kdnr)
|
|
Public Event DELETE(c As Control)
|
|
Public Event MOVE_UP(c As Control)
|
|
Public Event MOVE_DOWN(c As Control)
|
|
Dim FV_ID = -1
|
|
Public KdNR As Integer = -1
|
|
Public KdFirma As String = ""
|
|
Public SENDUNG As VERAG_PROG_ALLGEMEIN.cSendungen = Nothing
|
|
Public AVISO As VERAG_PROG_ALLGEMEIN.cAviso = Nothing
|
|
Public EZA_Nr As String
|
|
Public CRN As String
|
|
Dim packstueckeZOLL_TMP As String = ""
|
|
Dim Normen, normenSpeziell, normenAllg As New DataTable
|
|
Dim NormenpreisAllg As Double
|
|
Dim NormenpreisSpez As Double
|
|
|
|
Dim EZOLL_SQL = "EZOLL"
|
|
Sub New()
|
|
|
|
' Dieser Aufruf ist für den Designer erforderlich.
|
|
InitializeComponent()
|
|
|
|
' Fügen Sie Initialisierungen nach dem InitializeComponent()-Aufruf hinzu.
|
|
|
|
End Sub
|
|
|
|
Sub New(param() As Object)
|
|
|
|
' Dieser Aufruf ist für den Designer erforderlich.
|
|
InitializeComponent()
|
|
|
|
If param.Length > 0 AndAlso param(0) IsNot Nothing Then KdNR = param(0)
|
|
If param.Length > 1 Then KdFirma = param(1)
|
|
If param.Length > 2 Then SENDUNG = param(2)
|
|
If param.Length > 3 Then AVISO = param(3)
|
|
' Fügen Sie Initialisierungen nach dem InitializeComponent()-Aufruf hinzu.
|
|
|
|
End Sub
|
|
Public Sub ChangeKDNr(kdnr As Integer) _
|
|
Implements FormualrInterface.ChangeKDNr
|
|
initKdNR(kdnr)
|
|
End Sub
|
|
|
|
'Dim KdNR As Integer = -1
|
|
Sub initControlsHandler()
|
|
For Each c In Me.Controls
|
|
Select Case c.GetType.ToString
|
|
Case GetType(VERAG_PROG_ALLGEMEIN.MyTextBox).ToString
|
|
AddHandler DirectCast(c, VERAG_PROG_ALLGEMEIN.MyTextBox).Leave, Sub()
|
|
RaiseEvent CHANGED(c.name, c.text)
|
|
End Sub
|
|
Case GetType(VERAG_PROG_ALLGEMEIN.MyComboBox).ToString
|
|
AddHandler DirectCast(c, VERAG_PROG_ALLGEMEIN.MyComboBox).SelectedIndexChanged, Sub()
|
|
RaiseEvent CHANGED(c.name, c._value)
|
|
End Sub
|
|
Case GetType(TextBox).ToString
|
|
AddHandler DirectCast(c, TextBox).Leave, Sub()
|
|
RaiseEvent CHANGED(c.name, c.text)
|
|
End Sub
|
|
End Select
|
|
Next
|
|
|
|
End Sub
|
|
|
|
|
|
Private Sub btn_Click(sender As Object, e As EventArgs) Handles btn.Click
|
|
Dim kdsrch As New SDL.frmKundenSuche
|
|
If kdsrch.ShowDialog(Me) = System.Windows.Forms.DialogResult.OK Then
|
|
If IsNumeric(kdsrch.kundenNrSearch.Text) Then
|
|
initKdNR(kdsrch.kundenNrSearch.Text)
|
|
RaiseEvent KDNR_CHANGED(KdNR)
|
|
End If
|
|
End If
|
|
' Panel1.Enabled = True
|
|
End Sub
|
|
|
|
|
|
|
|
Public Sub initSND()
|
|
If SENDUNG IsNot Nothing Then
|
|
txtFilialNr.Text = SENDUNG.FilialenNr.ToString
|
|
txtAbfNr.Text = SENDUNG.AbfertigungsNr.ToString
|
|
txtGewicht.Text &= " kg"
|
|
If SENDUNG.tblSnd_AbsenderKdNr > 0 Then
|
|
Dim ADRESSE As New VERAG_PROG_ALLGEMEIN.cAdressen(SENDUNG.tblSnd_AbsenderKdNr)
|
|
txtPackFirma.Text = If(ADRESSE.Name_1, "") & If(If(ADRESSE.Name_2, "") <> "", " " & ADRESSE.Name_2, "")
|
|
txtPackAdresse1.Text = If(ADRESSE.Straße, "")
|
|
txtPackAdresse2.Text = (If(ADRESSE.LandKz, "") & " " & If(ADRESSE.PLZ, "") & " " & If(ADRESSE.Ort, "")).ToString.Trim
|
|
Else
|
|
txtPackFirma.Text = SENDUNG.tblSnd_Absender
|
|
End If
|
|
End If
|
|
If AVISO IsNot Nothing Then
|
|
txtLKWKennz.Text = If(AVISO.LKW_Nr, "")
|
|
End If
|
|
End Sub
|
|
|
|
Public Sub initKdNR(KdNR)
|
|
If KdNR > 0 Then
|
|
Me.KdNR = KdNR
|
|
|
|
Dim KUNDE As New VERAG_PROG_ALLGEMEIN.cKunde(KdNR)
|
|
Dim ADRESSE As New VERAG_PROG_ALLGEMEIN.cAdressen(KdNR)
|
|
|
|
txtFirma.Text = If(ADRESSE.Name_1, "") & If(If(ADRESSE.Name_2, "") <> "", " " & ADRESSE.Name_2, "")
|
|
txtAdresse1.Text = If(ADRESSE.Straße, "")
|
|
txtAdresse2.Text = (If(ADRESSE.LandKz, "") & " " & If(ADRESSE.PLZ, "") & " " & If(ADRESSE.Ort, "")).ToString.Trim
|
|
' txtAnsprechpartnerVERAG.Text = If(ADRESSE.Ansprechpartner, "")
|
|
Else
|
|
txtFirma.Text = KdFirma
|
|
End If
|
|
|
|
End Sub
|
|
|
|
|
|
Private Sub btnDel_Click(sender As Object, e As EventArgs) Handles btnDel.Click
|
|
RaiseEvent DELETE(Me)
|
|
End Sub
|
|
|
|
Private Sub btnup_Click(sender As Object, e As EventArgs) Handles btnUp.Click
|
|
RaiseEvent MOVE_UP(Me)
|
|
End Sub
|
|
|
|
Private Sub btnDown_Click(sender As Object, e As EventArgs) Handles btnDown.Click
|
|
RaiseEvent MOVE_DOWN(Me)
|
|
End Sub
|
|
|
|
|
|
Private Sub usrCntlZollbeschau_Load(sender As Object, e As EventArgs) Handles Me.Load
|
|
|
|
|
|
EZOLL_SQL = "EZOLL"
|
|
Select Case VERAG_PROG_ALLGEMEIN.cAllgemein.FIRMA
|
|
Case "UNISPED" : EZOLL_SQL = "EZOLL_UNISPED"
|
|
End Select
|
|
|
|
|
|
initControlsHandler()
|
|
'txtAnsprechpartnerVERAG.Text = VERAG_PROG_ALLGEMEIN.cAllgemein.USRNAME
|
|
txtBeschauDat.Text = Date.Today.ToString("dd.MM.yyyy")
|
|
|
|
cbxEinf.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("Einfuhr", "E"))
|
|
cbxEinf.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("Ausfuhr", "A"))
|
|
cbxEinf.changeItem("E")
|
|
|
|
cbxTyp.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("Obst und Gemüse", "O"))
|
|
cbxTyp.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("Bananen", "B"))
|
|
cbxTyp.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("Eier und Gefl.", "E"))
|
|
|
|
cboZollstelle.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("ZA Österreich / Zst Nickelsdorf", "NKD"))
|
|
cboZollstelle.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("ZA Österreich / Zst Spielfeld", "SFD"))
|
|
' cboZollstelle.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("ZA Österreich / Zst Salzburg", "SBG"))
|
|
' cboZollstelle.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("ZA Österreich / Zst Suben", "SUB"))
|
|
cboZollstelle.changeItem("NKD")
|
|
|
|
cbxUrsprungslang.fillWithSQL("SELECT [Länderverzeichnis für die Außenhandelsstatistik].LandKz, [Länderverzeichnis für die Außenhandelsstatistik].LandBez FROM [Länderverzeichnis für die Außenhandelsstatistik] ORDER BY [Länderverzeichnis für die Außenhandelsstatistik].LandKz; ", True, "VERAG", True)
|
|
cbxBestimmungsland.Items.AddRange(cbxUrsprungslang.Items.Cast(Of VERAG_PROG_ALLGEMEIN.MyListItem).ToArray())
|
|
|
|
Dim sql As New VERAG_PROG_ALLGEMEIN.SQL
|
|
|
|
Normen = sql.loadDgvBySql("select * from tblVermarktungsnormen", "FMZOLL")
|
|
|
|
Dim dvAllgNormen = New DataView(Normen)
|
|
Dim dvSpezNormen = New DataView(Normen)
|
|
dvSpezNormen.RowFilter = "speziell = true"
|
|
dvAllgNormen.RowFilter = "speziell = false"
|
|
|
|
normenSpeziell = dvSpezNormen.ToTable
|
|
normenAllg = dvAllgNormen.ToTable
|
|
|
|
NormenpreisAllg = CDbl(sql.getValueTxtBySql("select top(1) betrag FROM tblVermarktungsnormenGebuehren where gueltigAb <= GETDATE() and [speziell] = 0 order by gueltigAb desc", "FMZOLL"))
|
|
NormenpreisSpez = CDbl(sql.getValueTxtBySql("select top(1) betrag FROM tblVermarktungsnormenGebuehren where gueltigAb <= GETDATE() and [speziell] = 1 order by gueltigAb desc", "FMZOLL"))
|
|
|
|
If SENDUNG IsNot Nothing Then
|
|
If SENDUNG.tblSnd_DakosyRef <> "" Then
|
|
loadEZollData(SENDUNG.tblSnd_DakosyRef)
|
|
ElseIf SENDUNG.FilialenNr > 0 AndAlso SENDUNG.AbfertigungsNr > 0 Then
|
|
Dim ref = SENDUNG.FilialenNr.ToString & "/" & SENDUNG.AbfertigungsNr.ToString
|
|
loadEZollData(ref)
|
|
End If
|
|
|
|
End If
|
|
|
|
initKdNR(KdNR)
|
|
initSND()
|
|
|
|
End Sub
|
|
|
|
Private Sub pic_Click(sender As Object, e As EventArgs) Handles pic.Click
|
|
FormularManagerNEU.genPDF(Me, True)
|
|
End Sub
|
|
|
|
|
|
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
|
|
If KdNR > 0 Then
|
|
Dim f As New frmKundenUebersichtZOLL(KdNR)
|
|
f.ShowDialog(Me)
|
|
End If
|
|
End Sub
|
|
|
|
|
|
|
|
Private Sub dtpBeschauDat_ValueChanged(sender As Object, e As EventArgs) Handles dtpBeschauDat.ValueChanged
|
|
txtBeschauDat._value = CDate(sender.value).ToShortDateString
|
|
End Sub
|
|
|
|
|
|
Private Sub loadDGV(dt As DataTable)
|
|
|
|
Dim couter As Integer = 1
|
|
Dim checkKNCode As Boolean = False
|
|
Dim speziellOderAllg As String = ""
|
|
For Each row As DataRow In dt.Rows
|
|
|
|
|
|
If row("ComCd") <> "" Then
|
|
checkKNCode = True
|
|
checkifAllgemeinOderSpeziell(row("ComCd"), speziellOderAllg)
|
|
End If
|
|
couter = +1
|
|
dgvPositionen.Rows.Add(row("ItNr"), row("Nr"), row("Kind"), row("GdsDes"), row("Net"), row("ComCd"), speziellOderAllg)
|
|
Next
|
|
|
|
If checkKNCode Then initdgvGebuehren(True)
|
|
|
|
End Sub
|
|
|
|
Private Sub dgvPositionen_DefaultValuesNeeded(sender As Object, e As DataGridViewRowEventArgs) Handles dgvPositionen.DefaultValuesNeeded
|
|
|
|
e.Row.Cells("pos").Value = dgvPositionen.Rows.Count
|
|
End Sub
|
|
|
|
Private Sub loadEZollData(EZA_Nr As String)
|
|
|
|
Dim KDSQL As New SQL
|
|
Dim notFound As Boolean = True
|
|
|
|
'EZA_Nr = "4/23208/15"
|
|
|
|
Try
|
|
txtLRN.Text = EZA_Nr
|
|
Dim dEZOLL As DataTable = KDSQL.loadDgvBySql("SELECT LizenzNr, OperatorID, VorgangID, AnmID, GeaendertAm, GeaendertVon, CRN, LRN" &
|
|
" FROM zsAnmRefs" &
|
|
" WHERE (VorgangID = 'EF') AND (LRN = '" & EZA_Nr & "')" &
|
|
" ORDER BY GeaendertAm DESC", EZOLL_SQL)
|
|
|
|
If dEZOLL Is Nothing Then MsgBox("Keine Daten im EZOLL vorhanden, Daten können nicht geladen werden!") : Exit Sub
|
|
If dEZOLL.Rows.Count = 0 Then MsgBox("Keine Daten im EZOLL vorhanden, Daten können nicht geladen werden!") : Exit Sub
|
|
|
|
Dim DR_zsAnmRefs As DataRow = dEZOLL.Rows(0)
|
|
notFound = False
|
|
If DR_zsAnmRefs.Item("CRN") IsNot DBNull.Value Then CRN = DR_zsAnmRefs.Item("CRN")
|
|
|
|
Dim DTzsAnmTransp As DataTable = KDSQL.loadDgvBySql("SELECT DepIdnt, DepNat, CrossIdntNat" &
|
|
" FROM zsAnmTransp" &
|
|
" WHERE (LizenzNr = '" & DR_zsAnmRefs.Item("LizenzNr") & "') And (OperatorID = " & DR_zsAnmRefs.Item("OperatorID") & ") And (VorgangID = '" & DR_zsAnmRefs.Item("VorgangID") & "') And (AnmID = " & DR_zsAnmRefs.Item("AnmID") & ")", EZOLL_SQL)
|
|
|
|
If DTzsAnmTransp IsNot Nothing AndAlso DTzsAnmTransp.Rows().Count > 0 Then
|
|
If Not IsNull(DTzsAnmTransp.Rows(0).Item("DepIdnt")) Then txtLKWKennz.Text = Strings.Left(DTzsAnmTransp.Rows(0).Item("DepIdnt"), 25)
|
|
If Not IsNull(DTzsAnmTransp.Rows(0).Item("DepNat")) Then cbxBestimmungsland.changeItem(DTzsAnmTransp.Rows(0).Item("DepNat"))
|
|
' If Not IsNull(DTzsAnmTransp.Rows(0).Item("CrossIdntNat")) Then cbxUrsprungslang.changeItem(DTzsAnmTransp.Rows(0).Item("CrossIdntNat"))
|
|
End If
|
|
|
|
' Tabelle zsAnmConorTra lesen.
|
|
Dim DTzsAnmConorTra As DataTable = KDSQL.loadDgvBySql("SELECT Na, Pst, Cty,Strt, Ctry" &
|
|
" FROM zsAnmConorTra" &
|
|
" WHERE (LizenzNr = '" & DR_zsAnmRefs.Item("LizenzNr") & "') And (OperatorID = " & DR_zsAnmRefs.Item("OperatorID") & ") And (VorgangID = '" & DR_zsAnmRefs.Item("VorgangID") & "') And (AnmID = " & DR_zsAnmRefs.Item("AnmID") & ")", EZOLL_SQL)
|
|
|
|
If DTzsAnmConorTra IsNot Nothing AndAlso DTzsAnmConorTra.Rows().Count > 0 Then
|
|
If SENDUNG Is Nothing OrElse SENDUNG.tblSnd_AbsenderKdNr <= 0 Then
|
|
If Not IsNull(DTzsAnmConorTra.Rows(0).Item("Na")) Then txtPackFirma.Text = Strings.Left(DTzsAnmConorTra.Rows(0).Item("Na"), 50)
|
|
If Not IsNull(DTzsAnmConorTra.Rows(0).Item("Pst")) Then
|
|
txtPackAdresse1.Text = ""
|
|
txtPackAdresse2.Text = ""
|
|
If Not IsNull(DTzsAnmConorTra.Rows(0).Item("Strt")) Then txtPackAdresse1.Text &= Strings.Left(DTzsAnmConorTra.Rows(0).Item("Strt"), 50) & " "
|
|
If Not IsNull(DTzsAnmConorTra.Rows(0).Item("Ctry")) Then txtPackAdresse2.Text &= Strings.Left(DTzsAnmConorTra.Rows(0).Item("Ctry"), 50) & " "
|
|
If Not IsNull(DTzsAnmConorTra.Rows(0).Item("Pst")) Then txtPackAdresse2.Text &= Strings.Left(DTzsAnmConorTra.Rows(0).Item("Pst"), 50) & " "
|
|
If Not IsNull(DTzsAnmConorTra.Rows(0).Item("Cty")) Then txtPackAdresse2.Text &= Strings.Left(DTzsAnmConorTra.Rows(0).Item("Cty"), 50) & " "
|
|
End If
|
|
End If
|
|
If Not IsNull(DTzsAnmConorTra.Rows(0).Item("Ctry")) Then cbxUrsprungslang.changeItem(DTzsAnmConorTra.Rows(0).Item("Ctry"))
|
|
End If
|
|
|
|
|
|
|
|
' Tabelle zsAnmConeeTra lesen.
|
|
Dim DTzsAnmConeeTra As DataTable = KDSQL.loadDgvBySql("SELECT Na, Pst, Cty,Strt, Ctry" &
|
|
" FROM zsAnmConeeTra" &
|
|
" WHERE (LizenzNr = '" & DR_zsAnmRefs.Item("LizenzNr") & "') And (OperatorID = " & DR_zsAnmRefs.Item("OperatorID") & ") And (VorgangID = '" & DR_zsAnmRefs.Item("VorgangID") & "') And (AnmID = " & DR_zsAnmRefs.Item("AnmID") & ")", EZOLL_SQL)
|
|
|
|
If DTzsAnmConeeTra IsNot Nothing AndAlso DTzsAnmConeeTra.Rows().Count > 0 Then
|
|
If SENDUNG Is Nothing OrElse SENDUNG.tblSnd_EmpfaengerKdNr <= 0 Then
|
|
If Not IsNull(DTzsAnmConeeTra.Rows(0).Item("Na")) Then txtFirma.Text = Strings.Left(DTzsAnmConeeTra.Rows(0).Item("Na"), 50)
|
|
If Not IsNull(DTzsAnmConeeTra.Rows(0).Item("Pst")) Then
|
|
txtAdresse1.Text = ""
|
|
txtAdresse2.Text = ""
|
|
If Not IsNull(DTzsAnmConeeTra.Rows(0).Item("Strt")) Then txtAdresse1.Text &= Strings.Left(DTzsAnmConeeTra.Rows(0).Item("Strt"), 50) & " "
|
|
If Not IsNull(DTzsAnmConeeTra.Rows(0).Item("Ctry")) Then txtAdresse2.Text &= Strings.Left(DTzsAnmConeeTra.Rows(0).Item("Ctry"), 50) & " "
|
|
If Not IsNull(DTzsAnmConeeTra.Rows(0).Item("Pst")) Then txtAdresse2.Text &= Strings.Left(DTzsAnmConeeTra.Rows(0).Item("Pst"), 50) & " "
|
|
If Not IsNull(DTzsAnmConeeTra.Rows(0).Item("Cty")) Then txtAdresse2.Text &= Strings.Left(DTzsAnmConeeTra.Rows(0).Item("Cty"), 50) & " "
|
|
End If
|
|
End If
|
|
'If Not IsNull(DTzsAnmConeeTra.Rows(0).Item("Na")) Then SPEDITIONSBUCH.Empfänger = Strings.Left(DTzsAnmConeeTra.Rows(0).Item("Na"), 50)
|
|
'If Not IsNull(DTzsAnmConeeTra.Rows(0).Item("Ctry")) Then SPEDITIONSBUCH.Empfänger = Strings.Left(SPEDITIONSBUCH.Empfänger & ", " & DTzsAnmConeeTra.Rows(0).Item("Ctry"), 50)
|
|
'If Not IsNull(DTzsAnmConeeTra.Rows(0).Item("Pst")) Then SPEDITIONSBUCH.Empfänger = Strings.Left(SPEDITIONSBUCH.Empfänger & ", " & DTzsAnmConeeTra.Rows(0).Item("Pst"), 50)
|
|
'If Not IsNull(DTzsAnmConeeTra.Rows(0).Item("Cty")) Then SPEDITIONSBUCH.Empfänger = Strings.Left(SPEDITIONSBUCH.Empfänger & ", " & DTzsAnmConeeTra.Rows(0).Item("Cty"), 50)
|
|
If Not IsNull(DTzsAnmConeeTra.Rows(0).Item("Ctry")) Then cbxBestimmungsland.changeItem(DTzsAnmConeeTra.Rows(0).Item("Ctry"))
|
|
End If
|
|
|
|
|
|
' Tabelle zsAnmHea lesen.
|
|
Dim DTzsAnmHea As DataTable = KDSQL.loadDgvBySql("SELECT TotItem, TotPack, TotGross" &
|
|
" FROM zsAnmHea" &
|
|
" WHERE (LizenzNr = '" & DR_zsAnmRefs.Item("LizenzNr") & "') And (OperatorID = " & DR_zsAnmRefs.Item("OperatorID") & ") And (VorgangID = '" & DR_zsAnmRefs.Item("VorgangID") & "') And (AnmID = " & DR_zsAnmRefs.Item("AnmID") & ")", EZOLL_SQL)
|
|
|
|
If DTzsAnmHea IsNot Nothing AndAlso DTzsAnmHea.Rows().Count > 0 Then
|
|
If Not IsNull(DTzsAnmHea.Rows(0).Item("TotPack")) Then txtAnzVerp.Text = DTzsAnmHea.Rows(0).Item("TotPack") 'Gesamt packstücke
|
|
If Not IsNull(DTzsAnmHea.Rows(0).Item("TotGross")) Then txtGewicht.Text = DTzsAnmHea.Rows(0).Item("TotGross") ' Gesamtbruttogewicht
|
|
If Not IsNull(DTzsAnmHea.Rows(0).Item("TotItem")) Then txtPos.Text = DTzsAnmHea.Rows(0).Item("TotItem") ' Anzahl Pos
|
|
|
|
End If
|
|
|
|
berechneDGVSum()
|
|
|
|
' Tabelle zsAnmGdsitem lesen.
|
|
Dim DTzsAnmGdsitem As DataTable = KDSQL.loadDgvBySql("SELECT item.ItNr ,item.GdsDes , item.Net, pack.Kind, pack.Nr, item.Orig, item.ComCd" &
|
|
" FROM zsAnmGdsitem as item" &
|
|
" INNER JOIN zsAnmGdsItemPack as pack ON item.LizenzNr = pack.LizenzNr And item.OperatorID = pack.OperatorID and item.VorgangID = pack.VorgangID and pack.AnmID = item.AnmID" &
|
|
" WHERE (item.LizenzNr = '" & DR_zsAnmRefs.Item("LizenzNr") & "') And (item.OperatorID = " & DR_zsAnmRefs.Item("OperatorID") & ") And (item.VorgangID = '" & DR_zsAnmRefs.Item("VorgangID") & "') And (item.AnmID = " & DR_zsAnmRefs.Item("AnmID") & " and item.GdsItemID = pack.GdsItemID)" &
|
|
" ORDER BY item.GdsItemID", EZOLL_SQL)
|
|
|
|
|
|
If DTzsAnmGdsitem IsNot Nothing AndAlso DTzsAnmGdsitem.Rows().Count > 0 Then
|
|
|
|
loadDGV(DTzsAnmGdsitem)
|
|
|
|
End If
|
|
Catch ex As Exception
|
|
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR("Fehler EZOLL Personal: " & vbNewLine & ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
|
|
|
|
End Try
|
|
|
|
|
|
End Sub
|
|
|
|
Function IsNull(o) As Boolean
|
|
Try
|
|
If o Is Nothing Then Return True
|
|
If o Is DBNull.Value Then Return True
|
|
If o.ToString.Trim = "" Then Return True
|
|
Catch : End Try
|
|
Return False
|
|
End Function
|
|
Function berechneDGVSum() As Boolean
|
|
Dim sumPk As Integer = 0
|
|
Dim sumKg As Double = 0
|
|
Dim sumPos As Integer = 0
|
|
|
|
For Each r As DataGridViewRow In dgvPositionen.Rows
|
|
sumPos += 1
|
|
If IsNumeric(r.Cells(1).Value) Then sumPk += r.Cells(1).Value
|
|
If IsNumeric(r.Cells(4).Value) Then sumKg += r.Cells(4).Value
|
|
Next
|
|
txtAnzVerp.Text = sumPk
|
|
txtGewicht.Text = sumKg
|
|
txtPos.Text = sumPos - 1
|
|
|
|
End Function
|
|
|
|
Private Sub dgvPositionen_CellValueChanged(sender As Object, e As DataGridViewCellEventArgs) Handles dgvPositionen.CellValueChanged
|
|
Dim gewicht As Double = 0
|
|
Dim colli As Double = 0
|
|
Dim checkKNCode As Boolean = False
|
|
|
|
For Each r As DataGridViewRow In dgvPositionen.Rows
|
|
|
|
|
|
If r IsNot Nothing And IsNumeric(r.Cells(4).Value) Then
|
|
gewicht += CDbl(r.Cells(4).Value)
|
|
End If
|
|
|
|
If r IsNot Nothing And IsNumeric(r.Cells(1).Value) Then
|
|
colli += CDbl(r.Cells(1).Value)
|
|
End If
|
|
|
|
|
|
If r IsNot Nothing And r.Cells(5).Value <> "" Then
|
|
checkKNCode = True
|
|
checkifAllgemeinOderSpeziell(r.Cells(5).Value, r.Cells(6).Value)
|
|
End If
|
|
|
|
Next
|
|
|
|
txtGewicht.Text = gewicht & " kg"
|
|
txtAnzVerp.Text = colli
|
|
|
|
If checkKNCode Then initdgvGebuehren(True)
|
|
|
|
End Sub
|
|
|
|
Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
|
|
dgvPositionen.Rows.Clear()
|
|
|
|
If txtLRN.Text <> "" Then
|
|
loadEZollData(txtLRN.Text)
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub dgvPositionen_RowsAdded(sender As Object, e As DataGridViewRowsAddedEventArgs) Handles dgvPositionen.RowsAdded
|
|
berechneDGVSum()
|
|
initdgvGebuehren(True)
|
|
End Sub
|
|
|
|
Private Sub dgvPositionen_RowsRemoved(sender As Object, e As DataGridViewRowsRemovedEventArgs) Handles dgvPositionen.RowsRemoved
|
|
berechneDGVSum()
|
|
initdgvGebuehren(True)
|
|
End Sub
|
|
|
|
Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click
|
|
|
|
If dgvGebuehren.Rows.Count = 0 Then Exit Sub
|
|
|
|
Dim PERSONAL As SDL.cPersonal = Nothing
|
|
Dim frmSecureLoginKassenbuch As New SDL.frmSecureLoginKassenbuch
|
|
If frmSecureLoginKassenbuch.ShowDialog(Me) = DialogResult.OK Then
|
|
PERSONAL = frmSecureLoginKassenbuch.PERSONAL
|
|
Dim f As New frmBelegNeu(PERSONAL, Nothing, "E")
|
|
|
|
AddHandler f.LOADED, Sub()
|
|
f.AddPositions(dgvGebuehren, False)
|
|
End Sub
|
|
f.ShowDialog(Me)
|
|
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Private Sub btnVermarktungsnorman_Click(sender As Object, e As EventArgs) Handles btnVermarktungsnorman.Click
|
|
|
|
|
|
Try
|
|
|
|
Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL
|
|
Dim frm As New Form
|
|
Dim dgv As New DataGridView()
|
|
Dim dt As DataTable = SQL.loadDgvBySql("SELECT * from tblVermarktungsnormen order by kncode ", "FMZOLL")
|
|
|
|
dgv.DataSource = dt
|
|
If dgv IsNot Nothing Then
|
|
frm.Size = New Size(300, 700)
|
|
dgv.Size = New Size(frm.Size.Width - 10, frm.Size.Height - 10)
|
|
dgv.Dock = DockStyle.Fill
|
|
dgv.Anchor = AnchorStyles.Left
|
|
dgv.Anchor = AnchorStyles.Top
|
|
dgv.ReadOnly = True
|
|
frm.Controls.Add(dgv)
|
|
frm.StartPosition = FormStartPosition.CenterScreen
|
|
frm.ShowDialog()
|
|
End If
|
|
|
|
|
|
Catch ex As System.Exception
|
|
|
|
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
|
|
End Try
|
|
|
|
|
|
End Sub
|
|
|
|
Private Sub btnPreise_Click(sender As Object, e As EventArgs) Handles btnPreise.Click
|
|
|
|
|
|
Try
|
|
|
|
Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL
|
|
Dim frm As New Form
|
|
Dim dgv As New DataGridView()
|
|
Dim dt As DataTable = SQL.loadDgvBySql("SELECT * from tblVermarktungsnormenGebuehren ", "FMZOLL")
|
|
|
|
dgv.DataSource = dt
|
|
If dgv IsNot Nothing Then
|
|
frm.Size = New Size(500, 200)
|
|
dgv.Size = New Size(frm.Size.Width - 10, frm.Size.Height - 10)
|
|
dgv.Dock = DockStyle.Fill
|
|
dgv.Anchor = AnchorStyles.Left
|
|
dgv.Anchor = AnchorStyles.Top
|
|
dgv.ReadOnly = True
|
|
frm.Controls.Add(dgv)
|
|
frm.StartPosition = FormStartPosition.CenterScreen
|
|
frm.ShowDialog()
|
|
End If
|
|
|
|
|
|
Catch ex As System.Exception
|
|
|
|
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
|
|
End Try
|
|
|
|
|
|
End Sub
|
|
|
|
|
|
Private Sub checkifAllgemeinOderSpeziell(ByRef codeKND As String, ByRef speziell As String)
|
|
|
|
Dim found As Boolean = False
|
|
|
|
If codeKND <> "" Then
|
|
|
|
For Each row As DataRow In normenSpeziell.Rows
|
|
Dim code = row("kncode").ToString.Trim().Replace(" ", "")
|
|
Dim searchedCode = codeKND
|
|
If code.Length < searchedCode.Length Then
|
|
searchedCode = searchedCode.ToString.Substring(0, code.Length)
|
|
End If
|
|
|
|
If code = searchedCode Then
|
|
If speziell <> "spez." Then speziell = "spez."
|
|
|
|
found = True
|
|
Exit For
|
|
End If
|
|
|
|
Next
|
|
|
|
If Not found Then
|
|
|
|
For Each row As DataRow In normenAllg.Rows
|
|
Dim code = row("kncode").ToString.Trim().Replace(" ", "")
|
|
Dim searchedCode = codeKND
|
|
If code.Length < searchedCode.Length Then
|
|
searchedCode = searchedCode.ToString.Substring(0, code.Length)
|
|
End If
|
|
If code = searchedCode Then
|
|
If speziell <> "allg" Then speziell = "allg"
|
|
found = True
|
|
Exit For
|
|
End If
|
|
|
|
Next
|
|
|
|
|
|
End If
|
|
|
|
If Not found Then
|
|
If speziell <> "allg-NIL" Then speziell = "allg-NIL"
|
|
End If
|
|
End If
|
|
|
|
|
|
End Sub
|
|
|
|
Private Sub initdgvGebuehren(initDatatable As Boolean)
|
|
|
|
Try
|
|
|
|
If dgvGebuehren IsNot Nothing AndAlso dgvGebuehren.Rows.Count > 0 Then dgvGebuehren.Rows.Clear()
|
|
Dim posVorhanden As Boolean = False
|
|
|
|
If dgvPositionen.Rows.Count <1 Then Exit Sub
|
|
|
|
|
|
If normenSpeziell.Rows.Count < 1 Or normenSpeziell.Rows.Count < 1 Then Exit Sub
|
|
|
|
Dim tableResultGroup As New DataTable
|
|
|
|
If initDatatable Then
|
|
|
|
|
|
Dim tableResult As New DataTable
|
|
For Each column As DataGridViewColumn In dgvPositionen.Columns
|
|
If column.HeaderText.ToLower().Contains("spez/allg") Then tableResult.Columns.Add(column.HeaderText, GetType(String))
|
|
If column.HeaderText.ToLower().Contains("kncode") Then tableResult.Columns.Add(column.HeaderText, GetType(String))
|
|
If column.HeaderText.ToLower().Contains("gewicht") Then tableResult.Columns.Add(column.HeaderText, GetType(Double))
|
|
Next
|
|
|
|
For Each row As DataGridViewRow In dgvPositionen.Rows
|
|
tableResult.Rows.Add()
|
|
For Each cell As DataGridViewCell In row.Cells
|
|
If cell.Value IsNot Nothing AndAlso cell.Value.ToString() <> "" Then
|
|
If cell.ColumnIndex() = 4 Then tableResult.Rows(tableResult.Rows.Count - 1)(0) = cell.Value.ToString()
|
|
If cell.ColumnIndex() = 5 Then tableResult.Rows(tableResult.Rows.Count - 1)(1) = cell.Value.ToString()
|
|
If cell.ColumnIndex() = 6 Then tableResult.Rows(tableResult.Rows.Count - 1)(2) = cell.Value.ToString()
|
|
End If
|
|
|
|
Next
|
|
Next
|
|
|
|
Dim groups = tableResult.AsEnumerable().
|
|
GroupBy(Function(row) New With {
|
|
Key .Id = row.Field(Of String)("spez/allg"),
|
|
Key .Multi = row.Field(Of String)("kncode")
|
|
})
|
|
|
|
tableResultGroup = tableResult.Clone()
|
|
|
|
For Each grp In groups
|
|
|
|
tableResultGroup.Rows.Add(
|
|
grp.Sum(Function(row)
|
|
Dim value = 0
|
|
If Not IsDBNull(row.Item("gewicht")) Then value = row.Item("gewicht")
|
|
Return value
|
|
End Function), grp.Key.Multi, grp.Key.Id)
|
|
Next
|
|
|
|
|
|
End If
|
|
Dim sumNormenAllg As Double = 0
|
|
Dim sumNormenSpez As Double = 0
|
|
|
|
Dim antrag, verzicht, idk As Double
|
|
antrag = 40.7
|
|
verzicht = 9.3
|
|
idk = 39.4
|
|
|
|
|
|
'If Not posVorhanden Then Exit Sub
|
|
|
|
For Each r In tableResultGroup.Rows
|
|
If Not IsDBNull(r("gewicht")) AndAlso IsNumeric(r("gewicht")) AndAlso Not IsDBNull(r("spez/allg")) Then
|
|
If r("spez/allg") = "spez." Then
|
|
sumNormenSpez += CDbl(r("gewicht"))
|
|
ElseIf r("spez/allg").ToString.Contains("allg") Then
|
|
sumNormenAllg += CDbl(r("gewicht"))
|
|
End If
|
|
End If
|
|
|
|
Next
|
|
|
|
If sumNormenAllg > 0 Then
|
|
Dim anzAllg As Integer
|
|
anzAllg = Math.Ceiling(sumNormenAllg / 1000)
|
|
dgvGebuehren.Rows.Add("Allgemein", sumNormenAllg, NormenpreisAllg, anzAllg, anzAllg * NormenpreisAllg)
|
|
End If
|
|
If sumNormenSpez > 0 Then
|
|
Dim anzSpez As Integer
|
|
anzSpez = Math.Ceiling(sumNormenSpez / 1000)
|
|
dgvGebuehren.Rows.Add("Speziell", sumNormenSpez, NormenpreisSpez, anzSpez, anzSpez * NormenpreisSpez)
|
|
End If
|
|
|
|
|
|
|
|
|
|
If cbxVerzicht.Checked Then
|
|
dgvGebuehren.Rows.Clear()
|
|
dgvGebuehren.Rows.Add("Antrag", "", antrag, "", antrag)
|
|
dgvGebuehren.Rows.Add("Verzicht", "", verzicht, "", verzicht)
|
|
Else
|
|
dgvGebuehren.Rows.Add("Antrag", "", antrag, "", antrag)
|
|
dgvGebuehren.Rows.Add("Identitätskontrolle", "", idk, "", idk)
|
|
End If
|
|
|
|
|
|
|
|
Dim sumBetrag As Double = 0
|
|
For Each r As DataGridViewRow In dgvGebuehren.Rows
|
|
If IsNumeric(r.Cells(4).Value) Then sumBetrag += r.Cells(4).Value
|
|
Next
|
|
|
|
txtSumme.Text = CDbl(sumBetrag)
|
|
|
|
Catch ex As System.Exception
|
|
|
|
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
|
|
End Try
|
|
|
|
End Sub
|
|
|
|
Private Sub cbxVerzicht_CheckedChanged(sender As Object, e As EventArgs) Handles cbxVerzicht.CheckedChanged
|
|
|
|
initdgvGebuehren(True)
|
|
|
|
End Sub
|
|
End Class
|