Files
SDL/SDL/Formulare/KDFormulare/FormulareBaukasten/usrCntlZollbeschau.vb
2022-12-21 14:05:51 +01:00

199 lines
7.4 KiB
VB.net

Public Class usrCntlZollbeschau
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 Rolle As String = ""
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)
If param.Length > 4 Then Rolle = param(4)
' 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
txtT1.Text = If(SENDUNG.tblSnd_ATB_T1, "")
txtATB.Text = If(SENDUNG.tblSnd_ATB_Nr, "")
txtATC.Text = If(SENDUNG.tblSnd_ATCMRN_Fremd, "")
txtWarenbez.Text = If(SENDUNG.tblSnd_Warenbezeichnung, "")
txtAnzVerp.Text = If(SENDUNG.tblSnd_Colli, "")
txtGewicht.Text = If(SENDUNG.tblSnd_Gewicht, "")
txtGewicht.Text &= " kg"
txtAbsender.Text = If(SENDUNG.tblSnd_Absender, "")
txtWarenwert.Text = If(SENDUNG.tblSnd_Warenwert, "")
txtFrächter.Text = If(SENDUNG.tblSnd_Frachtfuehrer, "")
txtAbsender.Text = If(SENDUNG.tblSnd_Absender, "")
txtZollagent.Text = VERAG_PROG_ALLGEMEIN.cAllgemein.FIRMA
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
txtUid.Text = If(ADRESSE.UstIdKz, "") & If(ADRESSE.UstIdNr, "")
txtEori.Text = If(KUNDE.EORITIN, "")
txtTel.Text = If(ADRESSE.Telefon, "")
txtFax.Text = If(ADRESSE.Telefax, "")
txtEmail.Text = If(ADRESSE.E_Mail, "")
' 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
Label16.Text = Rolle.ToString
txtTimeZoll1.Text = "00:00"
txtTimeZoll2.Text = "00:00"
txtTimeZoll1.Enabled = False
txtTimeZoll2.Enabled = False
initControlsHandler()
txtAnsprechpartnerVERAG.Text = VERAG_PROG_ALLGEMEIN.cAllgemein.USRNAME
txtBeschauDat.Text = Date.Today.ToString("dd.MM.yyyy")
txtVZDatum.Text = Date.Today.ToString("dd.MM.yyyy")
If IsNumeric(VERAG_PROG_ALLGEMEIN.cAllgemein.MITARBEITER.mit_durchwahl) Then
txtDW.Text = VERAG_PROG_ALLGEMEIN.cAllgemein.MITARBEITER.mit_durchwahl
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 DateTimePicker1_ValueChanged(sender As Object, e As EventArgs) Handles DateTimePicker1.ValueChanged
txtZoll1Date._value = CDate(sender.value).ToShortDateString
If txtZoll1Date._value <> "" Then
txtTimeZoll1.Enabled = True
Else
txtTimeZoll1.Enabled = False
End If
End Sub
Private Sub DateTimePicker2_ValueChanged(sender As Object, e As EventArgs) Handles DateTimePicker2.ValueChanged
txtZoll2Date._value = CDate(sender.value).ToShortDateString
If txtZoll2Date._value <> "" Then
txtTimeZoll2.Enabled = True
Else
txtTimeZoll2.Enabled = False
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 DateTimePicker3_ValueChanged(sender As Object, e As EventArgs) Handles DateTimePicker3.ValueChanged
txtVZDatum._value = CDate(sender.value).ToShortDateString
End Sub
End Class