feature_gesamtsicherheiten
This commit is contained in:
@@ -1,29 +1,38 @@
|
||||
Imports System.Reflection
|
||||
Imports SDL
|
||||
|
||||
Public Class frmGesamtsicherheitenMenuNEU
|
||||
|
||||
Public SQL As New VERAG_PROG_ALLGEMEIN.SQL
|
||||
Dim GesSichRef As VERAG_PROG_ALLGEMEIN.cGesamtsicherheitsReferenz
|
||||
Dim dt As DataTable
|
||||
Public dt As DataTable
|
||||
Public Property Standort As String = ""
|
||||
|
||||
|
||||
Private Sub frmGesamtsicherheitenNEU_Menu_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
||||
cbxStandort.fillWithSQL("SELECT FilialenNr, cast(FilialenNr as varchar(4)) + ' ' + Grenzstelle FROM Filialen WHERE Fil_Status='A' ORDER BY FilialenNr ", True, "FMZOLL", True)
|
||||
cbxWarenort.fillWithSQL("SELECT [grz_Grenzstelle], [grz_Bezeichnung] FROM [tblGrenzstelle] WHERE [grz_Aktiv] ='1' AND [grz_Warenort] ='1' ORDER BY [grz_Reihenfolge] ", True, "AVISO", True)
|
||||
Me.Text = "Gesamtsicherheiten " & Standort
|
||||
frmHauptfenster.EnableDoubleBuffered(dgvListe)
|
||||
GesSichRef = New VERAG_PROG_ALLGEMEIN.cGesamtsicherheitsReferenz(Standort)
|
||||
'GesSichRef.LOAD("standort", Standort)
|
||||
lblSaldo.Text = "Saldo: €" & Decimal.Parse(GesSichRef.CalcSaldo()).ToString("N")
|
||||
|
||||
'txtDatVon._ShortDateOnly = True
|
||||
'txtDatBis._ShortDateOnly = True
|
||||
|
||||
txtDatVon.Text = Now.ToShortDateString 'CDate("01." & Now.ToString("MM.yyyy")).AddMonths(-1).ToShortDateString
|
||||
txtDatVon.Text = Now.ToShortDateString
|
||||
txtDatBis.Text = Now.ToShortDateString
|
||||
|
||||
btnMonat.Text = MONAT.ToString("MMMM")
|
||||
btnJahr.Text = JAHR.Year
|
||||
|
||||
If GesSichRef.gsr_ATR = True Then
|
||||
Dim anzahlOffenerGSUeber85Tage As Integer = checkOpenATBs()
|
||||
If anzahlOffenerGSUeber85Tage > 0 Then
|
||||
btnOpenOver85Days.Visible = True
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
|
||||
|
||||
'txtDatVon.Text = Date.Today.AddDays(-30).ToString("dd.MM.yyyy")
|
||||
'txtDatBis.Text = Date.Today.ToString("dd.MM.yyyy")
|
||||
@@ -33,17 +42,24 @@ Public Class frmGesamtsicherheitenMenuNEU
|
||||
|
||||
Public Function LoadDGV()
|
||||
Dim sqladdon As String = ""
|
||||
If chkOffen.Checked Then sqladdon &= " AND gs_Sicherheitssaldo != '0,00 €'"
|
||||
If chkOffen.Checked Then sqladdon &= " AND gs_SicherheitsSaldo != '0,00 €'"
|
||||
If cbxStandort._value <> "" Then sqladdon &= " AND gs_filialenNr = '" & cbxStandort._value.ToString & "'"
|
||||
If cbxWarenort._value <> "" Then sqladdon &= " AND gs_warenort = '" & cbxWarenort._value.ToString & "'"
|
||||
|
||||
Dim sqlstring As String =
|
||||
" select * from (Select gs_gsnr as gs_gsnr, MIN(gs_standort) as gs_standort, MIN(gs_warenort) as gs_warenort, MIN(gs_filialenNr) as gs_filialenNr, min(gs_abfertigungsNr) as gs_abfertigungsNr,
|
||||
max(gs_LKWKZ) as gs_LKWKZ, min (gs_datum) as gs_datum, FORMAT(SUM(
|
||||
Case
|
||||
when gs_art = 'Open' then (gs_sicherheitsbetrag * -1)
|
||||
when gs_art = 'Close' then gs_sicherheitsbetrag
|
||||
End) , 'C', 'de-DE')As gs_SicherheitsSaldo
|
||||
max(gs_LKWKZ) as gs_LKWKZ, min (gs_datum) as gs_datum, FORMAT(
|
||||
(Select SUM( Case
|
||||
when gs_art = 'Open' then (gs_sicherheitsbetrag * -1)
|
||||
when gs_art = 'Close' then gs_sicherheitsbetrag
|
||||
End) As gs_SicherheitsSaldo FROM [tblGesamtsicherheit] where gs_gsnr = meh.gs_gsnr
|
||||
)
|
||||
+
|
||||
(Select SUM( Case
|
||||
when gsp_art = 'Open' then (gsp_sicherheitsbetrag * -1)
|
||||
when gsp_art = 'Close' then gsp_sicherheitsbetrag
|
||||
End) As gs_SicherheitsSaldo FROM [tblGesamtsicherheitsPositionen] where gsp_gsnr = meh.gs_gsnr
|
||||
) , 'C', 'de-DE') as gs_SicherheitsSaldo
|
||||
|
||||
From (select * from (select gs_gsnr as ding from [tblGesamtsicherheit] where
|
||||
gs_freitext like '%" & txtSuchbegriff.Text & "%' OR
|
||||
@@ -70,13 +86,37 @@ Public Class frmGesamtsicherheitenMenuNEU
|
||||
.Columns("gs_abfertigungsNr").HeaderText = "Abfert.Nr."
|
||||
.Columns("gs_abfertigungsNr").Width = 107
|
||||
.Columns("gs_datum").Width = 112
|
||||
.Columns("gs_SicherheitsSaldo").Width = 106
|
||||
.Columns("gs_datum").HeaderText = "Datum"
|
||||
.Columns("gs_SicherheitsSaldo").AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill
|
||||
.Columns("gs_SicherheitsSaldo").HeaderText = "Sicherheitssaldo"
|
||||
.Columns("gs_Warenort").Width = 96
|
||||
.Columns("gs_Warenort").HeaderText = "Warenort"
|
||||
.Columns("gs_LKWKZ").HeaderText = "LKW-KZ"
|
||||
|
||||
End With
|
||||
|
||||
|
||||
|
||||
If dgvListe.Rows.Count = 0 Then Exit Function
|
||||
|
||||
dt = New DataTable()
|
||||
dt.Columns.Add("gs_gsnr", GetType(Integer))
|
||||
dt.Columns.Add("gs_isOpen", GetType(Boolean))
|
||||
|
||||
|
||||
|
||||
For Each row As DataGridViewRow In dgvListe.Rows
|
||||
If row.Cells("gs_SicherheitsSaldo").Value <> 0 Then
|
||||
|
||||
dt.Rows.Add(row.Cells("gs_gsnr").Value, True)
|
||||
Else
|
||||
dt.Rows.Add(row.Cells("gs_gsnr").Value, False)
|
||||
End If
|
||||
Next
|
||||
|
||||
|
||||
For Each row As DataGridViewRow In dgvListe.Rows
|
||||
|
||||
If row.Cells("gs_SicherheitsSaldo").Value <> 0 Then
|
||||
row.DefaultCellStyle.BackColor = Color.Red
|
||||
Else
|
||||
@@ -107,6 +147,7 @@ Public Class frmGesamtsicherheitenMenuNEU
|
||||
.FilialNummer = dgvListe.CurrentRow.Cells("gs_filialenNr").Value
|
||||
.Abfertigungsnummer = dgvListe.CurrentRow.Cells("gs_abfertigungsNr").Value
|
||||
.warenortID = dgvListe.CurrentRow.Cells("gs_warenort").Value
|
||||
.dt = Me.dt
|
||||
End With
|
||||
|
||||
AddHandler frm.FormClosing, Function()
|
||||
@@ -125,6 +166,7 @@ Public Class frmGesamtsicherheitenMenuNEU
|
||||
.Standort = Me.Standort
|
||||
.datum = Date.Now
|
||||
.Neu = True
|
||||
.dt = Me.dt
|
||||
End With
|
||||
AddHandler frm.FormClosing, Function()
|
||||
GesSichRef.CalcSaldo()
|
||||
@@ -154,7 +196,7 @@ Public Class frmGesamtsicherheitenMenuNEU
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Private Sub resetSearchfields_Click(sender As Object, e As EventArgs) Handles FlatButton1.Click
|
||||
Private Sub resetSearchfields_Click(sender As Object, e As EventArgs) Handles btnResetFilter.Click
|
||||
txtSuchbegriff.Text = "" : chkOffen.Checked = True
|
||||
txtDatVon.Text = Date.Today.AddDays(-30).ToString("dd.MM.yyyy")
|
||||
txtDatBis.Text = Date.Today.ToString("dd.MM.yyyy")
|
||||
@@ -332,5 +374,51 @@ Public Class frmGesamtsicherheitenMenuNEU
|
||||
End If
|
||||
End Function
|
||||
|
||||
Private Sub btnOpenOver85Days_Click(sender As Object, e As EventArgs) Handles btnOpenOver85Days.Click
|
||||
resetSearchfields_Click(sender, e)
|
||||
chkOffen.Checked = True
|
||||
DateTimePicker1.Value = Now.AddYears(-20)
|
||||
DateTimePicker2.Value = Now.AddDays(-85)
|
||||
|
||||
btnSucheStarten_Click(sender, e)
|
||||
|
||||
End Sub
|
||||
|
||||
Private Function checkOpenATBs() As Integer
|
||||
|
||||
Dim anzahlOffenerGSUeber85Tage As Integer
|
||||
|
||||
Dim dtNew As New DataTable
|
||||
|
||||
Dim sqlstring As String = "select count(*) as anzahlOffeneATBs from (Select gs_gsnr as gs_gsnr, MIN(gs_standort) as gs_standort,min (gs_datum) as gs_datum,
|
||||
(Select SUM( Case
|
||||
when gs_art = 'Open' then (gs_sicherheitsbetrag * -1)
|
||||
when gs_art = 'Close' then gs_sicherheitsbetrag
|
||||
End) As gs_SicherheitsSaldo FROM [tblGesamtsicherheit] where gs_gsnr = meh.gs_gsnr
|
||||
)
|
||||
+
|
||||
(Select SUM( Case
|
||||
when gsp_art = 'Open' then (gsp_sicherheitsbetrag * -1)
|
||||
when gsp_art = 'Close' then gsp_sicherheitsbetrag
|
||||
End) As gs_SicherheitsSaldo FROM [tblGesamtsicherheitsPositionen] where gsp_gsnr = meh.gs_gsnr
|
||||
) as Sicherheitssaldo
|
||||
|
||||
From [tblGesamtsicherheit] as meh group by gs_gsnr) as meh2
|
||||
Where gs_standort = '" & Standort & "' AND Sicherheitssaldo != '0' AND gs_datum < '" & Date.Now().AddDays(-85) & "'"
|
||||
|
||||
dtNew = SQL.loadDgvBySql(sqlstring, "AVISO", 100, True)
|
||||
|
||||
If (dtNew.Rows(0).Item(0) IsNot DBNull.Value) Then
|
||||
|
||||
anzahlOffenerGSUeber85Tage = dtNew.Rows(0).Item(0)
|
||||
If anzahlOffenerGSUeber85Tage > 0 Then
|
||||
MsgBox("Es sind " & anzahlOffenerGSUeber85Tage & " ATBs offen, die älter als 85 Tage sind!")
|
||||
End If
|
||||
Return anzahlOffenerGSUeber85Tage
|
||||
End If
|
||||
|
||||
|
||||
|
||||
End Function
|
||||
|
||||
End Class
|
||||
|
||||
Reference in New Issue
Block a user