USTVA; MDM-Einarbeitung
This commit is contained in:
@@ -1,15 +1,17 @@
|
||||
|
||||
Imports System.Data.SqlClient
|
||||
Imports System.Reflection
|
||||
Imports com.sun.xml.internal.rngom.digested
|
||||
|
||||
Public Class cMDMEInarbeitung
|
||||
Public Class cMDMEinarbeitung
|
||||
Property id As Integer
|
||||
Property supplier As Object = Nothing
|
||||
Property invoicedate As Object = Nothing
|
||||
Property ds_count As Object = Nothing
|
||||
Property ds_total As Object = Nothing
|
||||
Property completed As Object = Nothing
|
||||
Property completed As Boolean = False
|
||||
Property completed_date As Object = Nothing
|
||||
Property import_date As Object = Nothing
|
||||
|
||||
Public hasEntry = False
|
||||
|
||||
@@ -27,6 +29,13 @@ Public Class cMDMEInarbeitung
|
||||
LOAD(supplier, invoicedate)
|
||||
End Sub
|
||||
|
||||
Sub New(supplier, invoicedate, importdate)
|
||||
Me.supplier = supplier
|
||||
Me.invoicedate = invoicedate
|
||||
Me.import_date = import_date
|
||||
LOAD(supplier, invoicedate, import_date)
|
||||
End Sub
|
||||
|
||||
Function getParameterList() As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable)
|
||||
Dim list As New List(Of VERAG_PROG_ALLGEMEIN.SQLVariable)
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("id", id,, True))
|
||||
@@ -36,6 +45,7 @@ Public Class cMDMEInarbeitung
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ds_total", ds_total))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("completed", completed))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("completed_date", completed_date))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("import_date", import_date))
|
||||
|
||||
Return list
|
||||
End Function
|
||||
@@ -111,6 +121,36 @@ Public Class cMDMEInarbeitung
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Public Sub LOAD(supplier, invoicedate, import_date)
|
||||
Try
|
||||
hasEntry = False
|
||||
Using conn As SqlConnection = SQL.GetNewOpenConnectionFMZOLL()
|
||||
Using cmd As New SqlCommand("SELECT * FROM tblMDMEinarbeitung WHERE supplier=@supplier and invoicedate=@invoicedate and import_date=@import_date ", conn)
|
||||
cmd.Parameters.AddWithValue("@supplier", supplier)
|
||||
cmd.Parameters.AddWithValue("@invoicedate", invoicedate)
|
||||
cmd.Parameters.AddWithValue("@import_date", import_date)
|
||||
Dim dr = cmd.ExecuteReader()
|
||||
If dr.Read Then
|
||||
For Each li In getParameterList()
|
||||
Dim propInfo As PropertyInfo = Me.GetType.GetProperty(li.Scalarvariable)
|
||||
|
||||
If dr.Item(li.Text) Is DBNull.Value Then
|
||||
propInfo.SetValue(Me, Nothing)
|
||||
Else
|
||||
propInfo.SetValue(Me, dr.Item(li.Text))
|
||||
End If
|
||||
|
||||
Next
|
||||
hasEntry = True
|
||||
End If
|
||||
dr.Close()
|
||||
End Using
|
||||
End Using
|
||||
Catch ex As Exception
|
||||
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
Public Function getUpdateCmd() As String
|
||||
@@ -153,4 +193,33 @@ Public Class cMDMEInarbeitung
|
||||
Return ""
|
||||
End Function
|
||||
|
||||
Shared Function setInvoicingDate(ByRef import_date As Date, ByRef MDM_OBJ As cMDMEinarbeitung) As Boolean
|
||||
|
||||
Dim REDat
|
||||
|
||||
If import_date.Day < 15 Then
|
||||
'vor 15, letzer Monat Monatsletzter!
|
||||
If import_date.Month <> 1 Then
|
||||
'Monatsletzter aus Vorjahr
|
||||
REDat = New Date(Today.Year, Today.Month - 1, DateTime.DaysInMonth(import_date.Year, import_date.Month - 1))
|
||||
Else
|
||||
REDat = New Date(Today.Year - 1, 12, DateTime.DaysInMonth(import_date.Year - 1, 12))
|
||||
End If
|
||||
|
||||
ElseIf Today().Day >= 15 Then
|
||||
REDat = New Date(import_date.Year, import_date.Month, 15)
|
||||
End If
|
||||
|
||||
If REDat IsNot Nothing AndAlso IsDate(REDat) Then
|
||||
MDM_OBJ.invoicedate = REDat
|
||||
Return True
|
||||
Else
|
||||
Return False
|
||||
End If
|
||||
|
||||
|
||||
End Function
|
||||
|
||||
|
||||
|
||||
End Class
|
||||
|
||||
Reference in New Issue
Block a user