Kundenlogin, Fremdrechnungen, etc.

This commit is contained in:
2025-11-20 13:49:39 +01:00
parent a572b1f048
commit 9fca9ec35c
17 changed files with 2299 additions and 158 deletions

View File

@@ -612,6 +612,26 @@ Public Class cIDS
End Function
Public Shared Function setBackToCustomer(SQL As SQL, backToCustomer As Boolean, ab As Date, AdressenNr As Integer) As Boolean
Return SQL.doSQL("update tblIDSInvoicesNewSplittedByCountry set InvToCustomer = " & IIf(backToCustomer, "1", "NULL") & " where cast(YearMonthDay as Date) >= '" & ab.ToShortDateString & "' AND CustomerCode in (select CustomerCode from tbl_IDS_Kunden where KdNrVERAG = '" & AdressenNr & "' AND isnull([tbl_IDS_Kunden].KdNrAlt, 0) = 0 )", "FMZOLL")
End Function
Public Shared Function setBackToCustomerCustomerID(SQL As SQL, backToCustomer As Boolean, AdressenNr As String) As Boolean
Return SQL.doSQL("update tblIDSInvoicesNewSplittedByCountry set InvToCustomer = " & IIf(backToCustomer, "1", "NULL") & " where InvToCustomer Is null AND CustomerCode in (select CustomerCode from tbl_IDS_Kunden where KdNrVERAG = '" & AdressenNr & "' AND isnull([tbl_IDS_Kunden].KdNrAlt, 0) = 0 )", "FMZOLL")
End Function
Public Shared Function setBackToCustomerInvoiceID(SQL As SQL, backToCustomer As Boolean, Optional invoiceID As String = "") As Boolean
Return SQL.doSQL("update tblIDSInvoicesNewSplittedByCountry set InvToCustomer = " & IIf(backToCustomer, "1", "0") & " where InvToCustomer Is null " & IIf(invoiceID <> "", "AND invoice_id = '" & invoiceID & "'", " ") & "", "FMZOLL")
End Function
Public Shared Function UPDATE_ARCHIV(reDat As Date, reNr As String, ids_kdNr As Integer, country As String, UStVAn_ID As Integer) As Boolean
Try
Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL

View File

@@ -0,0 +1,123 @@

Imports System.Data.SqlClient
Imports System.Reflection
Public Class cKundenportal
Property KundenNr As Object = Nothing
Property Username As Object = Nothing
Property Password As Object = Nothing
Property Lieferant As Object = Nothing
Property Portal As Object = Nothing
Public hasEntry = False
Dim SQL As New SQL
Sub New(KundenNr, Portal)
Me.KundenNr = KundenNr
Me.Portal = Portal
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("KundenNr", KundenNr))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("Username", Username))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("Password", Password))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("Lieferant", Lieferant))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("Portal", Portal))
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 tblKundenlogin WHERE KundenNr=@KundenNr AND Portal=@Portal ) " &
" BEGIN " & getUpdateCmd() & " END " &
" Else " &
" BEGIN " & getInsertCmd() & " END " &
" commit tran "
Return SQL.doSQLVarList(sqlstr, "FMZOLL", , list)
End Function
Public Sub LOAD()
Try
hasEntry = False
Using conn As SqlConnection = SQL.GetNewOpenConnectionFMZOLL()
Using cmd As New SqlCommand("SELECT * FROM tblKundenlogin WHERE KundenNr=@KundenNr AND Portal=@Portal ", conn)
cmd.Parameters.AddWithValue("@KundenNr", KundenNr)
cmd.Parameters.AddWithValue("@Portal", Portal)
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 [tblKundenlogin] SET " & str & " WHERE KundenNr=@KundenNr AND Portal=@Portal ")
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 tblKundenlogin (" & 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
Public Shared Function DELETE(KundenNr, Portal) As Boolean 'obj As Object, tablename As String, where As String) As Boolean
Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL
Dim sqlstr = " DELETE FROM [tblKundenlogin] WITH(updlock,serializable) WHERE KundenNr=" & KundenNr & " AND Portal ='" & Portal & "'"
Return SQL.doSQL(sqlstr, "FMZOLL")
End Function
End Class

View File

@@ -1,6 +1,8 @@

Imports System.Data.SqlClient
Imports System.Reflection
Imports System.Web.Configuration
Imports io.konik.zugferd
Public Class cRMC
Property rmc_id As Integer
@@ -255,6 +257,27 @@ Public Class cRMC
End Function
Public Shared Function setBackToCustomer(SQL As SQL, backToCustomer As Boolean, ab As Date, customerNo As Integer) As Boolean
Return SQL.doSQL("update tblRMCImport set InvToCustomer = " & IIf(backToCustomer, "1", "NULL") & " where InvToCustomer Is null and cast(rmc_reDatum as Date) >= '" & ab.ToShortDateString & "' AND rmc_kdNr = '" & customerNo & "'", "FMZOLL")
End Function
Public Shared Function setBackToCustomerCustomerID(SQL As SQL, backToCustomer As Boolean, customerNo As String) As Boolean
Return SQL.doSQL("update tblRMCImport set InvToCustomer = " & IIf(backToCustomer, "1", "NULL") & " where InvToCustomer Is null AND rmc_kdNr = '" & customerNo & "'", "FMZOLL")
End Function
Public Shared Function setBackToCustomerInvoiceID(SQL As SQL, backToCustomer As Boolean, Optional invoiceID As String = "") As Boolean
Return SQL.doSQL("update tblRMCImport set InvToCustomer = " & IIf(backToCustomer, "1", "0") & " where InvToCustomer Is null " & IIf(invoiceID <> "", "AND rmc_id = '" & invoiceID & "'", " ") & "", "FMZOLL")
End Function
Public Class Paramter
Shared apiSettingsloaded As Boolean = False
@@ -262,7 +285,7 @@ Public Class cRMC
Shared Function GET_PARAM_ByName(tcParam_name, TESTSYSTEM) As String
Return SQL.getValueTxtBySql("SELECT TOP 1 [Param_value] FROM [tblPartnersystem_Paramter] WHERE Param_system='RMC' AND [Param_name]='" & tcParam_name & "' AND Param_testsystem = " & IIf(TESTSYSTEM, 1, 0), , , SQL.GetNewOpenConnectionFMZOLL_SYSTEM(TESTSYSTEM))
End Function
End Function
Shared Function getFTPConenction(ByRef API_String As String, ByRef API As DataTable, ByRef program As String) As Boolean

View File

@@ -1,10 +1,7 @@
Imports System
Imports System.Collections.Generic
Imports System.Data.SqlClient
Imports System.Data.SqlClient
Imports System.IO
Imports System.Reflection
Imports Therefore.API
Imports VERAG_PROG_ALLGEMEIN
Imports System.Web.Configuration
Public Class cUTA
@@ -23,6 +20,27 @@ Public Class cUTA
End Function
Public Shared Function setBackToCustomer(SQL As SQL, backToCustomer As Boolean, ab As Date, customerNo As Integer) As Boolean
Return SQL.doSQL("update tblUTAImportNew set InvToCustomer = " & IIf(backToCustomer, "1", "NULL") & " where cast(Rechnungsdatum as Date) >= '" & ab.ToShortDateString & "' AND Kundennummer = '" & customerNo & "'", "FMZOLL")
End Function
Public Shared Function setBackToCustomerCustomerID(SQL As SQL, backToCustomer As Boolean, customerNo As String) As Boolean
Return SQL.doSQL("update tblUTAImportNew set InvToCustomer = " & IIf(backToCustomer, "1", "NULL") & " where InvToCustomer Is null AND Kundennummer = '" & customerNo & "'", "FMZOLL")
End Function
Public Shared Function setBackToCustomerInvoiceID(SQL As SQL, backToCustomer As Boolean, Optional invoiceID As String = "") As Boolean
Return SQL.doSQL("update tblUTAImportNew set InvToCustomer = " & IIf(backToCustomer, "1", "0") & " where InvToCustomer Is null " & IIf(invoiceID <> "", "AND [Rechnungsnummer_pro_Lieferland] = '" & invoiceID & "'", " ") & "", "FMZOLL")
End Function
Public Class UTAHeader
Property Übertragungsnummer As Integer