Feature_Routenberechnung implementiert

This commit is contained in:
2022-10-07 16:13:36 +02:00
parent ed48c0eaef
commit 2b982ebb9a
8 changed files with 6651 additions and 198 deletions

View File

@@ -895,7 +895,7 @@ Partial Class frmEintragAviso
'
Me.btnStreckendauerBerechnen.FlatStyle = System.Windows.Forms.FlatStyle.Flat
Me.btnStreckendauerBerechnen.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.0!)
Me.btnStreckendauerBerechnen.Location = New System.Drawing.Point(171, 48)
Me.btnStreckendauerBerechnen.Location = New System.Drawing.Point(279, 45)
Me.btnStreckendauerBerechnen.Name = "btnStreckendauerBerechnen"
Me.btnStreckendauerBerechnen.Size = New System.Drawing.Size(118, 21)
Me.btnStreckendauerBerechnen.TabIndex = 7
@@ -1335,9 +1335,9 @@ Partial Class frmEintragAviso
'
Me.datVoraussichtlichesEintreffen.CustomFormat = "dd.MM.yyyy"
Me.datVoraussichtlichesEintreffen.Format = System.Windows.Forms.DateTimePickerFormat.Custom
Me.datVoraussichtlichesEintreffen.Location = New System.Drawing.Point(319, 49)
Me.datVoraussichtlichesEintreffen.Location = New System.Drawing.Point(171, 47)
Me.datVoraussichtlichesEintreffen.Name = "datVoraussichtlichesEintreffen"
Me.datVoraussichtlichesEintreffen.Size = New System.Drawing.Size(76, 20)
Me.datVoraussichtlichesEintreffen.Size = New System.Drawing.Size(96, 20)
Me.datVoraussichtlichesEintreffen.TabIndex = 6
Me.datVoraussichtlichesEintreffen.Value = New Date(2020, 1, 23, 0, 0, 0, 0)
Me.datVoraussichtlichesEintreffen.Visible = False

View File

@@ -216,6 +216,12 @@
<metadata name="clmnPfad.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="columnName.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="clmnPfad.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
AAABAAEAgIAAAAEAIAAoCAEAFgAAACgAAACAAAAAAAEAAAEAIAAAAAAAAAgBABMLAAATCwAAAAAAAAAA

View File

@@ -1839,7 +1839,7 @@ Public Class frmEintragAviso
Dim destination As String = ""
If cboGrenzstelle._value = "???" AndAlso txtBestimmungszollstelle._value IsNot Nothing Then
If cboGrenzstelle._value = "???" AndAlso txtBestimmungszollstelle._value IsNot "" Then
destination = txtBestimmungszollstelle._value
Else
destination = cboGrenzstelle._value

View File

@@ -25,7 +25,14 @@ Partial Class frmNCTSRouten
Me.components = New System.ComponentModel.Container()
Me.btnOK = New System.Windows.Forms.Button()
Me.btn_Cancel = New System.Windows.Forms.Button()
Me.btnNeu = New System.Windows.Forms.Button()
Me.btnSave = New System.Windows.Forms.Button()
Me.pnlNCTSRouten = New VERAG_PROG_ALLGEMEIN.MyPanel(Me.components)
Me.lblWarningTransportmittel = New System.Windows.Forms.Label()
Me.Label5 = New System.Windows.Forms.Label()
Me.cbxTransportmittel = New VERAG_PROG_ALLGEMEIN.MyComboBox()
Me.txtNach = New VERAG_PROG_ALLGEMEIN.MyTextBox()
Me.txtVon = New VERAG_PROG_ALLGEMEIN.MyTextBox()
Me.cbxVon = New VERAG_PROG_ALLGEMEIN.MyComboBox()
Me.sbxNach = New VERAG_PROG_ALLGEMEIN.MySearchBox()
Me.lblWarningRoute = New System.Windows.Forms.Label()
@@ -40,17 +47,15 @@ Partial Class frmNCTSRouten
Me.cbxNach = New VERAG_PROG_ALLGEMEIN.MyComboBox()
Me.txtDauer = New System.Windows.Forms.TextBox()
Me.cbxRoutenart = New VERAG_PROG_ALLGEMEIN.MyComboBox()
Me.btnNeu = New System.Windows.Forms.Button()
Me.dgvNCTSRouten = New VERAG_PROG_ALLGEMEIN.MyDatagridview(Me.components)
Me.btnSave = New System.Windows.Forms.Button()
Me.txtVon = New VERAG_PROG_ALLGEMEIN.MyTextBox()
Me.txtNach = New VERAG_PROG_ALLGEMEIN.MyTextBox()
Me.txtVonRegion = New VERAG_PROG_ALLGEMEIN.MyTextBox()
Me.pnlNCTSRouten.SuspendLayout()
CType(Me.dgvNCTSRouten, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'btnOK
'
Me.btnOK.DialogResult = System.Windows.Forms.DialogResult.OK
Me.btnOK.Location = New System.Drawing.Point(478, 468)
Me.btnOK.Name = "btnOK"
Me.btnOK.Size = New System.Drawing.Size(75, 23)
@@ -60,6 +65,7 @@ Partial Class frmNCTSRouten
'
'btn_Cancel
'
Me.btn_Cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel
Me.btn_Cancel.Location = New System.Drawing.Point(12, 477)
Me.btn_Cancel.Name = "btn_Cancel"
Me.btn_Cancel.Size = New System.Drawing.Size(75, 23)
@@ -67,8 +73,31 @@ Partial Class frmNCTSRouten
Me.btn_Cancel.Text = "Abbrechen"
Me.btn_Cancel.UseVisualStyleBackColor = True
'
'btnNeu
'
Me.btnNeu.Image = Global.AVISO.My.Resources.Resources.plus
Me.btnNeu.Location = New System.Drawing.Point(509, 170)
Me.btnNeu.Name = "btnNeu"
Me.btnNeu.Size = New System.Drawing.Size(44, 31)
Me.btnNeu.TabIndex = 29
Me.btnNeu.UseVisualStyleBackColor = True
'
'btnSave
'
Me.btnSave.Location = New System.Drawing.Point(478, 468)
Me.btnSave.Name = "btnSave"
Me.btnSave.Size = New System.Drawing.Size(75, 23)
Me.btnSave.TabIndex = 31
Me.btnSave.Text = "Speichern"
Me.btnSave.UseVisualStyleBackColor = True
Me.btnSave.Visible = False
'
'pnlNCTSRouten
'
Me.pnlNCTSRouten.Controls.Add(Me.txtVonRegion)
Me.pnlNCTSRouten.Controls.Add(Me.lblWarningTransportmittel)
Me.pnlNCTSRouten.Controls.Add(Me.Label5)
Me.pnlNCTSRouten.Controls.Add(Me.cbxTransportmittel)
Me.pnlNCTSRouten.Controls.Add(Me.txtNach)
Me.pnlNCTSRouten.Controls.Add(Me.txtVon)
Me.pnlNCTSRouten.Controls.Add(Me.cbxVon)
@@ -87,9 +116,91 @@ Partial Class frmNCTSRouten
Me.pnlNCTSRouten.Controls.Add(Me.cbxRoutenart)
Me.pnlNCTSRouten.Location = New System.Drawing.Point(12, 4)
Me.pnlNCTSRouten.Name = "pnlNCTSRouten"
Me.pnlNCTSRouten.Size = New System.Drawing.Size(392, 197)
Me.pnlNCTSRouten.Size = New System.Drawing.Size(491, 197)
Me.pnlNCTSRouten.TabIndex = 30
'
'lblWarningTransportmittel
'
Me.lblWarningTransportmittel.AutoSize = True
Me.lblWarningTransportmittel.ForeColor = System.Drawing.Color.Red
Me.lblWarningTransportmittel.Location = New System.Drawing.Point(356, 156)
Me.lblWarningTransportmittel.Name = "lblWarningTransportmittel"
Me.lblWarningTransportmittel.Size = New System.Drawing.Size(105, 13)
Me.lblWarningTransportmittel.TabIndex = 42
Me.lblWarningTransportmittel.Text = "Bitte Route angeben"
Me.lblWarningTransportmittel.Visible = False
'
'Label5
'
Me.Label5.AutoSize = True
Me.Label5.Location = New System.Drawing.Point(356, 116)
Me.Label5.Name = "Label5"
Me.Label5.Size = New System.Drawing.Size(79, 13)
Me.Label5.TabIndex = 41
Me.Label5.Text = "Transportmittel:"
'
'cbxTransportmittel
'
Me.cbxTransportmittel._allowedValuesFreiText = Nothing
Me.cbxTransportmittel._allowFreiText = False
Me.cbxTransportmittel._value = ""
Me.cbxTransportmittel.Enabled = False
Me.cbxTransportmittel.FormattingEnabled = True
Me.cbxTransportmittel.Location = New System.Drawing.Point(356, 132)
Me.cbxTransportmittel.Name = "cbxTransportmittel"
Me.cbxTransportmittel.Size = New System.Drawing.Size(121, 21)
Me.cbxTransportmittel.TabIndex = 40
'
'txtNach
'
Me.txtNach._DateTimeOnly = False
Me.txtNach._numbersOnly = False
Me.txtNach._numbersOnlyKommastellen = ""
Me.txtNach._numbersOnlyTrennzeichen = True
Me.txtNach._Prozent = False
Me.txtNach._ShortDateNew = False
Me.txtNach._ShortDateOnly = False
Me.txtNach._TimeOnly = False
Me.txtNach._TimeOnly_Seconds = False
Me.txtNach._value = ""
Me.txtNach._Waehrung = False
Me.txtNach._WaehrungZeichen = True
Me.txtNach.Enabled = False
Me.txtNach.ForeColor = System.Drawing.Color.Black
Me.txtNach.Location = New System.Drawing.Point(220, 91)
Me.txtNach.MaxLineLength = -1
Me.txtNach.MaxLines_Warning = ""
Me.txtNach.MaxLines_Warning_Label = Nothing
Me.txtNach.Name = "txtNach"
Me.txtNach.ReadOnly = True
Me.txtNach.Size = New System.Drawing.Size(100, 20)
Me.txtNach.TabIndex = 39
'
'txtVon
'
Me.txtVon._DateTimeOnly = False
Me.txtVon._numbersOnly = False
Me.txtVon._numbersOnlyKommastellen = ""
Me.txtVon._numbersOnlyTrennzeichen = True
Me.txtVon._Prozent = False
Me.txtVon._ShortDateNew = False
Me.txtVon._ShortDateOnly = False
Me.txtVon._TimeOnly = False
Me.txtVon._TimeOnly_Seconds = False
Me.txtVon._value = ""
Me.txtVon._Waehrung = False
Me.txtVon._WaehrungZeichen = True
Me.txtVon.Enabled = False
Me.txtVon.ForeColor = System.Drawing.Color.Black
Me.txtVon.Location = New System.Drawing.Point(10, 91)
Me.txtVon.MaxLineLength = -1
Me.txtVon.MaxLines_Warning = ""
Me.txtVon.MaxLines_Warning_Label = Nothing
Me.txtVon.Name = "txtVon"
Me.txtVon.ReadOnly = True
Me.txtVon.Size = New System.Drawing.Size(88, 20)
Me.txtVon.TabIndex = 38
'
'cbxVon
'
Me.cbxVon._allowedValuesFreiText = New String() {"Test"}
@@ -269,15 +380,6 @@ Partial Class frmNCTSRouten
Me.cbxRoutenart.Size = New System.Drawing.Size(121, 21)
Me.cbxRoutenart.TabIndex = 3
'
'btnNeu
'
Me.btnNeu.Image = Global.AVISO.My.Resources.Resources.plus
Me.btnNeu.Location = New System.Drawing.Point(424, 136)
Me.btnNeu.Name = "btnNeu"
Me.btnNeu.Size = New System.Drawing.Size(44, 31)
Me.btnNeu.TabIndex = 29
Me.btnNeu.UseVisualStyleBackColor = True
'
'dgvNCTSRouten
'
Me.dgvNCTSRouten.AKTUALISIERUNGS_INTERVALL = -1
@@ -296,63 +398,30 @@ Partial Class frmNCTSRouten
Me.dgvNCTSRouten.Size = New System.Drawing.Size(541, 243)
Me.dgvNCTSRouten.TabIndex = 10
'
'btnSave
'txtVonRegion
'
Me.btnSave.Location = New System.Drawing.Point(478, 468)
Me.btnSave.Name = "btnSave"
Me.btnSave.Size = New System.Drawing.Size(75, 23)
Me.btnSave.TabIndex = 31
Me.btnSave.Text = "Speichern"
Me.btnSave.UseVisualStyleBackColor = True
Me.btnSave.Visible = False
'
'txtVon
'
Me.txtVon._DateTimeOnly = False
Me.txtVon._numbersOnly = False
Me.txtVon._numbersOnlyKommastellen = ""
Me.txtVon._numbersOnlyTrennzeichen = True
Me.txtVon._Prozent = False
Me.txtVon._ShortDateNew = False
Me.txtVon._ShortDateOnly = False
Me.txtVon._TimeOnly = False
Me.txtVon._TimeOnly_Seconds = False
Me.txtVon._value = ""
Me.txtVon._Waehrung = False
Me.txtVon._WaehrungZeichen = True
Me.txtVon.Enabled = False
Me.txtVon.ForeColor = System.Drawing.Color.Black
Me.txtVon.Location = New System.Drawing.Point(10, 91)
Me.txtVon.MaxLineLength = -1
Me.txtVon.MaxLines_Warning = ""
Me.txtVon.MaxLines_Warning_Label = Nothing
Me.txtVon.Name = "txtVon"
Me.txtVon.Size = New System.Drawing.Size(100, 20)
Me.txtVon.TabIndex = 38
'
'txtNach
'
Me.txtNach._DateTimeOnly = False
Me.txtNach._numbersOnly = False
Me.txtNach._numbersOnlyKommastellen = ""
Me.txtNach._numbersOnlyTrennzeichen = True
Me.txtNach._Prozent = False
Me.txtNach._ShortDateNew = False
Me.txtNach._ShortDateOnly = False
Me.txtNach._TimeOnly = False
Me.txtNach._TimeOnly_Seconds = False
Me.txtNach._value = ""
Me.txtNach._Waehrung = False
Me.txtNach._WaehrungZeichen = True
Me.txtNach.Enabled = False
Me.txtNach.ForeColor = System.Drawing.Color.Black
Me.txtNach.Location = New System.Drawing.Point(220, 91)
Me.txtNach.MaxLineLength = -1
Me.txtNach.MaxLines_Warning = ""
Me.txtNach.MaxLines_Warning_Label = Nothing
Me.txtNach.Name = "txtNach"
Me.txtNach.Size = New System.Drawing.Size(100, 20)
Me.txtNach.TabIndex = 39
Me.txtVonRegion._DateTimeOnly = False
Me.txtVonRegion._numbersOnly = False
Me.txtVonRegion._numbersOnlyKommastellen = ""
Me.txtVonRegion._numbersOnlyTrennzeichen = True
Me.txtVonRegion._Prozent = False
Me.txtVonRegion._ShortDateNew = False
Me.txtVonRegion._ShortDateOnly = False
Me.txtVonRegion._TimeOnly = False
Me.txtVonRegion._TimeOnly_Seconds = False
Me.txtVonRegion._value = ""
Me.txtVonRegion._Waehrung = False
Me.txtVonRegion._WaehrungZeichen = True
Me.txtVonRegion.Enabled = False
Me.txtVonRegion.ForeColor = System.Drawing.Color.Black
Me.txtVonRegion.Location = New System.Drawing.Point(104, 91)
Me.txtVonRegion.MaxLineLength = -1
Me.txtVonRegion.MaxLines_Warning = ""
Me.txtVonRegion.MaxLines_Warning_Label = Nothing
Me.txtVonRegion.Name = "txtVonRegion"
Me.txtVonRegion.ReadOnly = True
Me.txtVonRegion.Size = New System.Drawing.Size(67, 20)
Me.txtVonRegion.TabIndex = 43
'
'frmNCTSRouten
'
@@ -396,4 +465,8 @@ Partial Class frmNCTSRouten
Friend WithEvents cbxVon As VERAG_PROG_ALLGEMEIN.MyComboBox
Friend WithEvents txtNach As VERAG_PROG_ALLGEMEIN.MyTextBox
Friend WithEvents txtVon As VERAG_PROG_ALLGEMEIN.MyTextBox
Friend WithEvents Label5 As Label
Friend WithEvents cbxTransportmittel As VERAG_PROG_ALLGEMEIN.MyComboBox
Friend WithEvents lblWarningTransportmittel As Label
Friend WithEvents txtVonRegion As VERAG_PROG_ALLGEMEIN.MyTextBox
End Class

View File

@@ -19,10 +19,13 @@ Public Class frmNCTSRouten
initDGVRouten()
'Abgangszollstelle
'Abgangszollstelle/Gebiet - woher kommt der LKW
cbxVon.Items.Clear()
cbxVon.fillWithSQL("SELECT [grz_Grenzstelle],[grz_BezeichnungCBO] FROM tblGrenzstelle where [grz_Firma]='" & FIRMA_TMP & "' OR grz_Cluster='" & VERAG_PROG_ALLGEMEIN.cAllgemein.CLUSTER & "' AND grz_Aktiv=1 order by grz_Reihenfolge, grz_Grenzstelle", False, "AVISO", True,)
cbxVon.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("???", "???"))
cbxVon.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("", ""))
cbxVon.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("Istanbul", "TR341300"))
cbxVon.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("München", "DE001526"))
cbxVon.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("Ankara", "TR061500"))
'cbxVon.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("???", "???"))
cbxVon.changeItem("")
@@ -32,9 +35,9 @@ Public Class frmNCTSRouten
" left(Code,2),[Description]", "Code", "display", "FMZOLL", , 400, 200, {"display", "Code"})
'Bestimmungszollstelle
'Bestimmungszollstelle - an Welcher Zollstelle kommt der LKW
cbxNach.Items.Clear()
cbxNach.fillWithSQL("SELECT [grz_Grenzstelle],[grz_BezeichnungCBO] FROM tblGrenzstelle where [grz_Firma]='" & FIRMA_TMP & "' OR grz_Cluster='" & VERAG_PROG_ALLGEMEIN.cAllgemein.CLUSTER & "' AND grz_Aktiv=1 order by grz_Reihenfolge, grz_Grenzstelle", False, "AVISO", True,)
cbxNach.fillWithSQL("SELECT [grz_ZollamtDST],[grz_Grenzstelle] FROM tblGrenzstelle where [grz_Firma]='" & FIRMA_TMP & "' OR grz_Cluster='" & VERAG_PROG_ALLGEMEIN.cAllgemein.CLUSTER & "' AND grz_Aktiv=1 order by grz_Reihenfolge, grz_Grenzstelle", False, "AVISO", True,)
cbxNach.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("???", "???"))
cbxNach.changeItem("")
@@ -50,12 +53,16 @@ Public Class frmNCTSRouten
cbxRoutenart.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("Seeweg", "Seeweg"))
cbxRoutenart.changeItem("")
cbxTransportmittel.Items.Clear()
cbxTransportmittel.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("LKW", "LKW"))
'aktuell nur der Defaultwert "LKW" verfügbar!
cbxTransportmittel.changeItem("LKW")
txtDauer.Text = ""
txtVon.Text = ""
txtVonRegion.Text = ""
txtNach.Text = ""
dgvNCTSRouten.ClearSelection()
@@ -73,13 +80,15 @@ Public Class frmNCTSRouten
.Columns.Clear()
.DataSource = sql.loadDgvBySql("SELECT [nctsr_id],[nctsr_von],[nctsr_nach],[nctsr_dauer_in_tagen],[nctsr_route], [nctsr_tansportmittel] FROM [VERAG].[dbo].[tblNTCSRouten]",
.DataSource = sql.loadDgvBySql("SELECT [nctsr_id],[nctsr_von],[nctsr_von_region],[nctsr_nach],[nctsr_dauer_in_tagen],[nctsr_route], [nctsr_transportmittel] FROM [VERAG].[dbo].[tblNTCSRouten]",
"VERAG")
' .RowTemplate.Height = 30
.Columns("nctsr_id").Visible = False
.Columns("nctsr_von").AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill
.Columns("nctsr_von").HeaderText = "Von"
.Columns("nctsr_von_region").AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill
.Columns("nctsr_von_region").HeaderText = "Herkunftsregion"
.Columns("nctsr_nach").AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill
.Columns("nctsr_nach").HeaderText = "Nach"
.Columns("nctsr_dauer_in_tagen").Visible = True
@@ -89,9 +98,9 @@ Public Class frmNCTSRouten
.Columns("nctsr_route").Visible = True
.Columns("nctsr_route").Width = 100
.Columns("nctsr_route").HeaderText = "Route"
.Columns("nctsr_route").DefaultCellStyle.Alignment = DataGridViewContentAlignment.TopCenter
.Columns("nctsr_tansportmittel").HeaderText = "Transportmittel"
.Columns("nctsr_tansportmittel").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft
.Columns("nctsr_route").DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft
.Columns("nctsr_transportmittel").HeaderText = "Transportmittel"
.Columns("nctsr_transportmittel").DefaultCellStyle.Alignment = DataGridViewContentAlignment.TopCenter
@@ -105,20 +114,22 @@ Public Class frmNCTSRouten
Private Sub saveRoute(curRoute As cNCTSRouten)
curRoute.nctsr_von = IIf(sbxVon._value Is Nothing, cbxVon._value, sbxVon._value)
curRoute.nctsr_nach = IIf(sbxNach._value Is Nothing, cbxNach._value, sbxNach._value)
curRoute.nctsr_von = txtVon._value.ToString 'IIf(sbxVon._value Is Nothing Or sbxVon._value = "", cbxVon._value, sbxVon._value)
curRoute.nctsr_von_region = txtVonRegion._value.ToString
curRoute.nctsr_nach = txtNach._value.ToString 'IIf(sbxNach._value Is Nothing Or sbxNach._value = "", cbxNach._value, sbxNach._value)
curRoute.nctsr_route = cbxRoutenart._value
curRoute.nctsr_dauer_in_tagen = CInt(txtDauer.Text)
curRoute.nctsr_transportmittel = cbxTransportmittel._value
If Not curRoute.SAVE() Then
Me.DialogResult = Windows.Forms.DialogResult.None
End If
dgvNCTSRouten.GetOrder()
initDGVRouten()
dgvNCTSRouten.SetOrder()
setOKButton()
End Sub
@@ -130,10 +141,11 @@ Public Class frmNCTSRouten
currentRoute = New VERAG_PROG_ALLGEMEIN.cNCTSRouten With {
.nctsr_von = "",
.nctsr_von_region = "",
.nctsr_nach = "",
.nctsr_dauer_in_tagen = 0,
.nctsr_route = "",
.nctsr_tansportmittel = "LKW"
.nctsr_transportmittel = ""
}
loadChangedDSToPanel(currentRoute)
EnableUserControl()
@@ -155,9 +167,12 @@ Public Class frmNCTSRouten
txtVon.Text = curRoute.nctsr_von.ToString
txtVonRegion.Text = curRoute.nctsr_von_region.ToString
txtNach.Text = curRoute.nctsr_nach.ToString
cbxRoutenart._value = curRoute.nctsr_route.ToString
txtDauer.Text = curRoute.nctsr_dauer_in_tagen.ToString
cbxTransportmittel._value = curRoute.nctsr_transportmittel.ToString
For Each c As Control In pnlNCTSRouten.Controls
If TypeOf (c) Is CheckBox Then
@@ -210,8 +225,9 @@ Public Class frmNCTSRouten
Dim rowindex = dgvNCTSRouten.SelectedRows(0).Index
currentRoute = New VERAG_PROG_ALLGEMEIN.cNCTSRouten(dgvNCTSRouten.SelectedRows(0).Cells("nctsr_id").Value)
'checkIfValueInComboboxAndAdd(currentRoute)
loadChangedDSToPanel(currentRoute)
cbxVon.changeItem("")
cbxNach.changeItem("")
If dgvNCTSRouten.Enabled = False Then Exit Sub
@@ -225,20 +241,6 @@ Public Class frmNCTSRouten
If sender Is sbxNach Then sbxNach.FireReturn() : e.IsInputKey = True : Me.DialogResult = DialogResult.None
End Sub
'Private Sub checkIfValueInComboboxAndAdd(curRoute As cNCTSRouten)
' Dim index As Integer
' Dim inList As Boolean
' inList = False
' For index = 0 To cbxNach.Items.Count - 1
' If curRoute.nctsr_nach.ToString = cbxNach.Items(index).ToString Then
' inList = True
' Exit For
' End If
' Next index
' If inList = False Then cbxNach.Items.Add(curRoute.nctsr_nach.ToString)
'End Sub
Public Function GetTxtDauer() As TextBox
Return txtDauer
End Function
@@ -251,11 +253,13 @@ Public Class frmNCTSRouten
lblWarningDauer.Visible = False
lblWarningRoute.Visible = False
If (cbxVon._value = "" Or cbxVon._value Is Nothing) Then
'If (cbxVon._value = "" Or cbxVon._value Is Nothing) Then
If (txtVon._value = "") Then
lblWarningAZS.Visible = True
validInputs = False
End If
If (cbxNach._value = "" Or cbxNach._value Is Nothing) Then
'If (cbxNach._value = "" Or cbxNach._value Is Nothing) Then
If (txtNach._value = "") Then
lblWarningBST.Visible = True
validInputs = False
End If
@@ -270,20 +274,21 @@ Public Class frmNCTSRouten
validInputs = False
End If
If (cbxNach._value = "" Or cbxNach._value Is Nothing) Then
lblWarningBST.Visible = True
If (Not IsNumeric(txtDauer.Text) Or txtDauer.Text = "") Then
lblWarningDauer.Visible = True
validInputs = False
End If
If (Not IsNumeric(txtDauer.Text) Or txtDauer.Text = "") Then
lblWarningDauer.Visible = True
validInputs = False
End If
If cbxRoutenart._value = "" Or cbxRoutenart._value Is Nothing Then
If cbxRoutenart._value = "" Or cbxRoutenart._value Is Nothing Then
lblWarningRoute.Visible = True
validInputs = False
End If
If cbxTransportmittel._value = "" Or cbxTransportmittel._value Is Nothing Then
lblWarningTransportmittel.Visible = True
validInputs = False
End If
Return validInputs
End Function
@@ -291,6 +296,7 @@ Public Class frmNCTSRouten
If checkUserInput(GetTxtDauer()) Then saveRoute(currentRoute)
End Sub
Private Sub cbxVon_SelectedValueChanged(sender As Object, e As EventArgs) Handles cbxVon.SelectedValueChanged
@@ -299,6 +305,7 @@ Public Class frmNCTSRouten
Else
txtVon.Text = cbxVon._value.ToString
txtVonRegion.Text = cbxVon.Text.ToString
setSearchboxVisible(sbxVon, False)
sbxVon.Clear()
End If
@@ -310,7 +317,7 @@ Public Class frmNCTSRouten
setSearchboxVisible(sbxNach, True)
Else
txtVon.Text = cbxVon._value.ToString
txtNach.Text = cbxNach._value.ToString
setSearchboxVisible(sbxNach, False)
sbxNach.Clear()
End If
@@ -320,5 +327,6 @@ Public Class frmNCTSRouten
Sub setSearchboxVisible(searchbox As VERAG_PROG_ALLGEMEIN.MySearchBox, visible As Boolean)
searchbox.Visible = visible
End Sub
End Class

View File

@@ -22,6 +22,7 @@ Partial Class frmRoutendauerBerechnen
'Das Bearbeiten mit dem Code-Editor ist nicht möglich.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(frmRoutendauerBerechnen))
Me.btnMinus = New System.Windows.Forms.Button()
Me.btnPlus = New System.Windows.Forms.Button()
Me.cbxVon = New VERAG_PROG_ALLGEMEIN.MyComboBox()
@@ -32,13 +33,18 @@ Partial Class frmRoutendauerBerechnen
Me.btnCancel = New System.Windows.Forms.Button()
Me.txbAbgangsdatum = New VERAG_PROG_ALLGEMEIN.MyTextBox()
Me.Label1 = New System.Windows.Forms.Label()
Me.datVoraussichtlichesEintreffen = New VERAG_PROG_ALLGEMEIN.MyTextBox()
Me.txbVoraussichtlichesEintreffen = New VERAG_PROG_ALLGEMEIN.MyTextBox()
Me.Label2 = New System.Windows.Forms.Label()
Me.lblWarning = New System.Windows.Forms.Label()
Me.lblDauer = New System.Windows.Forms.Label()
Me.lblberechneteDauer = New System.Windows.Forms.Label()
Me.lbWarningDateIsPast = New System.Windows.Forms.Label()
Me.Button1 = New System.Windows.Forms.Button()
Me.SuspendLayout()
'
'btnMinus
'
Me.btnMinus.Location = New System.Drawing.Point(234, 105)
Me.btnMinus.Location = New System.Drawing.Point(192, 102)
Me.btnMinus.Name = "btnMinus"
Me.btnMinus.Size = New System.Drawing.Size(29, 23)
Me.btnMinus.TabIndex = 16
@@ -47,7 +53,7 @@ Partial Class frmRoutendauerBerechnen
'
'btnPlus
'
Me.btnPlus.Location = New System.Drawing.Point(163, 105)
Me.btnPlus.Location = New System.Drawing.Point(263, 102)
Me.btnPlus.Name = "btnPlus"
Me.btnPlus.Size = New System.Drawing.Size(29, 23)
Me.btnPlus.TabIndex = 15
@@ -60,7 +66,7 @@ Partial Class frmRoutendauerBerechnen
Me.cbxVon._allowFreiText = False
Me.cbxVon._value = ""
Me.cbxVon.FormattingEnabled = True
Me.cbxVon.Location = New System.Drawing.Point(26, 39)
Me.cbxVon.Location = New System.Drawing.Point(11, 39)
Me.cbxVon.Name = "cbxVon"
Me.cbxVon.Size = New System.Drawing.Size(121, 21)
Me.cbxVon.TabIndex = 13
@@ -68,7 +74,7 @@ Partial Class frmRoutendauerBerechnen
'lblBZS
'
Me.lblBZS.AutoSize = True
Me.lblBZS.Location = New System.Drawing.Point(160, 23)
Me.lblBZS.Location = New System.Drawing.Point(189, 23)
Me.lblBZS.Name = "lblBZS"
Me.lblBZS.Size = New System.Drawing.Size(111, 13)
Me.lblBZS.TabIndex = 12
@@ -77,7 +83,7 @@ Partial Class frmRoutendauerBerechnen
'lblAZS
'
Me.lblAZS.AutoSize = True
Me.lblAZS.Location = New System.Drawing.Point(23, 23)
Me.lblAZS.Location = New System.Drawing.Point(8, 23)
Me.lblAZS.Name = "lblAZS"
Me.lblAZS.Size = New System.Drawing.Size(91, 13)
Me.lblAZS.TabIndex = 11
@@ -98,7 +104,7 @@ Partial Class frmRoutendauerBerechnen
Me.txtNach._Waehrung = False
Me.txtNach._WaehrungZeichen = True
Me.txtNach.ForeColor = System.Drawing.Color.Black
Me.txtNach.Location = New System.Drawing.Point(162, 39)
Me.txtNach.Location = New System.Drawing.Point(192, 39)
Me.txtNach.MaxLineLength = -1
Me.txtNach.MaxLines_Warning = ""
Me.txtNach.MaxLines_Warning_Label = Nothing
@@ -110,7 +116,7 @@ Partial Class frmRoutendauerBerechnen
'btnOK
'
Me.btnOK.DialogResult = System.Windows.Forms.DialogResult.OK
Me.btnOK.Location = New System.Drawing.Point(213, 140)
Me.btnOK.Location = New System.Drawing.Point(223, 173)
Me.btnOK.Name = "btnOK"
Me.btnOK.Size = New System.Drawing.Size(71, 23)
Me.btnOK.TabIndex = 17
@@ -120,7 +126,7 @@ Partial Class frmRoutendauerBerechnen
'btnCancel
'
Me.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel
Me.btnCancel.Location = New System.Drawing.Point(12, 140)
Me.btnCancel.Location = New System.Drawing.Point(8, 173)
Me.btnCancel.Name = "btnCancel"
Me.btnCancel.Size = New System.Drawing.Size(71, 23)
Me.btnCancel.TabIndex = 18
@@ -142,7 +148,7 @@ Partial Class frmRoutendauerBerechnen
Me.txbAbgangsdatum._Waehrung = False
Me.txbAbgangsdatum._WaehrungZeichen = False
Me.txbAbgangsdatum.ForeColor = System.Drawing.Color.Black
Me.txbAbgangsdatum.Location = New System.Drawing.Point(26, 79)
Me.txbAbgangsdatum.Location = New System.Drawing.Point(11, 79)
Me.txbAbgangsdatum.MaxLength = 10
Me.txbAbgangsdatum.MaxLineLength = -1
Me.txbAbgangsdatum.MaxLines_Warning = ""
@@ -154,52 +160,108 @@ Partial Class frmRoutendauerBerechnen
'Label1
'
Me.Label1.AutoSize = True
Me.Label1.Location = New System.Drawing.Point(23, 63)
Me.Label1.Location = New System.Drawing.Point(8, 63)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(81, 13)
Me.Label1.TabIndex = 20
Me.Label1.Text = "Abgangsdatum:"
'
'datVoraussichtlichesEintreffen
'txbVoraussichtlichesEintreffen
'
Me.datVoraussichtlichesEintreffen._DateTimeOnly = False
Me.datVoraussichtlichesEintreffen._numbersOnly = False
Me.datVoraussichtlichesEintreffen._numbersOnlyKommastellen = ""
Me.datVoraussichtlichesEintreffen._numbersOnlyTrennzeichen = False
Me.datVoraussichtlichesEintreffen._Prozent = False
Me.datVoraussichtlichesEintreffen._ShortDateNew = True
Me.datVoraussichtlichesEintreffen._ShortDateOnly = True
Me.datVoraussichtlichesEintreffen._TimeOnly = False
Me.datVoraussichtlichesEintreffen._TimeOnly_Seconds = False
Me.datVoraussichtlichesEintreffen._value = ""
Me.datVoraussichtlichesEintreffen._Waehrung = False
Me.datVoraussichtlichesEintreffen._WaehrungZeichen = False
Me.datVoraussichtlichesEintreffen.ForeColor = System.Drawing.Color.Black
Me.datVoraussichtlichesEintreffen.Location = New System.Drawing.Point(163, 79)
Me.datVoraussichtlichesEintreffen.MaxLength = 10
Me.datVoraussichtlichesEintreffen.MaxLineLength = -1
Me.datVoraussichtlichesEintreffen.MaxLines_Warning = ""
Me.datVoraussichtlichesEintreffen.MaxLines_Warning_Label = Nothing
Me.datVoraussichtlichesEintreffen.Name = "datVoraussichtlichesEintreffen"
Me.datVoraussichtlichesEintreffen.Size = New System.Drawing.Size(100, 20)
Me.datVoraussichtlichesEintreffen.TabIndex = 21
Me.txbVoraussichtlichesEintreffen._DateTimeOnly = False
Me.txbVoraussichtlichesEintreffen._numbersOnly = False
Me.txbVoraussichtlichesEintreffen._numbersOnlyKommastellen = ""
Me.txbVoraussichtlichesEintreffen._numbersOnlyTrennzeichen = False
Me.txbVoraussichtlichesEintreffen._Prozent = False
Me.txbVoraussichtlichesEintreffen._ShortDateNew = True
Me.txbVoraussichtlichesEintreffen._ShortDateOnly = True
Me.txbVoraussichtlichesEintreffen._TimeOnly = False
Me.txbVoraussichtlichesEintreffen._TimeOnly_Seconds = False
Me.txbVoraussichtlichesEintreffen._value = ""
Me.txbVoraussichtlichesEintreffen._Waehrung = False
Me.txbVoraussichtlichesEintreffen._WaehrungZeichen = False
Me.txbVoraussichtlichesEintreffen.ForeColor = System.Drawing.Color.Black
Me.txbVoraussichtlichesEintreffen.Location = New System.Drawing.Point(192, 79)
Me.txbVoraussichtlichesEintreffen.MaxLength = 10
Me.txbVoraussichtlichesEintreffen.MaxLineLength = -1
Me.txbVoraussichtlichesEintreffen.MaxLines_Warning = ""
Me.txbVoraussichtlichesEintreffen.MaxLines_Warning_Label = Nothing
Me.txbVoraussichtlichesEintreffen.Name = "txbVoraussichtlichesEintreffen"
Me.txbVoraussichtlichesEintreffen.ReadOnly = True
Me.txbVoraussichtlichesEintreffen.Size = New System.Drawing.Size(100, 20)
Me.txbVoraussichtlichesEintreffen.TabIndex = 21
'
'Label2
'
Me.Label2.AutoSize = True
Me.Label2.Location = New System.Drawing.Point(160, 63)
Me.Label2.Location = New System.Drawing.Point(189, 63)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(90, 13)
Me.Label2.TabIndex = 22
Me.Label2.Text = "voraus. Eintreffen"
'
'lblWarning
'
Me.lblWarning.AutoSize = True
Me.lblWarning.ForeColor = System.Drawing.Color.Red
Me.lblWarning.Location = New System.Drawing.Point(5, 102)
Me.lblWarning.Name = "lblWarning"
Me.lblWarning.Size = New System.Drawing.Size(152, 13)
Me.lblWarning.TabIndex = 23
Me.lblWarning.Text = "Bitte Abgangsdatum eingeben!"
Me.lblWarning.Visible = False
'
'lblDauer
'
Me.lblDauer.AutoSize = True
Me.lblDauer.Location = New System.Drawing.Point(5, 128)
Me.lblDauer.Name = "lblDauer"
Me.lblDauer.Size = New System.Drawing.Size(84, 13)
Me.lblDauer.TabIndex = 24
Me.lblDauer.Text = "Dauer in Tagen:"
Me.lblDauer.Visible = False
'
'lblberechneteDauer
'
Me.lblberechneteDauer.AutoSize = True
Me.lblberechneteDauer.Location = New System.Drawing.Point(95, 128)
Me.lblberechneteDauer.Name = "lblberechneteDauer"
Me.lblberechneteDauer.Size = New System.Drawing.Size(0, 13)
Me.lblberechneteDauer.TabIndex = 25
Me.lblberechneteDauer.Visible = False
'
'lbWarningDateIsPast
'
Me.lbWarningDateIsPast.AutoSize = True
Me.lbWarningDateIsPast.ForeColor = System.Drawing.Color.Red
Me.lbWarningDateIsPast.Location = New System.Drawing.Point(5, 141)
Me.lbWarningDateIsPast.Name = "lbWarningDateIsPast"
Me.lbWarningDateIsPast.Size = New System.Drawing.Size(231, 13)
Me.lbWarningDateIsPast.TabIndex = 26
Me.lbWarningDateIsPast.Text = "Datum des Eintreffens liegt in der Verangenheit!"
Me.lbWarningDateIsPast.Visible = False
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(144, 13)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(29, 23)
Me.Button1.TabIndex = 27
Me.Button1.Text = "-"
Me.Button1.UseVisualStyleBackColor = True
'
'frmRoutendauerBerechnen
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(304, 175)
Me.ClientSize = New System.Drawing.Size(317, 208)
Me.Controls.Add(Me.Button1)
Me.Controls.Add(Me.lbWarningDateIsPast)
Me.Controls.Add(Me.lblberechneteDauer)
Me.Controls.Add(Me.lblDauer)
Me.Controls.Add(Me.lblWarning)
Me.Controls.Add(Me.Label2)
Me.Controls.Add(Me.datVoraussichtlichesEintreffen)
Me.Controls.Add(Me.txbVoraussichtlichesEintreffen)
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.txbAbgangsdatum)
Me.Controls.Add(Me.btnCancel)
@@ -210,8 +272,10 @@ Partial Class frmRoutendauerBerechnen
Me.Controls.Add(Me.lblBZS)
Me.Controls.Add(Me.lblAZS)
Me.Controls.Add(Me.txtNach)
Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
Me.Name = "frmRoutendauerBerechnen"
Me.Text = "frmRoutendauerBerechnen"
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.Text = " Routendauer berechnen"
Me.ResumeLayout(False)
Me.PerformLayout()
@@ -227,6 +291,11 @@ Partial Class frmRoutendauerBerechnen
Friend WithEvents btnCancel As Button
Friend WithEvents txbAbgangsdatum As VERAG_PROG_ALLGEMEIN.MyTextBox
Friend WithEvents Label1 As Label
Friend WithEvents datVoraussichtlichesEintreffen As VERAG_PROG_ALLGEMEIN.MyTextBox
Friend WithEvents txbVoraussichtlichesEintreffen As VERAG_PROG_ALLGEMEIN.MyTextBox
Friend WithEvents Label2 As Label
Friend WithEvents lblWarning As Label
Friend WithEvents lblDauer As Label
Friend WithEvents lblberechneteDauer As Label
Friend WithEvents lbWarningDateIsPast As Label
Friend WithEvents Button1 As Button
End Class

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,8 @@
Imports System.CodeDom
Imports DocumentFormat.OpenXml.Bibliography
Imports Org.BouncyCastle.Utilities
Imports SDL
Imports Therefore.API
Public Class frmRoutendauerBerechnen
@@ -8,8 +10,10 @@ Public Class frmRoutendauerBerechnen
Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL
Dim destination As String = ""
Dim departure As String
Dim transportmittel As String = "LKW"
Dim transportmittel As String = "LKW" 'Defaultvalue -> wird in Zukunft ev. noch erweitert (LKW, Sprinter, etc.)
Dim days As Integer = -1
Dim calcDays As Integer = -1
Dim destinationShortcut As String = ""
Sub New(dest As String)
@@ -20,45 +24,60 @@ Public Class frmRoutendauerBerechnen
End Sub
Function findDestinationAndReplaceToShortCut(destination As String) As String
Dim shortcut As String
shortcut = CStr(SQL.DLookup("[grz_ZollamtDST]", "[tblGrenzstelle]", "[grz_Grenzstelle]= '" & destination & "'", "AVISO", ""))
Return shortcut
End Function
Private Sub frmRoutendauerBerechnen_Load(sender As Object, e As EventArgs) Handles MyBase.Load
txtNach.Text = destination.ToString
txbAbgangsdatum._value = CStr(Date.Today())
initCheckBoxDepartment()
txtNach.Text = destination
destinationShortcut = findDestinationAndReplaceToShortCut(destination)
initComboboxDeparture()
txbAbgangsdatum._value = ""
End Sub
Sub initCheckBoxDepartment()
Sub initComboboxDeparture()
cbxVon.Items.Clear()
cbxVon.fillWithSQL("SELECT [nctsr_dauer_in_tagen], [nctsr_von] FROM [tblNTCSRouten] WHERE [nctsr_nach] = '" & destination & "'", False, "FMZOLL", False)
cbxVon.fillWithSQL("SELECT [nctsr_von], [nctsr_von_region] FROM [tblNTCSRouten] WHERE [nctsr_nach] = '" & destinationShortcut & "'", False, "FMZOLL", False)
cbxVon.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("", ""))
cbxVon.changeItem("")
End Sub
Private Sub btnPlus_Click(sender As Object, e As EventArgs) Handles btnPlus.Click
'addDaysToGivenDate(1)
addDaysToGivenDate2(datVoraussichtlichesEintreffen, 1)
If checkIfDepartureDateIsFilled() = False Then Exit Sub
addDaysToGivenDate(txbVoraussichtlichesEintreffen, 1)
calcDays += 1
checkIfDepatureDateIsNotPast()
End Sub
Private Sub btnMinus_Click(sender As Object, e As EventArgs) Handles btnMinus.Click
addDaysToGivenDate2(datVoraussichtlichesEintreffen, -1)
'addDaysToGivenDate(-1)
If checkIfDepartureDateIsFilled() = False Then Exit Sub
addDaysToGivenDate(txbVoraussichtlichesEintreffen, -1)
calcDays -= 1
checkIfDepatureDateIsNotPast()
End Sub
Function calculateTripDuration() As Integer
Dim destination As String
'Dim destination As String
Dim departure As String
departure = cbxVon.Text
destination = txtNach.Text
departure = cbxVon._value
'destination = txtNach.Text
Try
days = CInt(SQL.DLookup("nctsr_dauer_in_tagen", "tblNTCSRouten", "[nctsr_von]='" & departure & "' AND [nctsr_nach]= '" & destination & "' AND [nctsr_route]= 'Landweg' AND [nctsr_tansportmittel]= '" & transportmittel & "'", "VERAG", -1))
days = CInt(SQL.DLookup("nctsr_dauer_in_tagen", "tblNTCSRouten", "[nctsr_von]='" & departure & "' AND [nctsr_nach]= '" & destinationShortcut & "' AND [nctsr_route]= 'Landweg' AND [nctsr_transportmittel]= '" & transportmittel & "'", "VERAG", -1))
Catch ex As Exception
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
End Try
@@ -67,53 +86,114 @@ Public Class frmRoutendauerBerechnen
End Function
Private Sub cbxVon_SelectedValueChanged(sender As Object, e As EventArgs) Handles cbxVon.SelectedValueChanged
Private Sub addDaysToGivenDate(givenDate As VERAG_PROG_ALLGEMEIN.MyTextBox, days As Integer)
departure = cbxVon.Text
Dim calculatedDuration = calculateTripDuration()
txbVoraussichtlichesEintreffen._value = Convert.ToDateTime(givenDate._value).AddDays(days)
txbVoraussichtlichesEintreffen.Show()
If calculatedDuration > 0 Then
addDaysToGivenDate2(txbAbgangsdatum, calculatedDuration)
End If
lblberechneteDauer.Text = CStr(calcDuration())
lblberechneteDauer.Visible = True
End Sub
Private Sub addDaysTocurrentDate(days As Integer)
datVoraussichtlichesEintreffen._value = Convert.ToDateTime(txbAbgangsdatum._value).AddDays(days)
datVoraussichtlichesEintreffen.Show()
End Sub
Private Sub addDaysToGivenDate(days As Integer)
datVoraussichtlichesEintreffen._value = Convert.ToDateTime(datVoraussichtlichesEintreffen._value).AddDays(days)
datVoraussichtlichesEintreffen.Show()
End Sub
Private Sub addDaysToGivenDate2(givenDate As VERAG_PROG_ALLGEMEIN.MyTextBox, days As Integer)
datVoraussichtlichesEintreffen._value = Convert.ToDateTime(givenDate._value).AddDays(days)
datVoraussichtlichesEintreffen.Show()
End Sub
Private Sub btnOK_Click(sender As Object, e As EventArgs) Handles btnOK.Click
calculatedDate = CDate(datVoraussichtlichesEintreffen._value)
Close()
calculatedDate = CDate(txbVoraussichtlichesEintreffen._value)
' Close()
'btnOK.DialogResult = DialogResult.OK
End Sub
Private Sub btnCancel_Click(sender As Object, e As EventArgs) Handles btnCancel.Click
Close()
End Sub
Private Sub txbAbgangsdatum_TextChanged(sender As Object, e As EventArgs) Handles txbAbgangsdatum.TextChanged
Private Sub txbAbgangsdatum_TextChanged(sender As Object, e As EventArgs) Handles txbAbgangsdatum.TextChanged, cbxVon.SelectedValueChanged
If checkIfDepartureDateIsFilled() = False Then Exit Sub
days = calculateTripDuration()
calcDays = days
If days > 0 Then
addDaysToGivenDate2(txbAbgangsdatum, days)
addDaysToGivenDate(txbAbgangsdatum, days)
End If
checkIfDepatureDateIsNotPast()
End Sub
Function checkIfDepartureDateIsFilled() As Boolean
Dim isFilled = False
If txbAbgangsdatum._value = "" Then
lblWarning.Visible = True
lblDauer.Visible = False
lblberechneteDauer.Text = ""
lblberechneteDauer.Visible = False
btnOK.DialogResult = DialogResult.None
Else
lblWarning.Visible = False
isFilled = True
lblDauer.Visible = True
btnOK.DialogResult = DialogResult.OK
calcDuration()
End If
Return isFilled
End Function
Function checkIfDepatureDateIsNotPast() As Boolean
Dim depatureDateIsNotPast = False
If txbVoraussichtlichesEintreffen._value <> "" Then
If CDate(txbVoraussichtlichesEintreffen._value) >= CDate(Today().ToShortDateString) Then
depatureDateIsNotPast = True
lbWarningDateIsPast.Visible = False
btnOK.DialogResult = DialogResult.OK
btnMinus.Enabled = True
Else
btnOK.DialogResult = DialogResult.None
lbWarningDateIsPast.Visible = True
btnMinus.Enabled = False
End If
End If
Return depatureDateIsNotPast
End Function
Function calcDuration()
Dim result As Integer = 0
If txbVoraussichtlichesEintreffen._value <> "" Then
Dim StartDate = Convert.ToDateTime(txbAbgangsdatum._value)
Dim EndDate = Convert.ToDateTime(txbVoraussichtlichesEintreffen._value)
result = (EndDate - StartDate).Days
If (result < 0) Then
MsgBox("Transportdauer kann nicht negativ sein!")
btnOK.DialogResult = DialogResult.None
Else
btnOK.DialogResult = DialogResult.OK
End If
End If
Return result
End Function
End Class