ustva, Fremdrechnungen, ids

This commit is contained in:
2025-03-12 11:11:03 +01:00
parent d5e9ecbd84
commit 80f838ad28
6 changed files with 496 additions and 90 deletions

View File

@@ -376,7 +376,6 @@ Public Class usrcntlPDFScanList
ElseIf files.Count > 0 Then
If files(0) <> "" Then
Dim fio As New System.IO.FileInfo(files(0))
If DS.uploadDataToDATENSERVER(files(0), fio.Name, ".pdf") Then
RaiseEvent FileAdded(DS.da_id, DS.GET_TOP1_PATH, DS.da_name)
MsgBox("Dokument wurde hochgeladen.")

View File

@@ -664,6 +664,173 @@ End Class
Public Class cIDSInvoiceSplittedByCountry
Property invoice_id As Integer
Property YearMonthDay As Object = Nothing
Property CustomerCode As Object = Nothing
Property TotalInvoiceId As Object = Nothing
Property Country As Object = Nothing
Property Invoicenumber As Object = Nothing
Property DocumentName As Object = Nothing
Property Zeitstempel As Object = Nothing
Property daid As Object = Nothing
Property archiv As Boolean
Property archiviertDatum As Object = Nothing
Public hasEntry = False
Dim SQL As New SQL
Sub New()
End Sub
Sub New(invoice_id)
Me.invoice_id = invoice_id
LOADID()
End Sub
Sub New(YearMonthDay, CustomerCode, Invoicenumber, Country)
Me.YearMonthDay = YearMonthDay
Me.Invoicenumber = Invoicenumber
Me.CustomerCode = CustomerCode
Me.Country = Country
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("invoice_id", invoice_id,, True))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("YearMonthDay", YearMonthDay))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("TotalInvoiceId", TotalInvoiceId))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("CustomerCode", CustomerCode))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("Invoicenumber", Invoicenumber))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("DocumentName", DocumentName))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("Country", Country))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("Zeitstempel", Zeitstempel))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("daid", daid))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("archiv", archiv))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("archiviertDatum", archiviertDatum))
Return list
End Function
Public Function SAVE() As Boolean
Dim list As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) = getParameterList()
Dim sqlstr = " BEGIN TRAN IF EXISTS(SELECT * FROM tblIDSInvoicesNewSplittedByCountry WHERE YearMonthDay=@YearMonthDay AND CustomerCode=@CustomerCode AND Invoicenumber=@Invoicenumber AND Country=@Country) " &
" BEGIN " & getUpdateCmd() & " END " &
" Else " &
" BEGIN " & getInsertCmd() & " END " &
" commit tran "
Return SQL.doSQLVarList(sqlstr, "FMZOLL", , list)
End Function
Public Sub LOADID()
Try
hasEntry = False
Using conn As SqlConnection = SQL.GetNewOpenConnectionFMZOLL()
Using cmd As New SqlCommand("SELECT * FROM tblIDSInvoicesNewSplittedByCountry WHERE invoice_id=@invoice_id ", conn)
cmd.Parameters.AddWithValue("@invoice_id", invoice_id)
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 Sub LOAD()
Try
hasEntry = False
Using conn As SqlConnection = SQL.GetNewOpenConnectionFMZOLL()
Using cmd As New SqlCommand("SELECT * FROM tblIDSInvoicesNewSplittedByCountry WHERE YearMonthDay=@YearMonthDay AND CustomerCode=@CustomerCode AND Invoicenumber=@Invoicenumber AND Country=@Country", conn)
cmd.Parameters.AddWithValue("@YearMonthDay", YearMonthDay)
cmd.Parameters.AddWithValue("@Invoicenumber", Invoicenumber)
cmd.Parameters.AddWithValue("@CustomerCode", CustomerCode)
cmd.Parameters.AddWithValue("@Country", Country)
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
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 [tblIDSInvoicesNewSplittedByCountry] SET " & str & " WHERE YearMonthDay=@YearMonthDay AND CustomerCode=@CustomerCode AND Invoicenumber=@Invoicenumber AND Country=@Country")
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 tblIDSInvoicesNewSplittedByCountry (" & 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