div. Änderungen
This commit is contained in:
@@ -346,6 +346,7 @@ Public Class cIDS
|
||||
Dim savedTrans As Integer = 0
|
||||
Dim MDMEinarb As New cMDMEinarbeitung("IDS", Now())
|
||||
|
||||
Dim isTransactionDetail As Boolean = False
|
||||
|
||||
Do While (objFileRead.Peek() > -1)
|
||||
Dim currentRow As String()
|
||||
@@ -354,140 +355,109 @@ Public Class cIDS
|
||||
lngRecordCount = lngRecordCount + 1
|
||||
|
||||
If lngRecordCount = 1 Then
|
||||
If Not (isleernothing((currentRow(0))) = "Year Month Day" AndAlso isleernothing((currentRow(14))) = "OBO Number") Then
|
||||
If Not (isleernothing((currentRow(0))) = "Year Month Day") Then
|
||||
Return False
|
||||
End If
|
||||
|
||||
If isleernothing((currentRow(14))) = "OBO Number" Then isTransactionDetail = False
|
||||
|
||||
If isleernothing((currentRow(14))) = "Transaction Volume" Then isTransactionDetail = True
|
||||
|
||||
|
||||
Else
|
||||
Try
|
||||
|
||||
|
||||
Dim ymd = isleernothing((currentRow(0)))
|
||||
Dim cc = isleernothing((currentRow(1)))
|
||||
Dim pyn = isleernothing((currentRow(2)))
|
||||
Dim occ = isleernothing((currentRow(5)))
|
||||
Dim oc = isleernothing((currentRow(6)))
|
||||
Dim ptc = isleernothing((currentRow(7)))
|
||||
If Not isTransactionDetail Then
|
||||
|
||||
Dim vr = isleernothing((currentRow(13)))
|
||||
Dim obo = isleernothing((currentRow(14)))
|
||||
Dim ymd = isleernothing((currentRow(0)))
|
||||
Dim cc = isleernothing((currentRow(1)))
|
||||
Dim pyn = isleernothing((currentRow(2)))
|
||||
Dim occ = isleernothing((currentRow(5)))
|
||||
Dim oc = isleernothing((currentRow(6)))
|
||||
Dim ptc = isleernothing((currentRow(7)))
|
||||
Dim vr = isleernothing((currentRow(13)))
|
||||
Dim obo = isleernothing((currentRow(14)))
|
||||
|
||||
'.VRNumber = isleernothing((currentRow(13)))
|
||||
'.OBONumber = isleernothing((currentRow(14)))
|
||||
Dim MDMEinarb_check As New cMDMEinarbeitung("IDS", ymd)
|
||||
If MDMEinarb_check.hasEntry AndAlso MDMEinarb_check.completed Then Return False
|
||||
|
||||
Dim zusParam = ""
|
||||
Dim isOBO As Boolean = False
|
||||
If vr IsNot Nothing AndAlso vr <> "" Then
|
||||
zusParam = vr
|
||||
ElseIf obo IsNot Nothing AndAlso obo <> "" Then
|
||||
zusParam = obo
|
||||
isOBO = True
|
||||
End If
|
||||
|
||||
Dim ids As New cIDS(ymd, pyn, cc, occ, oc, ptc, zusParam, isOBO)
|
||||
|
||||
Dim avprive = isleernothing((currentRow(12)))
|
||||
|
||||
|
||||
Dim zusParam = ""
|
||||
Dim isOBO As Boolean = False
|
||||
If vr IsNot Nothing AndAlso vr <> "" Then
|
||||
zusParam = vr
|
||||
ElseIf obo IsNot Nothing AndAlso obo <> "" Then
|
||||
zusParam = obo
|
||||
isOBO = True
|
||||
End If
|
||||
With ids
|
||||
.YearMonthDay = isleernothing((currentRow(0)))
|
||||
.CustomerCode = isleernothing((currentRow(1)))
|
||||
.Paymentsummarynumber = isleernothing((currentRow(2)))
|
||||
.CustomerName = isleernothing((currentRow(3)))
|
||||
.OutletCountry = isleernothing((currentRow(4)))
|
||||
.OutletCountryCode = isleernothing((currentRow(5)))
|
||||
.OutletCode = isleernothing((currentRow(6)))
|
||||
.ProductTypeCode = isleernothing((currentRow(7)))
|
||||
|
||||
Dim ids As New cIDS(ymd, pyn, cc, occ, oc, ptc, zusParam, isOBO)
|
||||
|
||||
Dim avprive = isleernothing((currentRow(12)))
|
||||
If lngRecordCount = 2 Then
|
||||
MDMEinarb.invoicedate = CDate(.YearMonthDay)
|
||||
End If
|
||||
|
||||
|
||||
.TransactionVolume = isleernothing((currentRow(8)))
|
||||
.AmminclVAT = isleernothing((currentRow(9)))
|
||||
.TotalNetAmount = isleernothing((currentRow(10)))
|
||||
.VATAmount = isleernothing((currentRow(11)))
|
||||
.avpriceexclVAT = IIf(avprive <> "" AndAlso IsNumeric(avprive), avprive, 0)
|
||||
|
||||
Console.WriteLine("IDS: " & isleernothing((currentRow(1))) & " - " & lngRecordCount & " - " & isleernothing((currentRow(10))))
|
||||
|
||||
If isOBO Then
|
||||
If .SAVE_OBO() Then counTrans += 1
|
||||
Else
|
||||
If .SAVE_VR() Then counTrans += 1
|
||||
End If
|
||||
|
||||
End With
|
||||
|
||||
Else
|
||||
|
||||
Dim ymd = isleernothing((currentRow(0)))
|
||||
Dim cc = isleernothing((currentRow(1)))
|
||||
Dim cn = isleernothing((currentRow(2)))
|
||||
Dim occ = isleernothing((currentRow(8)))
|
||||
Dim oc = isleernothing((currentRow(9)))
|
||||
Dim ptc = isleernothing((currentRow(11)))
|
||||
Dim tv = isleernothing((currentRow(14)))
|
||||
Dim t_time = isleernothing((currentRow(13)))
|
||||
Dim t_date = isleernothing((currentRow(12)))
|
||||
Dim tna = isleernothing((currentRow(16)))
|
||||
|
||||
|
||||
Dim MDMEinarb_check As New cMDMEinarbeitung("IDS_Details", ymd)
|
||||
If MDMEinarb_check.hasEntry AndAlso MDMEinarb_check.completed Then Return False
|
||||
|
||||
With ids
|
||||
.YearMonthDay = isleernothing((currentRow(0)))
|
||||
.CustomerCode = isleernothing((currentRow(1)))
|
||||
.Paymentsummarynumber = isleernothing((currentRow(2)))
|
||||
.CustomerName = isleernothing((currentRow(3)))
|
||||
.OutletCountry = isleernothing((currentRow(4)))
|
||||
.OutletCountryCode = isleernothing((currentRow(5)))
|
||||
.OutletCode = isleernothing((currentRow(6)))
|
||||
.ProductTypeCode = isleernothing((currentRow(7)))
|
||||
Dim ids_detail As New cIDSDetails(ymd, cc, cn, occ, oc, ptc, t_time, t_date, tv, tna)
|
||||
ids_detail.AmminclVAT = isleernothing((currentRow(15)))
|
||||
ids_detail.VATAmount = isleernothing((currentRow(17)))
|
||||
ids_detail.avpriceexclVAT = isleernothing((currentRow(18)))
|
||||
ids_detail.Paymentsummarynumber = ""
|
||||
If ids_detail.SAVE() Then counTrans += 1
|
||||
|
||||
If lngRecordCount = 2 Then
|
||||
MDMEinarb.invoicedate = CDate(.YearMonthDay)
|
||||
MDMEinarb.invoicedate = CDate(ids_detail.YearMonthDay)
|
||||
End If
|
||||
|
||||
'Dim transVol_old = .TransactionVolume
|
||||
'Dim transVol_new = isleernothing((currentRow(8)))
|
||||
|
||||
'If transVol_old IsNot Nothing AndAlso IsNumeric(transVol_old) AndAlso transVol_new IsNot Nothing AndAlso IsNumeric(transVol_new) Then
|
||||
End If
|
||||
|
||||
' Dim AmininclVat_old = CDbl(.AmminclVAT)
|
||||
' Dim AmininclVat_new = CDbl(isleernothing((currentRow(9)).Replace(".", ",")))
|
||||
|
||||
' Dim TotalNetAmount_old = CDbl(.TotalNetAmount)
|
||||
' Dim TotalNetAmount_new = CDbl(isleernothing((currentRow(10)).Replace(".", ",")))
|
||||
|
||||
' Dim VATAmount_old = CDbl(.VATAmount)
|
||||
' Dim VATAmount_new = CDbl(isleernothing((currentRow(11)).Replace(".", ",")))
|
||||
|
||||
|
||||
' If (CDec(transVol_old) <> CDec(transVol_new)) AndAlso Math.Abs(CDbl(transVol_old)) = Math.Abs(CDbl(transVol_new.replace(".", ","))) Then 'case1: gleiche Transaktionshohe -> nicht abziehen, sondern nur Preis anpassen!
|
||||
|
||||
' If AmininclVat_old <> AmininclVat_new Then
|
||||
|
||||
' .TransactionVolume = transVol_old + transVol_new
|
||||
' .AmminclVAT = AmininclVat_old + AmininclVat_new
|
||||
' .TotalNetAmount = TotalNetAmount_old + TotalNetAmount_new
|
||||
' .VATAmount = VATAmount_old + VATAmount_new
|
||||
|
||||
|
||||
' End If
|
||||
|
||||
|
||||
' ElseIf Math.Abs(CDbl(transVol_old)) > Math.Abs(CDbl(transVol_new.replace(".", ","))) AndAlso (CDec(transVol_old) <> CDec(transVol_new)) Then 'case2: alte Transaktionshohe höher als neue, abziehen!
|
||||
|
||||
|
||||
' If AmininclVat_old <> AmininclVat_new Then
|
||||
' .TransactionVolume = transVol_old + transVol_new
|
||||
' .AmminclVAT = AmininclVat_old + AmininclVat_new
|
||||
' .TotalNetAmount = TotalNetAmount_old + TotalNetAmount_new
|
||||
' .VATAmount = VATAmount_old + VATAmount_new
|
||||
|
||||
' 'If .TransactionVolume < 0 Then .TransactionVolume = .TransactionVolume * -1
|
||||
|
||||
' End If
|
||||
|
||||
' ElseIf Math.Abs(CDbl(transVol_old)) < Math.Abs(CDbl(transVol_new.replace(".", ","))) AndAlso (CDec(transVol_old) <> CDec(transVol_new)) Then 'case3: alte Transaktionshohe niedriger als neue, dazuzählen (weil die "Stornierung" vor der eig. Transk. importiert werden kann)!
|
||||
|
||||
|
||||
' If AmininclVat_old <> AmininclVat_new Then
|
||||
|
||||
' .TransactionVolume = transVol_old + transVol_new
|
||||
' .AmminclVAT = AmininclVat_old + AmininclVat_new
|
||||
' .TotalNetAmount = TotalNetAmount_old + TotalNetAmount_new
|
||||
' .VATAmount = VATAmount_old + VATAmount_new
|
||||
|
||||
' 'If .TransactionVolume < 0 Then .TransactionVolume = .TransactionVolume * -1
|
||||
|
||||
' End If
|
||||
|
||||
' End If
|
||||
|
||||
'Else
|
||||
.TransactionVolume = isleernothing((currentRow(8)))
|
||||
.AmminclVAT = isleernothing((currentRow(9)))
|
||||
.TotalNetAmount = isleernothing((currentRow(10)))
|
||||
.VATAmount = isleernothing((currentRow(11)))
|
||||
.avpriceexclVAT = IIf(avprive <> "" AndAlso IsNumeric(avprive), avprive, 0)
|
||||
|
||||
' End If
|
||||
|
||||
|
||||
'.VRNumber = isleernothing((currentRow(13)))
|
||||
'.OBONumber = isleernothing((currentRow(14)))
|
||||
|
||||
Console.WriteLine("IDS: " & isleernothing((currentRow(1))) & " - " & lngRecordCount & " - " & isleernothing((currentRow(10))))
|
||||
|
||||
If isOBO Then
|
||||
If .SAVE_OBO() Then counTrans += 1
|
||||
Else
|
||||
If .SAVE_VR() Then counTrans += 1
|
||||
End If
|
||||
|
||||
'.SAVE()
|
||||
|
||||
End With
|
||||
|
||||
Catch ex As Exception
|
||||
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
|
||||
@@ -496,20 +466,29 @@ Public Class cIDS
|
||||
End If
|
||||
|
||||
Loop
|
||||
cnt = CInt(lngRecordCount)
|
||||
MDMEinarb.ds_total += cnt - 1
|
||||
MDMEinarb.ds_count += counTrans
|
||||
MDMEinarb.import_date = Now()
|
||||
MDMEinarb.importfilename = fi.Name
|
||||
|
||||
If MDMEinarb.ds_total = MDMEinarb.ds_count Then
|
||||
MDMEinarb.completed = True
|
||||
MDMEinarb.completed_date = Now()
|
||||
If Not isTransactionDetail Then
|
||||
MDMEinarb.supplier = "IDS"
|
||||
Else
|
||||
MDMEinarb.supplier = "IDS_Details"
|
||||
End If
|
||||
|
||||
MDMEinarb.SAVE()
|
||||
objFileRead.Close()
|
||||
Return True
|
||||
cnt = CInt(lngRecordCount)
|
||||
MDMEinarb.ds_total += cnt - 1
|
||||
MDMEinarb.ds_count += counTrans
|
||||
MDMEinarb.import_date = Now()
|
||||
MDMEinarb.importfilename = fi.Name
|
||||
|
||||
If MDMEinarb.ds_total = MDMEinarb.ds_count Then
|
||||
MDMEinarb.completed = True
|
||||
MDMEinarb.completed_date = Now()
|
||||
End If
|
||||
|
||||
MDMEinarb.SAVE()
|
||||
|
||||
objFileRead.Close()
|
||||
Return True
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1319,6 +1298,160 @@ Public Class cIDSDieselpreisRW
|
||||
|
||||
End Class
|
||||
|
||||
Public Class cIDSDetails
|
||||
|
||||
Property YearMonthDay As Object = Nothing
|
||||
Property CustomerCode As Object = Nothing
|
||||
Property CardNumber As Object = Nothing
|
||||
Property Paymentsummarynumber As Object = Nothing
|
||||
Property OutletCountryCode As Object = Nothing
|
||||
Property OutletCode As Object = Nothing
|
||||
Property ProductTypeCode As Object = Nothing
|
||||
Property TransactionVolume As Object = Nothing
|
||||
Property AmminclVAT As Object = Nothing
|
||||
Property TotalNetAmount As Object = Nothing
|
||||
Property VATAmount As Object = Nothing
|
||||
Property avpriceexclVAT As Object = Nothing
|
||||
Property Transactiondate As Object = Nothing
|
||||
Property Transactiontime As Object = Nothing
|
||||
|
||||
Public hasEntry = False
|
||||
|
||||
Dim SQL As New SQL
|
||||
|
||||
Sub New()
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
Sub New(YearMonthDay, CustomerCode, cardNumber, OutletCountryCode, OutletCode, ProductTypeCode, Transactiontime, Transactiondate, TransactionVolume, TotalNetAmount)
|
||||
Me.YearMonthDay = YearMonthDay
|
||||
Me.CardNumber = cardNumber
|
||||
Me.CustomerCode = CustomerCode
|
||||
Me.OutletCountryCode = OutletCountryCode
|
||||
Me.OutletCode = OutletCode
|
||||
Me.ProductTypeCode = ProductTypeCode
|
||||
Me.Transactiontime = Transactiontime
|
||||
Me.TransactionVolume = TransactionVolume
|
||||
Me.TotalNetAmount = TotalNetAmount
|
||||
Me.Transactiondate = Transactiondate
|
||||
LOAD()
|
||||
|
||||
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("YearMonthDay", YearMonthDay))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("CustomerCode", CustomerCode))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("OutletCountryCode", OutletCountryCode))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("OutletCode", OutletCode))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ProductTypeCode", ProductTypeCode))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("TransactionVolume", TransactionVolume))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("AmminclVAT", AmminclVAT))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("TotalNetAmount", TotalNetAmount))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("VATAmount", VATAmount))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("avpriceexclVAT", avpriceexclVAT))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("CardNumber", CardNumber))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("Transactiondate", Transactiondate))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("Transactiontime", Transactiontime))
|
||||
Return list
|
||||
End Function
|
||||
|
||||
Public Sub LOAD()
|
||||
Try
|
||||
|
||||
hasEntry = False
|
||||
Using conn As SqlConnection = SQL.GetNewOpenConnectionFMZOLL()
|
||||
Using cmd As New SqlCommand("SELECT * FROM tblIDSTransactionsNew_Details WHERE YearMonthDay=@YearMonthDay AND cardNumber=@cardNumber AND CustomerCode=@CustomerCode AND OutletCountryCode=@OutletCountryCode AND OutletCode=@OutletCode AND ProductTypeCode=@ProductTypeCode AND Transactiontime=@Transactiontime AND TransactionVolume=@TransactionVolume AND Transactiondate=@Transactiondate ", conn)
|
||||
cmd.Parameters.AddWithValue("@YearMonthDay", YearMonthDay)
|
||||
cmd.Parameters.AddWithValue("@CustomerCode", CustomerCode)
|
||||
cmd.Parameters.AddWithValue("@OutletCountryCode", OutletCountryCode)
|
||||
cmd.Parameters.AddWithValue("@OutletCode", OutletCode)
|
||||
cmd.Parameters.AddWithValue("@ProductTypeCode", ProductTypeCode)
|
||||
cmd.Parameters.AddWithValue("@cardNumber", CardNumber)
|
||||
cmd.Parameters.AddWithValue("@Transactiontime", Transactiontime)
|
||||
cmd.Parameters.AddWithValue("@TransactionVolume", TransactionVolume)
|
||||
cmd.Parameters.AddWithValue("@TotalNetAmount", TotalNetAmount)
|
||||
cmd.Parameters.AddWithValue("@Transactiondate", Transactiondate)
|
||||
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 SAVE() As Boolean
|
||||
Dim list As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) = getParameterList()
|
||||
|
||||
Dim sqlstr = " BEGIN TRAN IF EXISTS(SELECT * FROM tblIDSTransactionsNew_Details WHERE YearMonthDay=@YearMonthDay AND cardNumber=@cardNumber AND CustomerCode=@CustomerCode AND OutletCountryCode=@OutletCountryCode AND OutletCode=@OutletCode AND ProductTypeCode=@ProductTypeCode AND Transactiontime=@Transactiontime AND TransactionVolume=@TransactionVolume AND Transactiondate=@Transactiondate) " &
|
||||
" BEGIN " & getUpdateCmd() & " END " &
|
||||
" Else " &
|
||||
" BEGIN " & getInsertCmd() & " END " &
|
||||
" commit tran "
|
||||
|
||||
Return SQL.doSQLVarList(sqlstr, "FMZOLL", , list)
|
||||
End Function
|
||||
|
||||
Public Function getUpdateCmd(Optional PARAM As String = "", Optional VALUE As String = "") As String
|
||||
Try
|
||||
Dim list As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) = getParameterList()
|
||||
|
||||
Dim str As String = ""
|
||||
For Each i In list
|
||||
If Not i.isPrimaryParam Then
|
||||
str &= "[" & i.Text & "] = @" & i.Scalarvariable & "," '.Replace("-", "").Replace(" ", "") & ","
|
||||
End If
|
||||
Next
|
||||
str = str.Substring(0, str.Length - 1) 'wg. ','
|
||||
Return (" UPDATE [tblIDSTransactionsNew_Details] SET " & str & " WHERE YearMonthDay=@YearMonthDay AND cardNumber=@cardNumber AND CustomerCode=@CustomerCode AND OutletCountryCode=@OutletCountryCode AND OutletCode=@OutletCode AND ProductTypeCode=@ProductTypeCode AND Transactiontime=@Transactiontime AND TransactionVolume=@TransactionVolume AND Transactiondate=@Transactiondate ")
|
||||
|
||||
Catch ex As Exception
|
||||
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
|
||||
End Try
|
||||
Return ""
|
||||
End Function
|
||||
|
||||
|
||||
Public Function getInsertCmd() As String
|
||||
Try
|
||||
Dim list As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) = getParameterList()
|
||||
Dim str As String = ""
|
||||
Dim values As String = ""
|
||||
For Each i In list
|
||||
If Not i.isPrimaryParam Then
|
||||
str &= "[" & i.Text & "],"
|
||||
values &= "@" & i.Scalarvariable & "," '.Replace("-", "").Replace(" ", "") & ","
|
||||
End If
|
||||
Next
|
||||
str = str.Substring(0, str.Length - 1) 'wg. ','
|
||||
values = values.Substring(0, values.Length - 1) 'wg. ','
|
||||
Return (" INSERT INTO tblIDSTransactionsNew_Details (" & str & ") VALUES(" & values & ") ")
|
||||
Catch ex As Exception
|
||||
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
|
||||
End Try
|
||||
Return ""
|
||||
End Function
|
||||
|
||||
End Class
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
|
||||
Imports System.Data.SqlClient
|
||||
Imports System.Reflection
|
||||
Imports jdk.nashorn.internal.ir
|
||||
|
||||
Public Class cOfferteList
|
||||
Property KundenNr As Object = Nothing
|
||||
|
||||
Reference in New Issue
Block a user