From ed48c0eaef32685bb4302db2e3bbe60b8fc76cf8 Mon Sep 17 00:00:00 2001 From: "d.breimaier" Date: Wed, 5 Oct 2022 17:07:53 +0200 Subject: [PATCH] frmRoutenBerechnung im frmEintragAvios eingebaut, inkl. Berechnungslogik --- Aviso/Aviso.vbproj | 9 + Aviso/frmEintragAviso.designer.vb | 58 +++--- Aviso/frmEintragAviso.resx | 6 - Aviso/frmEintragAviso.vb | 34 ++-- Aviso/frmNCTSRouten.Designer.vb | 237 ++++++++++++++++++---- Aviso/frmNCTSRouten.vb | 198 +++++++++++++++--- Aviso/frmRoutendauerBerechnen.Designer.vb | 232 +++++++++++++++++++++ Aviso/frmRoutendauerBerechnen.resx | 120 +++++++++++ Aviso/frmRoutendauerBerechnen.vb | 119 +++++++++++ 9 files changed, 892 insertions(+), 121 deletions(-) create mode 100644 Aviso/frmRoutendauerBerechnen.Designer.vb create mode 100644 Aviso/frmRoutendauerBerechnen.resx create mode 100644 Aviso/frmRoutendauerBerechnen.vb diff --git a/Aviso/Aviso.vbproj b/Aviso/Aviso.vbproj index 30819c3..f3a2f8f 100644 --- a/Aviso/Aviso.vbproj +++ b/Aviso/Aviso.vbproj @@ -540,6 +540,12 @@ Form + + frmRoutendauerBerechnen.vb + + + Form + frmSndVorgeschriebenSetzen.vb @@ -1050,6 +1056,9 @@ frmNCTSRouten.vb + + frmRoutendauerBerechnen.vb + frmSndVorgeschriebenSetzen.vb diff --git a/Aviso/frmEintragAviso.designer.vb b/Aviso/frmEintragAviso.designer.vb index 89d53e4..e7996af 100644 --- a/Aviso/frmEintragAviso.designer.vb +++ b/Aviso/frmEintragAviso.designer.vb @@ -75,6 +75,7 @@ Partial Class frmEintragAviso Me.cboGrenzstelle = New VERAG_PROG_ALLGEMEIN.MyComboBox() Me.lblAktenuebersicht = New System.Windows.Forms.Label() Me.grpAviso = New System.Windows.Forms.GroupBox() + Me.cbxEintreffenAus = New VERAG_PROG_ALLGEMEIN.MyComboBox() Me.lblTeamFraechter = New System.Windows.Forms.Label() Me.lblTeamAvisierer = New System.Windows.Forms.Label() Me.cboTransportmittelart = New VERAG_PROG_ALLGEMEIN.MyComboBox() @@ -82,7 +83,7 @@ Partial Class frmEintragAviso Me.PictureBox1 = New System.Windows.Forms.PictureBox() Me.Button1 = New System.Windows.Forms.Button() Me.lblErr_KdNr = New System.Windows.Forms.Label() - Me.Button5 = New System.Windows.Forms.Button() + Me.btnStreckendauerBerechnen = New System.Windows.Forms.Button() Me.lblErrVorraussuchtlEintreffen = New System.Windows.Forms.Label() Me.txtAvisiererAuftragsNr = New System.Windows.Forms.TextBox() Me.lblAvisiererAtrNr = New System.Windows.Forms.Label() @@ -153,7 +154,6 @@ Partial Class frmEintragAviso Me.Label2 = New System.Windows.Forms.Label() Me.UsrCntlAviso_Vorpapiere1 = New AVISO.usrCntlAviso_Vorpapiere() Me.UsrCntlEintragAvisoAtilla = New AVISO.usrCntlEintragAvisoAtilla() - Me.cbxEintreffenAus = New VERAG_PROG_ALLGEMEIN.MyComboBox() Me.panAdmin.SuspendLayout() Me.grpAviso.SuspendLayout() CType(Me.PictureBox1, System.ComponentModel.ISupportInitialize).BeginInit() @@ -737,7 +737,7 @@ Partial Class frmEintragAviso Me.grpAviso.Controls.Add(Me.PictureBox1) Me.grpAviso.Controls.Add(Me.Button1) Me.grpAviso.Controls.Add(Me.lblErr_KdNr) - Me.grpAviso.Controls.Add(Me.Button5) + Me.grpAviso.Controls.Add(Me.btnStreckendauerBerechnen) Me.grpAviso.Controls.Add(Me.lblErrVorraussuchtlEintreffen) Me.grpAviso.Controls.Add(Me.txtAvisiererAuftragsNr) Me.grpAviso.Controls.Add(Me.lblAvisiererAtrNr) @@ -790,6 +790,17 @@ Partial Class frmEintragAviso Me.grpAviso.TabStop = False Me.grpAviso.Text = "Aviso" ' + 'cbxEintreffenAus + ' + Me.cbxEintreffenAus._allowedValuesFreiText = Nothing + Me.cbxEintreffenAus._allowFreiText = True + Me.cbxEintreffenAus._value = "" + Me.cbxEintreffenAus.FormattingEnabled = True + Me.cbxEintreffenAus.Location = New System.Drawing.Point(218, 99) + Me.cbxEintreffenAus.Name = "cbxEintreffenAus" + Me.cbxEintreffenAus.Size = New System.Drawing.Size(81, 21) + Me.cbxEintreffenAus.TabIndex = 51 + ' 'lblTeamFraechter ' Me.lblTeamFraechter.BackColor = System.Drawing.Color.Transparent @@ -880,17 +891,16 @@ Partial Class frmEintragAviso Me.lblErr_KdNr.Text = "Kunden-Nummer eingeben!" Me.lblErr_KdNr.Visible = False ' - 'Button5 + 'btnStreckendauerBerechnen ' - Me.Button5.FlatStyle = System.Windows.Forms.FlatStyle.Flat - Me.Button5.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.0!) - Me.Button5.Location = New System.Drawing.Point(279, 27) - Me.Button5.Name = "Button5" - Me.Button5.Size = New System.Drawing.Size(118, 21) - Me.Button5.TabIndex = 7 - Me.Button5.Text = "Berechnen" - Me.Button5.UseVisualStyleBackColor = True - Me.Button5.Visible = False + 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.Name = "btnStreckendauerBerechnen" + Me.btnStreckendauerBerechnen.Size = New System.Drawing.Size(118, 21) + Me.btnStreckendauerBerechnen.TabIndex = 7 + Me.btnStreckendauerBerechnen.Text = "Berechnen" + Me.btnStreckendauerBerechnen.UseVisualStyleBackColor = True ' 'lblErrVorraussuchtlEintreffen ' @@ -898,9 +908,9 @@ Partial Class frmEintragAviso Me.lblErrVorraussuchtlEintreffen.ForeColor = System.Drawing.Color.Red Me.lblErrVorraussuchtlEintreffen.Location = New System.Drawing.Point(147, 69) Me.lblErrVorraussuchtlEintreffen.Name = "lblErrVorraussuchtlEintreffen" - Me.lblErrVorraussuchtlEintreffen.Size = New System.Drawing.Size(244, 13) + Me.lblErrVorraussuchtlEintreffen.Size = New System.Drawing.Size(250, 13) Me.lblErrVorraussuchtlEintreffen.TabIndex = 8 - Me.lblErrVorraussuchtlEintreffen.Text = "Datum kann icht kleiner als Erfassungsdatum sein!" + Me.lblErrVorraussuchtlEintreffen.Text = "Datum kann nicht kleiner als Erfassungsdatum sein!" Me.lblErrVorraussuchtlEintreffen.Visible = False ' 'txtAvisiererAuftragsNr @@ -1316,9 +1326,9 @@ Partial Class frmEintragAviso Me.lblVoraussEintreff.AutoSize = True Me.lblVoraussEintreff.Location = New System.Drawing.Point(25, 51) Me.lblVoraussEintreff.Name = "lblVoraussEintreff" - Me.lblVoraussEintreff.Size = New System.Drawing.Size(160, 13) + Me.lblVoraussEintreff.Size = New System.Drawing.Size(140, 13) Me.lblVoraussEintreff.TabIndex = 5 - Me.lblVoraussEintreff.Text = "Voraussichtliches Eintreffen aus:" + Me.lblVoraussEintreff.Text = "Voraussichtliches Eintreffen:" Me.lblVoraussEintreff.Visible = False ' 'datVoraussichtlichesEintreffen @@ -1327,7 +1337,6 @@ Partial Class frmEintragAviso Me.datVoraussichtlichesEintreffen.Format = System.Windows.Forms.DateTimePickerFormat.Custom Me.datVoraussichtlichesEintreffen.Location = New System.Drawing.Point(319, 49) Me.datVoraussichtlichesEintreffen.Name = "datVoraussichtlichesEintreffen" - Me.datVoraussichtlichesEintreffen.ShowUpDown = True Me.datVoraussichtlichesEintreffen.Size = New System.Drawing.Size(76, 20) Me.datVoraussichtlichesEintreffen.TabIndex = 6 Me.datVoraussichtlichesEintreffen.Value = New Date(2020, 1, 23, 0, 0, 0, 0) @@ -1832,17 +1841,6 @@ Partial Class frmEintragAviso Me.UsrCntlEintragAvisoAtilla.TabIndex = 8 Me.UsrCntlEintragAvisoAtilla.Visible = False ' - 'cbxEintreffenAus - ' - Me.cbxEintreffenAus._allowedValuesFreiText = Nothing - Me.cbxEintreffenAus._allowFreiText = False - Me.cbxEintreffenAus._value = "" - Me.cbxEintreffenAus.FormattingEnabled = True - Me.cbxEintreffenAus.Location = New System.Drawing.Point(186, 48) - Me.cbxEintreffenAus.Name = "cbxEintreffenAus" - Me.cbxEintreffenAus.Size = New System.Drawing.Size(81, 21) - Me.cbxEintreffenAus.TabIndex = 51 - ' 'frmEintragAviso ' Me.AcceptButton = Me.btnOK @@ -2023,7 +2021,7 @@ Partial Class frmEintragAviso Friend WithEvents txtAvisiererAuftragsNr As TextBox Friend WithEvents lblAvisiererAtrNr As Label Friend WithEvents lblErrVorraussuchtlEintreffen As Label - Friend WithEvents Button5 As Button + Friend WithEvents btnStreckendauerBerechnen As Button Friend WithEvents lblVoraussEintreff As Label Friend WithEvents datVoraussichtlichesEintreffen As DateTimePicker Friend WithEvents columnName As DataGridViewTextBoxColumn diff --git a/Aviso/frmEintragAviso.resx b/Aviso/frmEintragAviso.resx index 4f442f2..27f42d4 100644 --- a/Aviso/frmEintragAviso.resx +++ b/Aviso/frmEintragAviso.resx @@ -216,12 +216,6 @@ True - - True - - - True - AAABAAEAgIAAAAEAIAAoCAEAFgAAACgAAACAAAAAAAEAAAEAIAAAAAAAAAgBABMLAAATCwAAAAAAAAAA diff --git a/Aviso/frmEintragAviso.vb b/Aviso/frmEintragAviso.vb index 3b47231..5985347 100644 --- a/Aviso/frmEintragAviso.vb +++ b/Aviso/frmEintragAviso.vb @@ -522,7 +522,7 @@ Public Class frmEintragAviso dtpAvisoEingangZeit.Enabled = bearb End If - cbxEintreffenAus.fillWithSQL("SELECT [nctsr_dauer_in_tagen], [nctsr_von] FROM [tblNTCSRouten] ", False, "FMZOLL", False) + 'cbxEintreffenAus.fillWithSQL("SELECT [nctsr_dauer_in_tagen], [nctsr_von] FROM [tblNTCSRouten] ", False, "FMZOLL", False) initAttachment() @@ -1831,36 +1831,30 @@ Public Class frmEintragAviso End If End Sub - Private Sub cbxEintreffenAus_SelectedValueChanged(sender As Object, e As EventArgs) Handles cbxEintreffenAus.SelectedValueChanged - - - Dim days = calculateTripDuration() - - If days < 0 Then Exit Sub - - datVoraussichtlichesEintreffen.Enabled = False - datVoraussichtlichesEintreffen.Value = DateTime.Now.AddDays(days) - End Sub - Function calculateTripDuration() + Private Sub Button5_Click_1(sender As Object, e As EventArgs) Handles btnStreckendauerBerechnen.Click - Dim destination As String - Dim departure As String + Dim destination As String = "" - If cboGrenzstelle._value = "???" Then + If cboGrenzstelle._value = "???" AndAlso txtBestimmungszollstelle._value IsNot Nothing Then destination = txtBestimmungszollstelle._value Else destination = cboGrenzstelle._value End If - departure = cbxEintreffenAus.Text + If destination Is "" Or destination Is Nothing Then + MsgBox("Zur Berechnung muss vorher eine Grenzstelle/Zollstelle ausgewählt werden!") + Else + Dim frmGrayOut = VERAG_PROG_ALLGEMEIN.cMeineFunktionenAVISO.grayoutForm() + Dim frmRouteBerechnen = New frmRoutendauerBerechnen(destination) - Dim days As Integer = SQL.DLookup("nctsr_dauer_in_tagen", "tblNTCSRouten", "[nctsr_von]='" & departure & "' AND [nctsr_nach]= '" & destination & "'", "VERAG", "") - If days > 0 Then Return days - Return -1 + If frmRouteBerechnen.ShowDialog(frmGrayOut) = DialogResult.OK Then + datVoraussichtlichesEintreffen.Value = frmRouteBerechnen.calculatedDate + End If - End Function + End If + End Sub End Class diff --git a/Aviso/frmNCTSRouten.Designer.vb b/Aviso/frmNCTSRouten.Designer.vb index 467ea71..ef85598 100644 --- a/Aviso/frmNCTSRouten.Designer.vb +++ b/Aviso/frmNCTSRouten.Designer.vb @@ -23,35 +23,44 @@ Partial Class frmNCTSRouten Private Sub InitializeComponent() Me.components = New System.ComponentModel.Container() - Me.btn_OK = New System.Windows.Forms.Button() + Me.btnOK = New System.Windows.Forms.Button() Me.btn_Cancel = New System.Windows.Forms.Button() Me.pnlNCTSRouten = New VERAG_PROG_ALLGEMEIN.MyPanel(Me.components) + Me.cbxVon = New VERAG_PROG_ALLGEMEIN.MyComboBox() + Me.sbxNach = New VERAG_PROG_ALLGEMEIN.MySearchBox() + Me.lblWarningRoute = New System.Windows.Forms.Label() + Me.lblWarningAZS = New System.Windows.Forms.Label() + Me.lblWarningDauer = New System.Windows.Forms.Label() + Me.lblWarningBST = New System.Windows.Forms.Label() Me.sbxVon = New VERAG_PROG_ALLGEMEIN.MySearchBox() Me.Label2 = New System.Windows.Forms.Label() - Me.btnNeu = New System.Windows.Forms.Button() Me.Label1 = New System.Windows.Forms.Label() Me.Label3 = New System.Windows.Forms.Label() Me.Label4 = New System.Windows.Forms.Label() 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.pnlNCTSRouten.SuspendLayout() CType(Me.dgvNCTSRouten, System.ComponentModel.ISupportInitialize).BeginInit() Me.SuspendLayout() ' - 'btn_OK + 'btnOK ' - Me.btn_OK.Location = New System.Drawing.Point(376, 379) - Me.btn_OK.Name = "btn_OK" - Me.btn_OK.Size = New System.Drawing.Size(75, 23) - Me.btn_OK.TabIndex = 1 - Me.btn_OK.Text = "OK" - Me.btn_OK.UseVisualStyleBackColor = True + Me.btnOK.Location = New System.Drawing.Point(478, 468) + Me.btnOK.Name = "btnOK" + Me.btnOK.Size = New System.Drawing.Size(75, 23) + Me.btnOK.TabIndex = 1 + Me.btnOK.Text = "OK" + Me.btnOK.UseVisualStyleBackColor = True ' 'btn_Cancel ' - Me.btn_Cancel.Location = New System.Drawing.Point(12, 379) + 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) Me.btn_Cancel.TabIndex = 2 @@ -60,20 +69,110 @@ Partial Class frmNCTSRouten ' 'pnlNCTSRouten ' + Me.pnlNCTSRouten.Controls.Add(Me.txtNach) + Me.pnlNCTSRouten.Controls.Add(Me.txtVon) + Me.pnlNCTSRouten.Controls.Add(Me.cbxVon) + Me.pnlNCTSRouten.Controls.Add(Me.sbxNach) + Me.pnlNCTSRouten.Controls.Add(Me.lblWarningRoute) + Me.pnlNCTSRouten.Controls.Add(Me.lblWarningAZS) + Me.pnlNCTSRouten.Controls.Add(Me.lblWarningDauer) + Me.pnlNCTSRouten.Controls.Add(Me.lblWarningBST) Me.pnlNCTSRouten.Controls.Add(Me.sbxVon) Me.pnlNCTSRouten.Controls.Add(Me.Label2) - Me.pnlNCTSRouten.Controls.Add(Me.btnNeu) Me.pnlNCTSRouten.Controls.Add(Me.Label1) Me.pnlNCTSRouten.Controls.Add(Me.Label3) Me.pnlNCTSRouten.Controls.Add(Me.Label4) Me.pnlNCTSRouten.Controls.Add(Me.cbxNach) Me.pnlNCTSRouten.Controls.Add(Me.txtDauer) Me.pnlNCTSRouten.Controls.Add(Me.cbxRoutenart) - Me.pnlNCTSRouten.Location = New System.Drawing.Point(12, 12) + Me.pnlNCTSRouten.Location = New System.Drawing.Point(12, 4) Me.pnlNCTSRouten.Name = "pnlNCTSRouten" - Me.pnlNCTSRouten.Size = New System.Drawing.Size(439, 127) + Me.pnlNCTSRouten.Size = New System.Drawing.Size(392, 197) Me.pnlNCTSRouten.TabIndex = 30 ' + 'cbxVon + ' + Me.cbxVon._allowedValuesFreiText = New String() {"Test"} + Me.cbxVon._allowFreiText = False + Me.cbxVon._value = "" + Me.cbxVon.Enabled = False + Me.cbxVon.FormattingEnabled = True + Me.cbxVon.Location = New System.Drawing.Point(10, 25) + Me.cbxVon.Name = "cbxVon" + Me.cbxVon.Size = New System.Drawing.Size(121, 21) + Me.cbxVon.TabIndex = 37 + ' + 'sbxNach + ' + Me.sbxNach._allowFreitext = True + Me.sbxNach._AllowSetValue = False + Me.sbxNach._allowSpaceAsSplitter = False + Me.sbxNach._autoSizeGross = False + Me.sbxNach._hideIfListEmpty = True + Me.sbxNach._value = Nothing + Me.sbxNach.conn_art = "FMZOLL" + Me.sbxNach.dgvpos = "LEFT" + Me.sbxNach.DISPLAY_PARAM = Nothing + Me.sbxNach.Enabled = False + Me.sbxNach.INVISIBLE_COLUMNS = Nothing + Me.sbxNach.key_visible = False + Me.sbxNach.KEYPARAM = Nothing + Me.sbxNach.Location = New System.Drawing.Point(221, 65) + Me.sbxNach.Name = "sbxNach" + Me.sbxNach.searchActive = True + Me.sbxNach.Size = New System.Drawing.Size(161, 20) + Me.sbxNach.SQL_ORDER_BY = Nothing + Me.sbxNach.SQL_SELECT = Nothing + Me.sbxNach.SQL_WHERE = Nothing + Me.sbxNach.SQL_WhereParamList = Nothing + Me.sbxNach.TabIndex = 36 + Me.sbxNach.usrcntl = Nothing + Me.sbxNach.Visible = False + ' + 'lblWarningRoute + ' + Me.lblWarningRoute.AutoSize = True + Me.lblWarningRoute.ForeColor = System.Drawing.Color.Red + Me.lblWarningRoute.Location = New System.Drawing.Point(10, 156) + Me.lblWarningRoute.Name = "lblWarningRoute" + Me.lblWarningRoute.Size = New System.Drawing.Size(105, 13) + Me.lblWarningRoute.TabIndex = 35 + Me.lblWarningRoute.Text = "Bitte Route angeben" + Me.lblWarningRoute.Visible = False + ' + 'lblWarningAZS + ' + Me.lblWarningAZS.AutoSize = True + Me.lblWarningAZS.ForeColor = System.Drawing.Color.Red + Me.lblWarningAZS.Location = New System.Drawing.Point(10, 49) + Me.lblWarningAZS.Name = "lblWarningAZS" + Me.lblWarningAZS.Size = New System.Drawing.Size(135, 13) + Me.lblWarningAZS.TabIndex = 34 + Me.lblWarningAZS.Text = "Bitte Abgangs-ZS angeben" + Me.lblWarningAZS.Visible = False + ' + 'lblWarningDauer + ' + Me.lblWarningDauer.AutoSize = True + Me.lblWarningDauer.ForeColor = System.Drawing.Color.Red + Me.lblWarningDauer.Location = New System.Drawing.Point(218, 156) + Me.lblWarningDauer.Name = "lblWarningDauer" + Me.lblWarningDauer.Size = New System.Drawing.Size(90, 13) + Me.lblWarningDauer.TabIndex = 33 + Me.lblWarningDauer.Text = "Dauer nicht gültig" + Me.lblWarningDauer.Visible = False + ' + 'lblWarningBST + ' + Me.lblWarningBST.AutoSize = True + Me.lblWarningBST.ForeColor = System.Drawing.Color.Red + Me.lblWarningBST.Location = New System.Drawing.Point(217, 49) + Me.lblWarningBST.Name = "lblWarningBST" + Me.lblWarningBST.Size = New System.Drawing.Size(155, 13) + Me.lblWarningBST.TabIndex = 32 + Me.lblWarningBST.Text = "Bitte Bestimmungs-ZS angeben" + Me.lblWarningBST.Visible = False + ' 'sbxVon ' Me.sbxVon._allowFreitext = True @@ -89,7 +188,7 @@ Partial Class frmNCTSRouten Me.sbxVon.INVISIBLE_COLUMNS = Nothing Me.sbxVon.key_visible = False Me.sbxVon.KEYPARAM = Nothing - Me.sbxVon.Location = New System.Drawing.Point(10, 26) + Me.sbxVon.Location = New System.Drawing.Point(10, 65) Me.sbxVon.Name = "sbxVon" Me.sbxVon.searchActive = True Me.sbxVon.Size = New System.Drawing.Size(161, 20) @@ -99,6 +198,7 @@ Partial Class frmNCTSRouten Me.sbxVon.SQL_WhereParamList = Nothing Me.sbxVon.TabIndex = 30 Me.sbxVon.usrcntl = Nothing + Me.sbxVon.Visible = False ' 'Label2 ' @@ -110,15 +210,6 @@ Partial Class frmNCTSRouten Me.Label2.Text = "Bestimmungszollstelle:" Me.Label2.TextAlign = System.Drawing.ContentAlignment.TopCenter ' - 'btnNeu - ' - Me.btnNeu.Image = Global.AVISO.My.Resources.Resources.plus - Me.btnNeu.Location = New System.Drawing.Point(379, 78) - Me.btnNeu.Name = "btnNeu" - Me.btnNeu.Size = New System.Drawing.Size(44, 31) - Me.btnNeu.TabIndex = 29 - Me.btnNeu.UseVisualStyleBackColor = True - ' 'Label1 ' Me.Label1.AutoSize = True @@ -131,7 +222,7 @@ Partial Class frmNCTSRouten 'Label3 ' Me.Label3.AutoSize = True - Me.Label3.Location = New System.Drawing.Point(10, 61) + Me.Label3.Location = New System.Drawing.Point(10, 116) Me.Label3.Name = "Label3" Me.Label3.Size = New System.Drawing.Size(39, 13) Me.Label3.TabIndex = 4 @@ -140,7 +231,7 @@ Partial Class frmNCTSRouten 'Label4 ' Me.Label4.AutoSize = True - Me.Label4.Location = New System.Drawing.Point(217, 62) + Me.Label4.Location = New System.Drawing.Point(217, 117) Me.Label4.Name = "Label4" Me.Label4.Size = New System.Drawing.Size(90, 13) Me.Label4.TabIndex = 5 @@ -149,11 +240,11 @@ Partial Class frmNCTSRouten 'cbxNach ' Me.cbxNach._allowedValuesFreiText = New String() {"Test"} - Me.cbxNach._allowFreiText = True + Me.cbxNach._allowFreiText = False Me.cbxNach._value = "" Me.cbxNach.Enabled = False Me.cbxNach.FormattingEnabled = True - Me.cbxNach.Location = New System.Drawing.Point(220, 26) + Me.cbxNach.Location = New System.Drawing.Point(221, 26) Me.cbxNach.Name = "cbxNach" Me.cbxNach.Size = New System.Drawing.Size(121, 21) Me.cbxNach.TabIndex = 2 @@ -161,7 +252,7 @@ Partial Class frmNCTSRouten 'txtDauer ' Me.txtDauer.Enabled = False - Me.txtDauer.Location = New System.Drawing.Point(220, 78) + Me.txtDauer.Location = New System.Drawing.Point(220, 133) Me.txtDauer.Name = "txtDauer" Me.txtDauer.Size = New System.Drawing.Size(100, 20) Me.txtDauer.TabIndex = 4 @@ -173,11 +264,20 @@ Partial Class frmNCTSRouten Me.cbxRoutenart._value = "" Me.cbxRoutenart.Enabled = False Me.cbxRoutenart.FormattingEnabled = True - Me.cbxRoutenart.Location = New System.Drawing.Point(10, 77) + Me.cbxRoutenart.Location = New System.Drawing.Point(10, 132) Me.cbxRoutenart.Name = "cbxRoutenart" 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 @@ -187,24 +287,84 @@ Partial Class frmNCTSRouten Me.dgvNCTSRouten.AllowUserToResizeRows = False Me.dgvNCTSRouten.BackgroundColor = System.Drawing.Color.White Me.dgvNCTSRouten.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize - Me.dgvNCTSRouten.Location = New System.Drawing.Point(12, 145) + Me.dgvNCTSRouten.Location = New System.Drawing.Point(12, 217) Me.dgvNCTSRouten.MultiSelect = False Me.dgvNCTSRouten.Name = "dgvNCTSRouten" Me.dgvNCTSRouten.ReadOnly = True Me.dgvNCTSRouten.RowHeadersVisible = False Me.dgvNCTSRouten.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect - Me.dgvNCTSRouten.Size = New System.Drawing.Size(437, 217) + Me.dgvNCTSRouten.Size = New System.Drawing.Size(541, 243) Me.dgvNCTSRouten.TabIndex = 10 ' + '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 + ' + '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 + ' 'frmNCTSRouten ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font - Me.ClientSize = New System.Drawing.Size(480, 415) + Me.ClientSize = New System.Drawing.Size(565, 503) + Me.Controls.Add(Me.btnSave) Me.Controls.Add(Me.pnlNCTSRouten) Me.Controls.Add(Me.dgvNCTSRouten) Me.Controls.Add(Me.btn_Cancel) - Me.Controls.Add(Me.btn_OK) + Me.Controls.Add(Me.btnOK) + Me.Controls.Add(Me.btnNeu) Me.Name = "frmNCTSRouten" Me.Text = "frmNCTSRouten" Me.pnlNCTSRouten.ResumeLayout(False) @@ -215,7 +375,7 @@ Partial Class frmNCTSRouten End Sub Friend WithEvents Label1 As Label - Friend WithEvents btn_OK As Button + Friend WithEvents btnOK As Button Friend WithEvents btn_Cancel As Button Friend WithEvents Label2 As Label Friend WithEvents Label3 As Label @@ -227,4 +387,13 @@ Partial Class frmNCTSRouten Friend WithEvents btnNeu As Button Friend WithEvents pnlNCTSRouten As VERAG_PROG_ALLGEMEIN.MyPanel Friend WithEvents sbxVon As VERAG_PROG_ALLGEMEIN.MySearchBox + Friend WithEvents lblWarningRoute As Label + Friend WithEvents lblWarningAZS As Label + Friend WithEvents lblWarningDauer As Label + Friend WithEvents lblWarningBST As Label + Friend WithEvents btnSave As Button + Friend WithEvents sbxNach As VERAG_PROG_ALLGEMEIN.MySearchBox + Friend WithEvents cbxVon As VERAG_PROG_ALLGEMEIN.MyComboBox + Friend WithEvents txtNach As VERAG_PROG_ALLGEMEIN.MyTextBox + Friend WithEvents txtVon As VERAG_PROG_ALLGEMEIN.MyTextBox End Class diff --git a/Aviso/frmNCTSRouten.vb b/Aviso/frmNCTSRouten.vb index 0da31f8..6e3b3f3 100644 --- a/Aviso/frmNCTSRouten.vb +++ b/Aviso/frmNCTSRouten.vb @@ -1,36 +1,62 @@  +Imports System.Security.Authentication.ExtendedProtection +Imports GrapeCity.ActiveReports.Document.Section Imports VERAG_PROG_ALLGEMEIN + Public Class frmNCTSRouten Dim routenId As Integer = -1 Private sql As New VERAG_PROG_ALLGEMEIN.SQL Dim currentRoute As New VERAG_PROG_ALLGEMEIN.cNCTSRouten + Public FIRMA_TMP As String = VERAG_PROG_ALLGEMEIN.cAllgemein.FIRMA Private Sub frmNCTSRouten_Load(sender As Object, e As EventArgs) Handles MyBase.Load init() End Sub Sub init() - btn_OK.Text = "OK" + initDGVRouten() + 'Abgangszollstelle + 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.changeItem("") + + sbxVon.initSearchBox(Me.FindForm, "[Code] ,[Code] as Nr,Description as Dienststelle,left(Code,2) as Land,[Description] +' (' +left(Code,2)+')' as display FROM [tbl_DY_ZollDE_C0141_Zollstellen]", + {" [Code]", "Description"}, + " (StartDate is null OR StartDate< GETDATE()) AND (EndDate is null OR EndDate> GETDATE()) ", + " left(Code,2),[Description]", "Code", "display", "FMZOLL", , 400, 200, {"display", "Code"}) + + + 'Bestimmungszollstelle cbxNach.Items.Clear() - cbxNach.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("", "")) - cbxNach.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("Suben", "SUB")) - cbxNach.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("Salzburg", "SBG")) - cbxNach.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("Waidhofen", "WAI")) - cbxNach.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("Nickelsdorf", "NKD")) + 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.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("???", "???")) cbxNach.changeItem("") + sbxNach.initSearchBox(Me.FindForm, "[Code] ,[Code] as Nr,Description as Dienststelle,left(Code,2) as Land,[Description] +' (' +left(Code,2)+')' as display FROM [tbl_DY_ZollDE_C0141_Zollstellen]", + {" [Code]", "Description"}, + " (StartDate is null OR StartDate< GETDATE()) AND (EndDate is null OR EndDate> GETDATE()) ", + " left(Code,2),[Description]", "Code", "display", "FMZOLL", , 400, 200, {"display", "Code"}) + + cbxRoutenart.Items.Clear() cbxRoutenart.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("", "")) cbxRoutenart.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("Landweg", "Landweg")) cbxRoutenart.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("Seeweg", "Seeweg")) cbxRoutenart.changeItem("") - sbxVon.initSearchBox(Me.FindForm, "[Code] ,[Code] as Nr,Description as Dienststelle,left(Code,2) as Land,[Description] +' (' +left(Code,2)+')' as display FROM [tbl_DY_ZollDE_C0141_Zollstellen]", {" [Code]", "Description"}, " (StartDate is null OR StartDate< GETDATE()) AND (EndDate is null OR EndDate> GETDATE()) ", " left(Code,2),[Description]", "Code", "display", "FMZOLL", , 400, 200, {"display", "Code"}) + + + + + txtDauer.Text = "" + txtVon.Text = "" + txtNach.Text = "" dgvNCTSRouten.ClearSelection() DisableUserControl() @@ -47,7 +73,7 @@ Public Class frmNCTSRouten .Columns.Clear() - .DataSource = sql.loadDgvBySql("SELECT [nctsr_id],[nctsr_von],[nctsr_nach],[nctsr_dauer_in_tagen],[nctsr_route] FROM [VERAG].[dbo].[tblNTCSRouten]", + .DataSource = sql.loadDgvBySql("SELECT [nctsr_id],[nctsr_von],[nctsr_nach],[nctsr_dauer_in_tagen],[nctsr_route], [nctsr_tansportmittel] FROM [VERAG].[dbo].[tblNTCSRouten]", "VERAG") ' .RowTemplate.Height = 30 @@ -64,6 +90,8 @@ Public Class frmNCTSRouten .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 @@ -77,8 +105,8 @@ Public Class frmNCTSRouten Private Sub saveRoute(curRoute As cNCTSRouten) - curRoute.nctsr_von = sbxVon._value - curRoute.nctsr_nach = cbxNach._value + 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_route = cbxRoutenart._value curRoute.nctsr_dauer_in_tagen = CInt(txtDauer.Text) @@ -104,7 +132,8 @@ Public Class frmNCTSRouten .nctsr_von = "", .nctsr_nach = "", .nctsr_dauer_in_tagen = 0, - .nctsr_route = "Landweg" + .nctsr_route = "", + .nctsr_tansportmittel = "LKW" } loadChangedDSToPanel(currentRoute) EnableUserControl() @@ -113,14 +142,20 @@ Public Class frmNCTSRouten End Sub Sub setSaveButton() - btn_OK.Text = "Speichern" + btnSave.Visible = True + btnOK.Visible = False + End Sub + + Sub setOKButton() + btnSave.Visible = False + btnOK.Visible = True End Sub Private Sub loadChangedDSToPanel(curRoute As VERAG_PROG_ALLGEMEIN.cNCTSRouten) - sbxVon.SET_VALUE(curRoute.nctsr_von.ToString) - cbxNach.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem(curRoute.nctsr_nach.ToString, curRoute.nctsr_nach.ToString)) - cbxNach._value = curRoute.nctsr_nach.ToString + + txtVon.Text = curRoute.nctsr_von.ToString + txtNach.Text = curRoute.nctsr_nach.ToString cbxRoutenart._value = curRoute.nctsr_route.ToString txtDauer.Text = curRoute.nctsr_dauer_in_tagen.ToString @@ -133,18 +168,17 @@ Public Class frmNCTSRouten Next End Sub + Private Sub checkDestination() + + End Sub + Private Sub SomethingChanged(sender As Object, e As EventArgs) setSaveButton() End Sub - Private Sub btn_OK_Click(sender As Object, e As EventArgs) Handles btn_OK.Click - If (btn_OK.Text = "Speichern") Then - saveRoute(currentRoute) - btn_OK.Text = "OK" - Else - Close() - End If + Private Sub btn_OK_Click(sender As Object, e As EventArgs) Handles btnOK.Click + Close() End Sub @@ -153,17 +187,19 @@ Public Class frmNCTSRouten End Sub Private Sub EnableUserControl() - cbxNach.Enabled = True - cbxRoutenart.Enabled = True - sbxVon.Enabled = True - txtDauer.Enabled = True + + For Each c As Control In pnlNCTSRouten.Controls + c.Enabled = True + Next + End Sub Private Sub DisableUserControl() - cbxNach.Enabled = False - cbxRoutenart.Enabled = False - sbxVon.Enabled = False - txtDauer.Enabled = False + + For Each c As Control In pnlNCTSRouten.Controls + c.Enabled = False + Next + End Sub Private Sub dgvNCTSRouten_SelectionChanged(sender As Object, e As EventArgs) Handles dgvNCTSRouten.SelectionChanged @@ -174,8 +210,10 @@ 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) + If dgvNCTSRouten.Enabled = False Then Exit Sub routenId = dgvNCTSRouten.SelectedRows(0).Cells("nctsr_id").Value End If @@ -184,5 +222,103 @@ Public Class frmNCTSRouten Private Sub sbxVon_PreviewKeyDown(sender As Object, e As PreviewKeyDownEventArgs) Handles sbxVon.PreviewKeyDown If sender Is sbxVon Then sbxVon.FireReturn() : e.IsInputKey = True : Me.DialogResult = DialogResult.None + If sender Is sbxNach Then sbxNach.FireReturn() : e.IsInputKey = True : Me.DialogResult = DialogResult.None End Sub -End Class \ No newline at end of file + + '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 + + Function checkUserInput(txtDauer As TextBox) As Boolean + + Dim validInputs As Boolean = True + lblWarningBST.Visible = False + lblWarningAZS.Visible = False + lblWarningDauer.Visible = False + lblWarningRoute.Visible = False + + If (cbxVon._value = "" Or cbxVon._value Is Nothing) Then + lblWarningAZS.Visible = True + validInputs = False + End If + If (cbxNach._value = "" Or cbxNach._value Is Nothing) Then + lblWarningBST.Visible = True + validInputs = False + End If + + If (cbxVon._value = "???" AndAlso sbxVon._value Is Nothing) Then + lblWarningAZS.Visible = True + validInputs = False + End If + + If (cbxNach._value = "???" AndAlso sbxNach._value Is Nothing) Then + lblWarningAZS.Visible = True + validInputs = False + End If + + If (cbxNach._value = "" Or cbxNach._value Is Nothing) Then + lblWarningBST.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 + lblWarningRoute.Visible = True + validInputs = False + End If + + Return validInputs + End Function + + Private Sub btnSave_Click(sender As Object, e As EventArgs) Handles btnSave.Click + + If checkUserInput(GetTxtDauer()) Then saveRoute(currentRoute) + + End Sub + + Private Sub cbxVon_SelectedValueChanged(sender As Object, e As EventArgs) Handles cbxVon.SelectedValueChanged + If cbxVon._value.ToString = "???" Then + setSearchboxVisible(sbxVon, True) + + Else + txtVon.Text = cbxVon._value.ToString + setSearchboxVisible(sbxVon, False) + sbxVon.Clear() + End If + End Sub + + Private Sub cbxNach_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cbxNach.SelectedValueChanged + + If cbxNach._value.ToString = "???" Then + setSearchboxVisible(sbxNach, True) + + Else + txtVon.Text = cbxVon._value.ToString + setSearchboxVisible(sbxNach, False) + sbxNach.Clear() + End If + + End Sub + + Sub setSearchboxVisible(searchbox As VERAG_PROG_ALLGEMEIN.MySearchBox, visible As Boolean) + searchbox.Visible = visible + End Sub +End Class + diff --git a/Aviso/frmRoutendauerBerechnen.Designer.vb b/Aviso/frmRoutendauerBerechnen.Designer.vb new file mode 100644 index 0000000..878a5ca --- /dev/null +++ b/Aviso/frmRoutendauerBerechnen.Designer.vb @@ -0,0 +1,232 @@ + _ +Partial Class frmRoutendauerBerechnen + Inherits System.Windows.Forms.Form + + 'Das Formular überschreibt den Löschvorgang, um die Komponentenliste zu bereinigen. + _ + Protected Overrides Sub Dispose(ByVal disposing As Boolean) + Try + If disposing AndAlso components IsNot Nothing Then + components.Dispose() + End If + Finally + MyBase.Dispose(disposing) + End Try + End Sub + + 'Wird vom Windows Form-Designer benötigt. + Private components As System.ComponentModel.IContainer + + 'Hinweis: Die folgende Prozedur ist für den Windows Form-Designer erforderlich. + 'Das Bearbeiten ist mit dem Windows Form-Designer möglich. + 'Das Bearbeiten mit dem Code-Editor ist nicht möglich. + _ + Private Sub InitializeComponent() + Me.btnMinus = New System.Windows.Forms.Button() + Me.btnPlus = New System.Windows.Forms.Button() + Me.cbxVon = New VERAG_PROG_ALLGEMEIN.MyComboBox() + Me.lblBZS = New System.Windows.Forms.Label() + Me.lblAZS = New System.Windows.Forms.Label() + Me.txtNach = New VERAG_PROG_ALLGEMEIN.MyTextBox() + Me.btnOK = New System.Windows.Forms.Button() + 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.Label2 = New System.Windows.Forms.Label() + Me.SuspendLayout() + ' + 'btnMinus + ' + Me.btnMinus.Location = New System.Drawing.Point(234, 105) + Me.btnMinus.Name = "btnMinus" + Me.btnMinus.Size = New System.Drawing.Size(29, 23) + Me.btnMinus.TabIndex = 16 + Me.btnMinus.Text = "-" + Me.btnMinus.UseVisualStyleBackColor = True + ' + 'btnPlus + ' + Me.btnPlus.Location = New System.Drawing.Point(163, 105) + Me.btnPlus.Name = "btnPlus" + Me.btnPlus.Size = New System.Drawing.Size(29, 23) + Me.btnPlus.TabIndex = 15 + Me.btnPlus.Text = "+" + Me.btnPlus.UseVisualStyleBackColor = True + ' + 'cbxVon + ' + Me.cbxVon._allowedValuesFreiText = Nothing + Me.cbxVon._allowFreiText = False + Me.cbxVon._value = "" + Me.cbxVon.FormattingEnabled = True + Me.cbxVon.Location = New System.Drawing.Point(26, 39) + Me.cbxVon.Name = "cbxVon" + Me.cbxVon.Size = New System.Drawing.Size(121, 21) + Me.cbxVon.TabIndex = 13 + ' + 'lblBZS + ' + Me.lblBZS.AutoSize = True + Me.lblBZS.Location = New System.Drawing.Point(160, 23) + Me.lblBZS.Name = "lblBZS" + Me.lblBZS.Size = New System.Drawing.Size(111, 13) + Me.lblBZS.TabIndex = 12 + Me.lblBZS.Text = "Bestimmungszollstelle:" + ' + 'lblAZS + ' + Me.lblAZS.AutoSize = True + Me.lblAZS.Location = New System.Drawing.Point(23, 23) + Me.lblAZS.Name = "lblAZS" + Me.lblAZS.Size = New System.Drawing.Size(91, 13) + Me.lblAZS.TabIndex = 11 + Me.lblAZS.Text = "Abgangszollstelle:" + ' + '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.ForeColor = System.Drawing.Color.Black + Me.txtNach.Location = New System.Drawing.Point(162, 39) + 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(109, 20) + Me.txtNach.TabIndex = 10 + ' + 'btnOK + ' + Me.btnOK.DialogResult = System.Windows.Forms.DialogResult.OK + Me.btnOK.Location = New System.Drawing.Point(213, 140) + Me.btnOK.Name = "btnOK" + Me.btnOK.Size = New System.Drawing.Size(71, 23) + Me.btnOK.TabIndex = 17 + Me.btnOK.Text = "OK" + Me.btnOK.UseVisualStyleBackColor = True + ' + 'btnCancel + ' + Me.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel + Me.btnCancel.Location = New System.Drawing.Point(12, 140) + Me.btnCancel.Name = "btnCancel" + Me.btnCancel.Size = New System.Drawing.Size(71, 23) + Me.btnCancel.TabIndex = 18 + Me.btnCancel.Text = "Abbrechen" + Me.btnCancel.UseVisualStyleBackColor = True + ' + 'txbAbgangsdatum + ' + Me.txbAbgangsdatum._DateTimeOnly = False + Me.txbAbgangsdatum._numbersOnly = False + Me.txbAbgangsdatum._numbersOnlyKommastellen = "" + Me.txbAbgangsdatum._numbersOnlyTrennzeichen = False + Me.txbAbgangsdatum._Prozent = False + Me.txbAbgangsdatum._ShortDateNew = True + Me.txbAbgangsdatum._ShortDateOnly = True + Me.txbAbgangsdatum._TimeOnly = False + Me.txbAbgangsdatum._TimeOnly_Seconds = False + Me.txbAbgangsdatum._value = "" + 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.MaxLength = 10 + Me.txbAbgangsdatum.MaxLineLength = -1 + Me.txbAbgangsdatum.MaxLines_Warning = "" + Me.txbAbgangsdatum.MaxLines_Warning_Label = Nothing + Me.txbAbgangsdatum.Name = "txbAbgangsdatum" + Me.txbAbgangsdatum.Size = New System.Drawing.Size(100, 20) + Me.txbAbgangsdatum.TabIndex = 19 + ' + 'Label1 + ' + Me.Label1.AutoSize = True + Me.Label1.Location = New System.Drawing.Point(23, 63) + Me.Label1.Name = "Label1" + Me.Label1.Size = New System.Drawing.Size(81, 13) + Me.Label1.TabIndex = 20 + Me.Label1.Text = "Abgangsdatum:" + ' + 'datVoraussichtlichesEintreffen + ' + 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 + ' + 'Label2 + ' + Me.Label2.AutoSize = True + Me.Label2.Location = New System.Drawing.Point(160, 63) + Me.Label2.Name = "Label2" + Me.Label2.Size = New System.Drawing.Size(90, 13) + Me.Label2.TabIndex = 22 + Me.Label2.Text = "voraus. Eintreffen" + ' + '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.Controls.Add(Me.Label2) + Me.Controls.Add(Me.datVoraussichtlichesEintreffen) + Me.Controls.Add(Me.Label1) + Me.Controls.Add(Me.txbAbgangsdatum) + Me.Controls.Add(Me.btnCancel) + Me.Controls.Add(Me.btnOK) + Me.Controls.Add(Me.btnMinus) + Me.Controls.Add(Me.btnPlus) + Me.Controls.Add(Me.cbxVon) + Me.Controls.Add(Me.lblBZS) + Me.Controls.Add(Me.lblAZS) + Me.Controls.Add(Me.txtNach) + Me.Name = "frmRoutendauerBerechnen" + Me.Text = "frmRoutendauerBerechnen" + Me.ResumeLayout(False) + Me.PerformLayout() + + End Sub + + Friend WithEvents btnMinus As Button + Friend WithEvents btnPlus As Button + Friend WithEvents cbxVon As VERAG_PROG_ALLGEMEIN.MyComboBox + Friend WithEvents lblBZS As Label + Friend WithEvents lblAZS As Label + Friend WithEvents txtNach As VERAG_PROG_ALLGEMEIN.MyTextBox + Friend WithEvents btnOK As Button + 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 Label2 As Label +End Class diff --git a/Aviso/frmRoutendauerBerechnen.resx b/Aviso/frmRoutendauerBerechnen.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/Aviso/frmRoutendauerBerechnen.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Aviso/frmRoutendauerBerechnen.vb b/Aviso/frmRoutendauerBerechnen.vb new file mode 100644 index 0000000..9ec6639 --- /dev/null +++ b/Aviso/frmRoutendauerBerechnen.vb @@ -0,0 +1,119 @@ +Imports System.CodeDom +Imports DocumentFormat.OpenXml.Bibliography +Imports Org.BouncyCastle.Utilities + +Public Class frmRoutendauerBerechnen + + Public calculatedDate As New DateTime + Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL + Dim destination As String = "" + Dim departure As String + Dim transportmittel As String = "LKW" + Dim days As Integer = -1 + + + Sub New(dest As String) + + InitializeComponent() + destination = dest + + End Sub + + + Private Sub frmRoutendauerBerechnen_Load(sender As Object, e As EventArgs) Handles MyBase.Load + + txtNach.Text = destination.ToString + txbAbgangsdatum._value = CStr(Date.Today()) + initCheckBoxDepartment() + + + End Sub + + Sub initCheckBoxDepartment() + + cbxVon.Items.Clear() + cbxVon.fillWithSQL("SELECT [nctsr_dauer_in_tagen], [nctsr_von] FROM [tblNTCSRouten] WHERE [nctsr_nach] = '" & destination & "'", 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) + End Sub + + Private Sub btnMinus_Click(sender As Object, e As EventArgs) Handles btnMinus.Click + addDaysToGivenDate2(datVoraussichtlichesEintreffen, -1) + 'addDaysToGivenDate(-1) + End Sub + + Function calculateTripDuration() As Integer + + Dim destination As String + Dim departure As String + + departure = cbxVon.Text + 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)) + Catch ex As Exception + VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name) + End Try + + Return days + + End Function + + Private Sub cbxVon_SelectedValueChanged(sender As Object, e As EventArgs) Handles cbxVon.SelectedValueChanged + + departure = cbxVon.Text + Dim calculatedDuration = calculateTripDuration() + + If calculatedDuration > 0 Then + addDaysToGivenDate2(txbAbgangsdatum, calculatedDuration) + End If + + + 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() + 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 + If days > 0 Then + addDaysToGivenDate2(txbAbgangsdatum, days) + End If + End Sub +End Class \ No newline at end of file