Frachtkostenberechnung Lukowa

This commit is contained in:
2023-08-22 17:11:42 +02:00
parent 8b2bd640bd
commit 363ea3aa5e
5 changed files with 693 additions and 545 deletions

View File

@@ -64,7 +64,9 @@ Public Class frmATEZ_NCTS
If id > 0 Then
Dim atez_data = New cATEZ_NCTS_DATA(id)
If atez_data.json <> "" Then MsgBox(atez_data.json) 'InputBox(atez_data.json, "JSON-Text", , 100, 100)
If atez_data.json <> "" Then
MsgBox(atez_data.json) 'InputBox(atez_data.json, "JSON-Text", , 100, 100)
End If
Else

View File

@@ -6,6 +6,15 @@ Imports VERAG_PROG_ALLGEMEIN
Public Class frmFrachtkostenBerechnen
Sub New()
' Dieser Aufruf ist für den Designer erforderlich.
InitializeComponent()
' Fügen Sie Initialisierungen nach dem InitializeComponent()-Aufruf hinzu.
Dim ustcntl As New usrcntlFrachtkostenberechnung()
End Sub
'Dim absenderID As Integer = -1
'Dim empfaengerID As Integer = -1
'Dim origin As String
@@ -17,55 +26,17 @@ Public Class frmFrachtkostenBerechnen
'Dim sql As New VERAG_PROG_ALLGEMEIN.SQL
Sub New(absID As String, empfID As String, gewichtInput As String, gesamtfrachtkostenInput As String, ware As String)
'Sub New(absID As String, empfID As String, gewichtInput As String, gesamtfrachtkostenInput As String, ware As String)
InitializeComponent()
Try
Dim ustcntl As New usrcntlFrachtkostenberechnung(absID, empfID, gewichtInput, gesamtfrachtkostenInput, ware)
' InitializeComponent()
' Try
' Dim ustcntl As New usrcntlFrachtkostenberechnung()
'If ustcntl = DialogResult.OK Then
' txtFrachtkostenEU._value = frachkosten.EUAnteil
' txtFrachtkostenNichtEU._value = frachkosten.nichtEUAnteil
' txtFrachtkostenGesamt._value = frachkosten.tbxGesamtfrachtkosten._value
'End If
' Catch ex As Exception
' VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
' End Try
'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)
'Else
' absenderID = -1
'End If
'If empfID IsNot Nothing AndAlso empfID.ToString <> "" AndAlso IsNumeric(empfID) Then
' empfaengerID = Int(empfID)
'Else
' empfaengerID = -1
'End If
Catch ex As Exception
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
End Try
End Sub
'End Sub
'Private Sub frmFrachtkotenBerechnen_Load(sender As Object, e As EventArgs) Handles MyBase.Load

View File

@@ -5712,14 +5712,19 @@ Public Class frmSendungsdetailsNEU
Sub calculateFreightCosts()
Dim frachkosten = New frmFrachtkostenBerechnen(txtAbsenderKdNr._value, txtEmpfaengerKdNr._value, txtGewicht.Text, txtFrachtkostenGesamt.Text, rtbWarenbezeichnung.Text)
Dim f = New frmFrachtkostenBerechnen()
f.UsrcntlFrachtkostenberechnung1.init(txtAbsenderKdNr._value, txtEmpfaengerKdNr._value, txtGewicht.Text, txtFrachtkostenGesamt.Text, rtbWarenbezeichnung.Text, txtWarenwert._value)
If f.ShowDialog = DialogResult.OK Then
If frachkosten.ShowDialog = DialogResult.OK Then
'txtFrachtkostenEU._value = frachkosten.usrcntlFrachtkostenberechnung.EUAnteil
'txtFrachtkostenNichtEU._value = frachkosten.nichtEUAnteil
'txtFrachtkostenGesamt._value = frachkosten.tbxGesamtfrachtkosten._value
End If
End Sub
Private Sub btn_FrachtkostenBerechnen_Click(sender As Object, e As EventArgs) Handles btn_FrachtkostenBerechnen.Click

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,6 @@
Public Class usrcntlFrachtkostenberechnung
Imports DocumentFormat.OpenXml.Drawing.Diagrams
Public Class usrcntlFrachtkostenberechnung
Dim absenderID As Integer = -1
@@ -11,61 +13,42 @@
Dim gewicht As Double
Dim gesamtFrachtkosten As Double
Dim sql As New VERAG_PROG_ALLGEMEIN.SQL
Dim warenbez As String
Sub New()
InitializeComponent()
ware = "Test"
End Sub
Sub New(absID As String, empfID As String, gewichtInput As String, gesamtfrachtkostenInput As String, ware As String)
InitializeComponent()
Try
Public Sub init(absID As String, empfID As String, gewichtInput As String, gesamtfrachtkostenInput As String, ware As String, warenwert As String)
If gesamtfrachtkostenInput IsNot Nothing AndAlso gesamtfrachtkostenInput.ToString <> "" AndAlso IsNumeric(gesamtfrachtkostenInput) Then
gesamtFrachtkosten = CDbl(gesamtfrachtkostenInput)
tbxGesamtfrachtkosten._value = gesamtFrachtkosten
Else
gesamtFrachtkosten = 0
End If
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 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)
Else
absenderID = -1
End If
If absID IsNot Nothing AndAlso absID.ToString <> "" AndAlso IsNumeric(absID) Then
absenderID = CInt(absID)
Else
absenderID = -1
End If
If empfID IsNot Nothing AndAlso empfID.ToString <> "" AndAlso IsNumeric(empfID) Then
empfaengerID = Int(empfID)
Else
empfaengerID = -1
End If
txtZoll2._value = ware.ToString
Label5.Text = gewicht.ToString
Catch ex As Exception
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
End Try
End Sub
Private Sub usrcntlFrachtkostenberechnung(sender As Object, e As EventArgs) Handles MyBase.Load
If empfID IsNot Nothing AndAlso empfID.ToString <> "" AndAlso IsNumeric(empfID) Then
empfaengerID = Int(empfID)
Else
empfaengerID = -1
End If
'cbxLandVon.fillWithSQL("SELECT Distinct(ISNULL([LandKz],'')) as LandKZ FROM [Adressen] order by LandKz asc", False, "FMZOLL", True, True)
cbxLandVon.fillWithSQL(" select distinct landkz, Währungstabelle.Land from Währungstabelle where landkz is not null order by LandKz", True, "FMZOLL", True)
@@ -85,6 +68,10 @@
tbNichtEUAnteil._value = 0
txbGewicht._value = gewicht.ToString
txbFactor._value = 0.15
txtWare._value = ware
txtGesamtgewicht._value = gewichtInput
checkInputFields()
@@ -140,6 +127,12 @@
VERAG_PROG_ALLGEMEIN.cGoogleAPI.GoogleDistance(origin, "Dover", duration, distance,, getValues)
VERAG_PROG_ALLGEMEIN.cGoogleAPI.GoogleDistance("Dover", destination, durationEU, distanceEU,, getValues)
ElseIf cbxLandVon._value = "SRB" AndAlso cbxLandNach._value = "D" AndAlso (absenderID = "551038" Or absenderID = "722998") AndAlso ckbManAnteilsermittlung.Checked Then
twoRouteRequest = True
'Sonderfall für Lukow-Berechnung
VERAG_PROG_ALLGEMEIN.cGoogleAPI.GoogleDistance(origin, "Bajakovo", duration, distance,, getValues)
VERAG_PROG_ALLGEMEIN.cGoogleAPI.GoogleDistance("Bajakovo", destination, durationEU, distanceEU,, getValues)
End If
If twoRouteRequest = True AndAlso ckbManAnteilsermittlung.Checked Then
@@ -315,11 +308,74 @@
txbCalcDistanceEU2.Text = txbCalcDistanceEU.Text
txbCalcDistanceNichtEU2.Text = txbCalcDistanceNichtEU.Text
tbEUAnteilberechnet2.Text = txbCalcDistanceNichtEU.Text
tbNichtEUAnteilberechnet22.Text = tbNichtEUAnteilberechnet.Text
'tbEUAnteilberechnet2.Text = txbCalcDistanceNichtEU.Text
'tbNichtEUAnteilberechnet22.Text = tbNichtEUAnteilberechnet.Text
tbEUAnteil2.Text = tbEUAnteil.Text
tbNichtEUAnteil2.Text = tbNichtEUAnteil.Text
'tbEUAnteil2.Text = tbEUAnteil.Text
'tbNichtEUAnteil2.Text = tbNichtEUAnteil.Text
End Sub
Private Sub MyTextBox1_ValueChanged() Handles MyTextBox1.ValueChanged
If IsNumeric(MyTextBox1._value) AndAlso IsNumeric(txtVerzollungskosten._value) Then
If CDbl(MyTextBox1._value) < 100 And CDbl(MyTextBox1._value) > 0 And CDbl(txtVerzollungskosten._value) > 0 Then
txtWeitereTarifPos._value = CDbl((MyTextBox1._value * 100) * txtVerzollungskosten._value / (100 + CDbl(MyTextBox1._value * 100)))
End If
End If
End Sub
Private Sub MyTextBox2_ValueChanged() Handles MyTextBox2.ValueChanged, MyTextBox3.ValueChanged
If IsNumeric(MyTextBox2._value) And IsNumeric(MyTextBox3._value) Then
txtPreis._value = MyTextBox2._value * MyTextBox3._value
End If
End Sub
Private Sub txtFrachtanteil_ValueChanged() Handles txtFrachtanteil.ValueChanged, txtPreis.ValueChanged
If IsNumeric(txtFrachtanteil._value) And IsNumeric(txtPreis._value) Then
txtVerzollungskosten._value = CDbl(txtPreis._value - txtFrachtanteil._value)
End If
End Sub
Private Sub txtWarengewicht_ValueChanged() Handles txtWarengewicht.ValueChanged, MyTextBox6.ValueChanged
If IsNumeric(txtWarengewicht._value) And IsNumeric(txtGesamtgewicht._value) Then
Dim anteil As Double = Math.Round(CDbl(txtWarengewicht._value / txtGesamtgewicht._value * 100), 2)
lblAnteil.Text = anteil & " %"
If IsNumeric(MyTextBox6._value) Then
txtWarenanteil._value = CDbl(MyTextBox6._value * anteil / 100)
End If
Else
lblAnteil.Text = ""
End If
End Sub
Private Sub txbCalcDistanceNichtEU2_TextChanged(sender As Object, e As EventArgs) Handles txbCalcDistanceNichtEU2.TextChanged, txbCalcDistanceEU2.TextAlignChanged
If IsNumeric(txbCalcDistanceNichtEU2._value) AndAlso IsNumeric(txbCalcDistanceEU2._value) Then
txtDistanzGes._value = CDbl(txbCalcDistanceNichtEU2._value) + CDbl(txbCalcDistanceEU2._value)
End If
End Sub
Private Sub txtDistanzGes_ValueChanged() Handles txtDistanzGes.ValueChanged, txtWarenanteil.ValueChanged
If IsNumeric(txtDistanzGes._value) And IsNumeric(txtWarenanteil._value) And IsNumeric(txbCalcDistanceEU2._value) Then
txtGesamtsumme._value = CDbl(txtWarenanteil._value / txtDistanzGes._value * txbCalcDistanceEU2._value)
txtFrachtanteil._value = txtGesamtsumme._value
End If
End Sub
Private Sub txtVerzollungskosten_ValueChanged() Handles txtVerzollungskosten.ValueChanged, txtWeitereTarifPos.ValueChanged
If IsNumeric(txtVerzollungskosten._value) AndAlso IsNumeric(txtWeitereTarifPos._value) Then
txtBGLZoll._value = CDbl(txtVerzollungskosten._value) + CDbl(txtWeitereTarifPos._value)
End If
End Sub
Private Sub txtPreis_ValueChanged() Handles txtPreis.ValueChanged
If IsNumeric(txtPreis._value) Then
txtEUST._value = txtPreis._value
End If
End Sub
End Class