Feature Frachtkostenberechnen um Gesamtfrachtkostenlogik erweitert.

This commit is contained in:
2022-10-14 09:09:38 +02:00
parent d29fc1c7af
commit 5961aa77b3
3 changed files with 47 additions and 13 deletions

View File

@@ -17,12 +17,26 @@ Public Class frmFrachtkostenBerechnen
Dim sql As New VERAG_PROG_ALLGEMEIN.SQL
Sub New(absID As String, empfID As String, gewichtInput As Double)
Sub New(absID As String, empfID As String, gewichtInput As String, gesamtfrachtkostenInput As String)
InitializeComponent()
Try
gewicht = IIf(gewichtInput.ToString <> "", CDbl(gewichtInput), 0)
If gesamtfrachtkostenInput IsNot Nothing AndAlso gesamtfrachtkostenInput.ToString <> "" AndAlso IsNumeric(gesamtfrachtkostenInput) Then
gesamtFrachtkosten = CDbl(gesamtfrachtkostenInput)
tbxGesamtfrachtkosten._value = gesamtFrachtkosten
Else
gesamtFrachtkosten = 0
End If
If gewichtInput IsNot Nothing AndAlso gewichtInput.ToString <> "" AndAlso IsNumeric(gewichtInput) Then
gewicht = CDbl(gewichtInput)
Else
gewicht = 0
End If
If absID IsNot Nothing AndAlso absID.ToString <> "" AndAlso IsNumeric(absID) Then
absenderID = CInt(absID)
@@ -176,7 +190,15 @@ Public Class frmFrachtkostenBerechnen
Sub calculateFreightCosts()
Try
gesamtFrachtkosten = gewicht * CDbl(txbFactor._value)
If gesamtFrachtkosten = 0 Then
gesamtFrachtkosten = gewicht * CDbl(txbFactor._value)
tbxGesamtfrachtkosten._value = gesamtFrachtkosten
End If
tbxGesamtfrachtkosten._value = gesamtFrachtkosten
EUAnteil = gesamtFrachtkosten * tbEUAnteil._value
nichtEUAnteil = gesamtFrachtkosten * CDbl(tbNichtEUAnteil._value)

View File

@@ -115,6 +115,8 @@ Partial Class frmSendungsdetailsNEU
Me.tbcntr = New System.Windows.Forms.TabControl()
Me.TabPage4 = New System.Windows.Forms.TabPage()
Me.Button18 = New System.Windows.Forms.Button()
Me.txtFrachtkostenGesamt = New VERAG_PROG_ALLGEMEIN.MyTextBox()
Me.Label10 = New System.Windows.Forms.Label()
Me.Label6 = New System.Windows.Forms.Label()
Me.Label1 = New System.Windows.Forms.Label()
Me.txtFrachtkostenNichtEU = New VERAG_PROG_ALLGEMEIN.MyTextBox()
@@ -390,8 +392,6 @@ Partial Class frmSendungsdetailsNEU
Me.ContextMenuStrip2 = New System.Windows.Forms.ContextMenuStrip(Me.components)
Me.ToolStripMenuItem14 = New System.Windows.Forms.ToolStripMenuItem()
Me.NurÖffnenToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
Me.txtFrachtkostenGesamt = New VERAG_PROG_ALLGEMEIN.MyTextBox()
Me.Label10 = New System.Windows.Forms.Label()
Me.pnl.SuspendLayout()
Me.Panel4.SuspendLayout()
Me.TabControl1.SuspendLayout()
@@ -1502,8 +1502,6 @@ Partial Class frmSendungsdetailsNEU
'
'TabPage4
'
Me.TabPage4.Controls.Add(Me.Button18)
Me.TabPage4.Controls.Add(Me.txtFrachtkostenGesamt)
Me.TabPage4.Controls.Add(Me.Label10)
Me.TabPage4.Controls.Add(Me.Button18)
Me.TabPage4.Controls.Add(Me.txtFrachtkostenGesamt)
@@ -1604,7 +1602,16 @@ Partial Class frmSendungsdetailsNEU
Me.Label1.AutoSize = True
Me.Label1.Location = New System.Drawing.Point(266, 43)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(40, 13)
Me.Label1.Size = New System.Drawing.Size(0, 13)
Me.Label1.TabIndex = 63
'
'txtFrachtkostenNichtEU
'
Me.txtFrachtkostenNichtEU._DateTimeOnly = False
Me.txtFrachtkostenNichtEU._numbersOnly = False
Me.txtFrachtkostenNichtEU._numbersOnlyKommastellen = ""
Me.txtFrachtkostenNichtEU._numbersOnlyTrennzeichen = True
Me.txtFrachtkostenNichtEU._Prozent = False
Me.txtFrachtkostenNichtEU._ShortDateNew = False
Me.txtFrachtkostenNichtEU._ShortDateOnly = False
Me.txtFrachtkostenNichtEU._TimeOnly = False
@@ -4836,6 +4843,7 @@ Partial Class frmSendungsdetailsNEU
'
Me.BindingNavigatorPositionItem.AccessibleName = "Position"
Me.BindingNavigatorPositionItem.AutoSize = False
Me.BindingNavigatorPositionItem.Font = New System.Drawing.Font("Segoe UI", 9.0!)
Me.BindingNavigatorPositionItem.Name = "BindingNavigatorPositionItem"
Me.BindingNavigatorPositionItem.Size = New System.Drawing.Size(50, 23)
Me.BindingNavigatorPositionItem.Text = "0"
@@ -5104,9 +5112,6 @@ Partial Class frmSendungsdetailsNEU
Me.NurÖffnenToolStripMenuItem.Size = New System.Drawing.Size(255, 30)
Me.NurÖffnenToolStripMenuItem.Text = "nur öffnen"
'
'
'frmSendungsdetailsNEU
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(96.0!, 96.0!)

View File

@@ -5371,7 +5371,7 @@ Public Class frmSendungsdetailsNEU
Sub calculateFreightCosts()
Dim frachkosten = New frmFrachtkostenBerechnen(txtAbsenderKdNr._value, txtEmpfaengerKdNr._value, txtGewicht.Text)
Dim frachkosten = New frmFrachtkostenBerechnen(txtAbsenderKdNr._value, txtEmpfaengerKdNr._value, txtGewicht.Text, txtFrachtkostenGesamt.Text)
If frachkosten.ShowDialog() = DialogResult.OK Then
@@ -5382,6 +5382,13 @@ Public Class frmSendungsdetailsNEU
End Sub
Private Sub Button18_Click_1(sender As Object, e As EventArgs) Handles Button18.Click
calculateFreightCosts()
If txtFrachtkostenGesamt.Text = "" AndAlso txtGewicht.Text = "" Then
MsgBox("Bitte Gewicht oder Gesamtfrachtkosten angeben!")
txtGewicht.Focus()
Else
calculateFreightCosts()
End If
End Sub
End Class