Projektdateien hinzufügen.
This commit is contained in:
257
UID/frmFrachtkosten.vb
Normal file
257
UID/frmFrachtkosten.vb
Normal file
@@ -0,0 +1,257 @@
|
||||
Imports System.Globalization
|
||||
|
||||
Public Class frmFrachtkosten
|
||||
Dim cFrachtkostenSQL As New cFrachtkostenSQL
|
||||
Dim culture As New CultureInfo("de-DE")
|
||||
Public frachtfirma_id As Integer = -1
|
||||
Private Sub Label10_Click(sender As Object, e As EventArgs) Handles Label10.Click, Label11.Click, Label16.Click, Label17.Click, Label21.Click, Label23.Click, Label31.Click
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub cbo_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cboFirmen.SelectedIndexChanged
|
||||
If cboFirmen.Items.Count > 0 Then
|
||||
Dim oItem As MyListItem = CType(cboFirmen.SelectedItem, MyListItem)
|
||||
Dim frachtosten As cFrachtkosten = cFrachtkostenSQL.getFrachtkosten(oItem.Value)
|
||||
txtFirmaPreisProM3.Text = frachtosten.frtkst_preisM3.ToString("N", culture)
|
||||
txtFirmaPreisProLDM.Text = frachtosten.frtkst_preisLDM.ToString("N", culture)
|
||||
txtFirmaProvision.Text = frachtosten.frtkst_provision.ToString("N", culture)
|
||||
End If
|
||||
initRechner()
|
||||
End Sub
|
||||
|
||||
Private Sub frmFrachtkosten_FormClosed(sender As Object, e As FormClosedEventArgs) Handles Me.FormClosed
|
||||
' frmMain.BringToFront()
|
||||
End Sub
|
||||
|
||||
Private Sub frmFrachtkosten_Load(sender As Object, e As EventArgs) Handles Me.Load
|
||||
Dim firmen As List(Of cFrachtkostenFirmen) = cFrachtkostenSQL.getFirmen
|
||||
If Not firmen Is Nothing AndAlso firmen.Count > 0 Then
|
||||
For Each f In firmen
|
||||
cboFirmen.Items.Add(New MyListItem(f.kd_firma, f.kd_id))
|
||||
Next
|
||||
cboFirmen.SelectedIndex = 0
|
||||
End If
|
||||
If frachtfirma_id >= 0 Then
|
||||
For Each i In cboFirmen.Items
|
||||
Dim oItem As MyListItem = CType(i, MyListItem)
|
||||
If oItem.Value = frachtfirma_id Then
|
||||
cboFirmen.SelectedItem = i
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
|
||||
With dgvFrachtkosten
|
||||
.Columns(6).ReadOnly = True
|
||||
.Columns(7).ReadOnly = True
|
||||
.Columns(9).ReadOnly = True
|
||||
|
||||
.Columns(0).DefaultCellStyle.Alignment = DataGridViewContentAlignment.TopRight
|
||||
.Columns(1).DefaultCellStyle.Alignment = DataGridViewContentAlignment.TopRight
|
||||
.Columns(2).DefaultCellStyle.Alignment = DataGridViewContentAlignment.TopRight
|
||||
.Columns(3).DefaultCellStyle.Alignment = DataGridViewContentAlignment.TopRight
|
||||
.Columns(4).DefaultCellStyle.Alignment = DataGridViewContentAlignment.TopRight
|
||||
.Columns(5).DefaultCellStyle.Alignment = DataGridViewContentAlignment.TopRight
|
||||
.Columns(6).DefaultCellStyle.Alignment = DataGridViewContentAlignment.TopRight
|
||||
.Columns(7).DefaultCellStyle.Alignment = DataGridViewContentAlignment.TopRight
|
||||
.Columns(8).DefaultCellStyle.Alignment = DataGridViewContentAlignment.TopRight
|
||||
|
||||
|
||||
.Columns(5).DefaultCellStyle.FormatProvider = CultureInfo.GetCultureInfo("de-DE")
|
||||
.Columns(5).DefaultCellStyle.Format = "n"
|
||||
.Columns(6).DefaultCellStyle.FormatProvider = CultureInfo.GetCultureInfo("de-DE")
|
||||
.Columns(6).DefaultCellStyle.Format = "n"
|
||||
.Columns(7).DefaultCellStyle.FormatProvider = CultureInfo.GetCultureInfo("de-DE")
|
||||
.Columns(7).DefaultCellStyle.Format = "n"
|
||||
.Columns(8).DefaultCellStyle.FormatProvider = CultureInfo.GetCultureInfo("de-DE")
|
||||
.Columns(8).DefaultCellStyle.Format = "n"
|
||||
.Columns(9).DefaultCellStyle.FormatProvider = CultureInfo.GetCultureInfo("de-DE")
|
||||
.Columns(9).DefaultCellStyle.Format = "n"
|
||||
|
||||
.Columns(5).DefaultCellStyle.Font = New Font("Arial", 8.25, FontStyle.Bold)
|
||||
.Columns(6).DefaultCellStyle.Font = New Font("Arial", 8.25, FontStyle.Bold)
|
||||
.Columns(7).DefaultCellStyle.Font = New Font("Arial", 8.25, FontStyle.Bold)
|
||||
|
||||
.Columns(0).DefaultCellStyle.BackColor = Color.White
|
||||
.Columns(1).DefaultCellStyle.BackColor = Color.White
|
||||
.Columns(2).DefaultCellStyle.BackColor = Color.White
|
||||
.Columns(3).DefaultCellStyle.BackColor = Color.White
|
||||
.Columns(4).DefaultCellStyle.BackColor = Color.White
|
||||
.Columns(5).DefaultCellStyle.BackColor = Color.White
|
||||
.Columns(8).DefaultCellStyle.BackColor = Color.White
|
||||
|
||||
.Columns(6).DefaultCellStyle.BackColor = Color.LightGray
|
||||
.Columns(7).DefaultCellStyle.BackColor = Color.LightGray
|
||||
.Columns(9).DefaultCellStyle.BackColor = Color.LightGray
|
||||
End With
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
Sub initRechner()
|
||||
Dim sumStk As Integer = 0
|
||||
Dim sumTatGew As Double = 0
|
||||
Dim sumLdm As Double = 0
|
||||
Dim sumGewLDM As Double = 0
|
||||
Dim sumGewM3 As Double = 0
|
||||
Dim sumBetrag As Double = 0
|
||||
|
||||
|
||||
With dgvFrachtkosten
|
||||
For i As Integer = 0 To .RowCount - 2
|
||||
Dim r As DataGridViewRow = .Rows(i)
|
||||
Try
|
||||
Dim stueck As Integer = CInt(r.Cells(0).Value)
|
||||
Dim laenge As Double = CDbl(r.Cells(1).Value)
|
||||
Dim breite As Double = CDbl(r.Cells(2).Value)
|
||||
Dim hoehe As Double = CDbl(r.Cells(3).Value)
|
||||
|
||||
If IsNumeric(stueck) AndAlso IsNumeric(laenge) AndAlso IsNumeric(breite) AndAlso IsNumeric(hoehe) AndAlso IsNumeric(txtFirmaPreisProM3.Text) Then
|
||||
r.Cells(6).Value = CDbl((stueck * laenge * breite * hoehe) / 1000000 * txtFirmaPreisProM3.Text).ToString("N", culture)
|
||||
Else
|
||||
r.Cells(6).Value = "0.00"
|
||||
End If
|
||||
|
||||
If IsNumeric(r.Cells(4).Value) AndAlso IsNumeric(txtFirmaPreisProLDM.Text) Then
|
||||
r.Cells(7).Value = CDbl(r.Cells(4).Value * txtFirmaPreisProLDM.Text).ToString("N", culture)
|
||||
Else
|
||||
r.Cells(7).Value = "0.00"
|
||||
End If
|
||||
|
||||
If IsNumeric(r.Cells(8).Value) AndAlso IsNumeric(txtFirmaProvision.Text) Then
|
||||
r.Cells(9).Value = CDbl(r.Cells(8).Value * txtFirmaProvision.Text).ToString("N", culture)
|
||||
Else
|
||||
r.Cells(9).Value = "0.00"
|
||||
End If
|
||||
|
||||
|
||||
|
||||
If IsNumeric(stueck) Then sumStk += stueck
|
||||
If IsNumeric(r.Cells(5).Value) Then sumTatGew += r.Cells(5).Value ' : r.Cells(5).Value = String.Format(CDbl(r.Cells(5).Value), "N", culture)
|
||||
If IsNumeric(r.Cells(4).Value) Then sumLdm += r.Cells(4).Value
|
||||
If IsNumeric(r.Cells(7).Value) Then sumGewLDM += r.Cells(7).Value ': r.Cells(7).Value = String.Format(CDbl(r.Cells(7).Value), "N", culture)
|
||||
If IsNumeric(r.Cells(6).Value) Then sumGewM3 += r.Cells(6).Value ': r.Cells(6).Value = String.Format(CDbl(r.Cells(6).Value), "N", culture)
|
||||
If IsNumeric(r.Cells(9).Value) Then sumBetrag += r.Cells(9).Value
|
||||
|
||||
|
||||
r.Cells(5).Style.BackColor = Color.White
|
||||
r.Cells(6).Style.BackColor = Color.LightGray
|
||||
r.Cells(7).Style.BackColor = Color.LightGray
|
||||
If IsNumeric(r.Cells(5).Value) And IsNumeric(r.Cells(6).Value) And IsNumeric(r.Cells(7).Value) Then
|
||||
Dim TatGew As Double = CDbl(r.Cells(5).Value)
|
||||
Dim GewLDM As Double = CDbl(r.Cells(7).Value)
|
||||
Dim GewM3 As Double = CDbl(r.Cells(6).Value)
|
||||
|
||||
r.Cells(5).Style.BackColor = Color.Pink 'LightYellow
|
||||
r.Cells(6).Style.BackColor = Color.Pink 'LightYellow
|
||||
r.Cells(7).Style.BackColor = Color.Pink 'LightYellow
|
||||
|
||||
If TatGew >= GewM3 And TatGew >= GewLDM Then r.Cells(5).Style.BackColor = System.Drawing.Color.FromArgb(192, 255, 192)
|
||||
If GewM3 >= TatGew And GewM3 >= GewLDM Then r.Cells(6).Style.BackColor = System.Drawing.Color.FromArgb(192, 255, 192)
|
||||
If GewLDM >= TatGew And GewLDM >= GewM3 Then r.Cells(7).Style.BackColor = System.Drawing.Color.FromArgb(192, 255, 192)
|
||||
|
||||
' If TatGew <= GewM3 And TatGew <= GewLDM Then r.Cells(5).Style.BackColor = Color.Pink
|
||||
' If GewM3 <= TatGew And GewM3 <= GewLDM Then r.Cells(6).Style.BackColor = Color.Pink
|
||||
' If GewLDM <= TatGew And GewLDM <= GewM3 Then r.Cells(7).Style.BackColor = Color.Pink
|
||||
End If
|
||||
Catch
|
||||
End Try
|
||||
Next
|
||||
End With
|
||||
txtSumStk.Text = sumStk
|
||||
txtSumTatGew.Text = sumTatGew
|
||||
txtSumLdm.Text = sumLdm
|
||||
txtSumGewLDM.Text = sumGewLDM
|
||||
txtSumGewM3.Text = sumGewM3
|
||||
txtSumBetrag.Text = sumBetrag
|
||||
End Sub
|
||||
|
||||
Sub initRechnerold()
|
||||
|
||||
If IsNumeric(txtCalcStueck.Text) AndAlso IsNumeric(txtCalcHoehe.Text) AndAlso IsNumeric(txtCalcBreite.Text) AndAlso IsNumeric(txtCalcLaenge.Text) Then
|
||||
lblCalcM3.Text = CDbl(txtCalcStueck.Text * txtCalcHoehe.Text * txtCalcBreite.Text * txtCalcLaenge.Text / 1000000).ToString("N", culture) & " m³"
|
||||
Else
|
||||
lblCalcM3.Text = "0.00 m³"
|
||||
End If
|
||||
|
||||
If IsNumeric(txtCalcStueck.Text) AndAlso IsNumeric(txtCalcHoehe.Text) AndAlso IsNumeric(txtCalcBreite.Text) AndAlso IsNumeric(txtCalcLaenge.Text) AndAlso IsNumeric(txtFirmaPreisProM3.Text) Then
|
||||
txtCalcGewichtM3.Text = CDbl(txtCalcStueck.Text * txtCalcHoehe.Text * txtCalcBreite.Text * txtCalcLaenge.Text / 1000000 * txtFirmaPreisProM3.Text).ToString("N", culture)
|
||||
Else
|
||||
txtCalcGewichtM3.Text = "0.00"
|
||||
End If
|
||||
|
||||
If IsNumeric(txtCalcLademeter.Text) AndAlso IsNumeric(txtFirmaPreisProLDM.Text) Then
|
||||
txtCalcGewichtLDM.Text = CDbl(txtCalcLademeter.Text * txtFirmaPreisProLDM.Text).ToString("N", culture)
|
||||
Else
|
||||
txtCalcGewichtLDM.Text = "0.00"
|
||||
End If
|
||||
|
||||
If IsNumeric(txtCalcKurs.Text) AndAlso IsNumeric(txtFirmaProvision.Text) Then
|
||||
txtCalcBetrag.Text = CDbl(txtCalcKurs.Text * txtFirmaProvision.Text).ToString("N", culture)
|
||||
Else
|
||||
txtCalcBetrag.Text = "0.00"
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub txtCalcTatGewicht_LostFocus(sender As Object, e As EventArgs) Handles txtCalcTatGewicht.LostFocus
|
||||
Try : txtCalcTatGewicht.Text = CDbl(txtCalcTatGewicht.Text).ToString("N", culture) : Catch : End Try
|
||||
End Sub
|
||||
|
||||
Private Sub txtCalcStueck_TextChanged(sender As Object, e As EventArgs) Handles txtCalcStueck.TextChanged, txtCalcLaenge.TextChanged, txtCalcBreite.TextChanged, txtCalcHoehe.TextChanged, txtCalcLademeter.TextChanged, txtCalcKurs.TextChanged, txtCalcTatGewicht.TextChanged, txtFirmaProvision.TextChanged, txtFirmaPreisProLDM.TextChanged, txtFirmaPreisProM3.TextChanged
|
||||
initRechner()
|
||||
End Sub
|
||||
|
||||
Private Sub sum_textchanged(sender As Object, e As EventArgs) Handles txtSumLdm.TextChanged, txtSumStk.TextChanged, txtSumBetrag.TextChanged, txtSumGewLDM.TextChanged, txtSumGewM3.TextChanged, txtSumTatGew.TextChanged
|
||||
Try : sender.text = CDbl(sender.text).ToString("N", culture) : Catch : End Try
|
||||
End Sub
|
||||
|
||||
Private Sub btnNext_Click(sender As Object, e As EventArgs) Handles btnNext.Click
|
||||
If cboFirmen.Items.Count > cboFirmen.SelectedIndex + 1 Then
|
||||
cboFirmen.SelectedIndex += 1
|
||||
Else
|
||||
cboFirmen.SelectedIndex = 0
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub btnPrev_Click(sender As Object, e As EventArgs) Handles btnPrev.Click
|
||||
If cboFirmen.SelectedIndex > 0 Then
|
||||
cboFirmen.SelectedIndex -= 1
|
||||
Else
|
||||
cboFirmen.SelectedIndex = cboFirmen.Items.Count - 1
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub btnClose_Click(sender As Object, e As EventArgs) Handles btnClose.Click
|
||||
Me.Close()
|
||||
End Sub
|
||||
|
||||
Private Sub btnSave_Click(sender As Object, e As EventArgs) Handles btnSave.Click
|
||||
Dim cFrachtkosten As New cFrachtkosten
|
||||
Dim oItem As MyListItem = CType(cboFirmen.SelectedItem, MyListItem)
|
||||
If cboFirmen.Items.Count > 0 AndAlso cboFirmen.SelectedIndex >= 0 AndAlso IsNumeric(oItem.Value) Then
|
||||
cFrachtkosten.frtkst_firmaId = oItem.Value
|
||||
cFrachtkosten.frtkst_preisLDM = txtFirmaPreisProLDM.Text
|
||||
cFrachtkosten.frtkst_preisM3 = txtFirmaPreisProM3.Text
|
||||
cFrachtkosten.frtkst_provision = txtFirmaProvision.Text
|
||||
cFrachtkostenSQL.setFrachtkosten(cFrachtkosten)
|
||||
End If
|
||||
frmMain.Tabelle_anzeigen()
|
||||
End Sub
|
||||
|
||||
Private Sub dgvFrachtkosten_CellLeave(sender As Object, e As DataGridViewCellEventArgs) Handles dgvFrachtkosten.CellValidated
|
||||
Try
|
||||
Dim c As DataGridViewCell = dgvFrachtkosten.Rows(e.RowIndex).Cells(e.ColumnIndex)
|
||||
If IsNumeric(c.Value) Then
|
||||
If e.ColumnIndex >= 4 Then c.Value = CDbl(c.Value).ToString("N", culture)
|
||||
c.Style.ForeColor = Color.Black
|
||||
Else
|
||||
c.Style.ForeColor = Color.DarkRed
|
||||
End If
|
||||
Catch ex As Exception : MsgBox(ex.Message) : End Try
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub dgvFrachtkosten_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles dgvFrachtkosten.CellValueChanged
|
||||
initRechner()
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
Reference in New Issue
Block a user