diff --git a/SDL/Fakturierung/usrCntlFaktAbrechnung.Designer.vb b/SDL/Fakturierung/usrCntlFaktAbrechnung.Designer.vb index 7c5f2213..588afe0e 100644 --- a/SDL/Fakturierung/usrCntlFaktAbrechnung.Designer.vb +++ b/SDL/Fakturierung/usrCntlFaktAbrechnung.Designer.vb @@ -158,6 +158,8 @@ Partial Class usrCntlFaktAbrechnung Me.txtZollbelegNr = New VERAG_PROG_ALLGEMEIN.MyTextBox() Me.Label10 = New System.Windows.Forms.Label() Me.pnlRechnungAn = New System.Windows.Forms.Panel() + Me.cboRgArt = New VERAG_PROG_ALLGEMEIN.MyComboBox() + Me.Label57 = New System.Windows.Forms.Label() Me.cboVorauskasse = New VERAG_PROG_ALLGEMEIN.MyComboBox() Me.Label56 = New System.Windows.Forms.Label() Me.txtRechnungAnZusatz = New VERAG_PROG_ALLGEMEIN.MyTextBox() @@ -204,7 +206,7 @@ Partial Class usrCntlFaktAbrechnung Me.Button7 = New System.Windows.Forms.Button() Me.btnVorauskasseAnzeigen = New System.Windows.Forms.Button() Me.Button5 = New System.Windows.Forms.Button() - Me.btn = New System.Windows.Forms.Button() + Me.btnZoll_EUST = New System.Windows.Forms.Button() Me.txtUnterNrRef = New VERAG_PROG_ALLGEMEIN.MyTextBox() Me.cboFilialeRef = New VERAG_PROG_ALLGEMEIN.MyComboBox() Me.txtAbfertigungsnummerRef = New VERAG_PROG_ALLGEMEIN.MyTextBox() @@ -286,8 +288,6 @@ Partial Class usrCntlFaktAbrechnung Me.GutschriftAnVeragToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.VeragAGToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.VeragCSToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() - Me.cboRgArt = New VERAG_PROG_ALLGEMEIN.MyComboBox() - Me.Label57 = New System.Windows.Forms.Label() Me.pnlTop.SuspendLayout() Me.Panel3.SuspendLayout() Me.Panel1.SuspendLayout() @@ -2058,6 +2058,27 @@ Partial Class usrCntlFaktAbrechnung Me.pnlRechnungAn.Size = New System.Drawing.Size(582, 153) Me.pnlRechnungAn.TabIndex = 0 ' + 'cboRgArt + ' + Me.cboRgArt._allowedValuesFreiText = Nothing + Me.cboRgArt._allowFreiText = False + Me.cboRgArt._value = "" + Me.cboRgArt.FormattingEnabled = True + Me.cboRgArt.Location = New System.Drawing.Point(478, 127) + Me.cboRgArt.Name = "cboRgArt" + Me.cboRgArt.Size = New System.Drawing.Size(97, 21) + Me.cboRgArt.TabIndex = 246 + ' + 'Label57 + ' + Me.Label57.AutoSize = True + Me.Label57.Location = New System.Drawing.Point(431, 130) + Me.Label57.Name = "Label57" + Me.Label57.Size = New System.Drawing.Size(42, 13) + Me.Label57.TabIndex = 245 + Me.Label57.Text = "RG-Art:" + Me.Label57.TextAlign = System.Drawing.ContentAlignment.TopRight + ' 'cboVorauskasse ' Me.cboVorauskasse._allowedValuesFreiText = Nothing @@ -2715,7 +2736,7 @@ Partial Class usrCntlFaktAbrechnung Me.Panel7.Controls.Add(Me.Button7) Me.Panel7.Controls.Add(Me.btnVorauskasseAnzeigen) Me.Panel7.Controls.Add(Me.Button5) - Me.Panel7.Controls.Add(Me.btn) + Me.Panel7.Controls.Add(Me.btnZoll_EUST) Me.Panel7.Controls.Add(Me.txtUnterNrRef) Me.Panel7.Controls.Add(Me.cboFilialeRef) Me.Panel7.Controls.Add(Me.txtAbfertigungsnummerRef) @@ -2851,15 +2872,15 @@ Partial Class usrCntlFaktAbrechnung Me.Button5.Text = "Offerten bearbeiten" Me.Button5.UseVisualStyleBackColor = True ' - 'btn + 'btnZoll_EUST ' - Me.btn.FlatStyle = System.Windows.Forms.FlatStyle.Flat - Me.btn.Location = New System.Drawing.Point(656, 3) - Me.btn.Name = "btn" - Me.btn.Size = New System.Drawing.Size(165, 23) - Me.btn.TabIndex = 10 - Me.btn.Text = "ZOLL / EUST Daten (F3)" - Me.btn.UseVisualStyleBackColor = True + Me.btnZoll_EUST.FlatStyle = System.Windows.Forms.FlatStyle.Flat + Me.btnZoll_EUST.Location = New System.Drawing.Point(656, 3) + Me.btnZoll_EUST.Name = "btnZoll_EUST" + Me.btnZoll_EUST.Size = New System.Drawing.Size(165, 23) + Me.btnZoll_EUST.TabIndex = 10 + Me.btnZoll_EUST.Text = "ZOLL / EUST Daten (F3)" + Me.btnZoll_EUST.UseVisualStyleBackColor = True ' 'txtUnterNrRef ' @@ -4035,27 +4056,6 @@ Partial Class usrCntlFaktAbrechnung Me.VeragCSToolStripMenuItem.Size = New System.Drawing.Size(122, 22) Me.VeragCSToolStripMenuItem.Text = "Verag CS" ' - 'cboRgArt - ' - Me.cboRgArt._allowedValuesFreiText = Nothing - Me.cboRgArt._allowFreiText = False - Me.cboRgArt._value = "" - Me.cboRgArt.FormattingEnabled = True - Me.cboRgArt.Location = New System.Drawing.Point(478, 127) - Me.cboRgArt.Name = "cboRgArt" - Me.cboRgArt.Size = New System.Drawing.Size(97, 21) - Me.cboRgArt.TabIndex = 246 - ' - 'Label57 - ' - Me.Label57.AutoSize = True - Me.Label57.Location = New System.Drawing.Point(431, 130) - Me.Label57.Name = "Label57" - Me.Label57.Size = New System.Drawing.Size(42, 13) - Me.Label57.TabIndex = 245 - Me.Label57.Text = "RG-Art:" - Me.Label57.TextAlign = System.Drawing.ContentAlignment.TopRight - ' 'usrCntlFaktAbrechnung ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) @@ -4264,7 +4264,7 @@ Partial Class usrCntlFaktAbrechnung Friend WithEvents btnNeueUnterNR As Button Friend WithEvents cboRgGS As VERAG_PROG_ALLGEMEIN.MyComboBox Friend WithEvents cboSammelrechnung As VERAG_PROG_ALLGEMEIN.MyComboBox - Friend WithEvents btn As Button + Friend WithEvents btnZoll_EUST As Button Friend WithEvents Button5 As Button Friend WithEvents btnVorauskasseAnzeigen As Button Friend WithEvents Button6 As Button diff --git a/SDL/Fakturierung/usrCntlFaktAbrechnung.vb b/SDL/Fakturierung/usrCntlFaktAbrechnung.vb index 94df661d..c466fb2f 100644 --- a/SDL/Fakturierung/usrCntlFaktAbrechnung.vb +++ b/SDL/Fakturierung/usrCntlFaktAbrechnung.vb @@ -3686,7 +3686,7 @@ Nächste_Textzeile_lesen: End If If keyData = Keys.F3 AndAlso cboSammelrechnung._value = 0 Then - btn.PerformClick() + btnZoll_EUST.PerformClick() Return True End If @@ -3740,7 +3740,7 @@ Nächste_Textzeile_lesen: f.Show(Me) End Sub - Private Sub btn_Click(sender As Object, e As EventArgs) Handles btn.Click + Private Sub btn_Click(sender As Object, e As EventArgs) Handles btnZoll_EUST.Click Dim bezugsNr = "" If RECHNUNG IsNot Nothing Then bezugsNr = RECHNUNG.FilialenNr & "/" & RECHNUNG.AbfertigungsNr & "" @@ -4707,7 +4707,7 @@ Nächste_Textzeile_lesen: Private Sub cboSammelrechnung_SelectedValueChanged(sender As Object, e As EventArgs) Handles cboSammelrechnung.SelectedValueChanged - btn.Enabled = IIf(cboSammelrechnung._value = 0, True, False) + btnZoll_EUST.Enabled = IIf(cboSammelrechnung._value = 0, True, False) End Sub diff --git a/SDL/kunden/usrCntlIDSPreise.vb b/SDL/kunden/usrCntlIDSPreise.vb index d49b97c9..e883df91 100644 --- a/SDL/kunden/usrCntlIDSPreise.vb +++ b/SDL/kunden/usrCntlIDSPreise.vb @@ -203,47 +203,48 @@ Public Class usrCntlIDSPreise If edit Then - 'Select Case cbxTypes._value - ' Case "L" - ' SQL_ = "SELECT tbl_IDS_Rechenwerte.ID as ID, tbl_IDS_Rechenwerte.OutletCountryCode,tbl_IDS_Länder.OutletCountry, tbl_IDS_Rechenwerte.ProductTypeCode,tbl_IDS_Produkte.ProductDescription, tbl_IDS_Rechenwerte.Rechenwert, tbl_IDS_Rechenwerte.Kz, tbl_IDS_Rechenwerte.KategorieNr, tbl_IDS_Rechenwerte.Zeitstempel, tbl_IDS_Rechenwerte.Sachbearbeiter - ' FROM tbl_IDS_Produkte INNER JOIN (tbl_IDS_Länder INNER JOIN tbl_IDS_Rechenwerte ON tbl_IDS_Länder.OutletCountryCode = tbl_IDS_Rechenwerte.OutletCountryCode) ON tbl_IDS_Produkte.ProductTypeCode = tbl_IDS_Rechenwerte.ProductTypeCode - ' WHERE (((tbl_IDS_Rechenwerte.OutletCode) Is Null) AND ((tbl_IDS_Rechenwerte.CustomerCode) Is Null) " & IIf(OutletCountryCode > 0, " AND tbl_IDS_Rechenwerte.OutletCountryCode = " & OutletCountryCode & ") ", ") ") & SQL_WHERE & " - ' ORDER BY tbl_IDS_Länder.OutletCountry, tbl_IDS_Rechenwerte.OutletCountryCode, tbl_IDS_Produkte.ProductDescription, tbl_IDS_Rechenwerte.ProductTypeCode;" + Select Case cbxTypes._value + Case "L" + SQL_ = "SELECT tbl_IDS_Rechenwerte.ID as ID, tbl_IDS_Rechenwerte.OutletCountryCode,tbl_IDS_Länder.OutletCountry, tbl_IDS_Rechenwerte.ProductTypeCode,tbl_IDS_Produkte.ProductDescription, tbl_IDS_Rechenwerte.Rechenwert, tbl_IDS_Rechenwerte.Kz, tbl_IDS_Rechenwerte.KategorieNr, tbl_IDS_Rechenwerte.Zeitstempel, tbl_IDS_Rechenwerte.Sachbearbeiter + FROM tbl_IDS_Produkte INNER JOIN (tbl_IDS_Länder INNER JOIN tbl_IDS_Rechenwerte ON tbl_IDS_Länder.OutletCountryCode = tbl_IDS_Rechenwerte.OutletCountryCode) ON tbl_IDS_Produkte.ProductTypeCode = tbl_IDS_Rechenwerte.ProductTypeCode + WHERE (((tbl_IDS_Rechenwerte.OutletCode) Is Null) AND ((tbl_IDS_Rechenwerte.CustomerCode) Is Null) " & IIf(OutletCountryCode > 0, " AND tbl_IDS_Rechenwerte.OutletCountryCode = " & OutletCountryCode & ") ", ") ") & SQL_WHERE & " + ORDER BY tbl_IDS_Länder.OutletCountry, tbl_IDS_Rechenwerte.OutletCountryCode, tbl_IDS_Produkte.ProductDescription, tbl_IDS_Rechenwerte.ProductTypeCode;" - ' Case "LS" - ' SQL_ = "SELECT tbl_IDS_Rechenwerte.ID as ID,tbl_IDS_Rechenwerte.OutletCountryCode, tbl_IDS_Länder.OutletCountry, tbl_IDS_Rechenwerte.OutletCode, tbl_IDS_Stationen.OutletName,tbl_IDS_Rechenwerte.ProductTypeCode, tbl_IDS_Produkte.ProductDescription, tbl_IDS_Rechenwerte.Rechenwert, tbl_IDS_Rechenwerte.Kz, tbl_IDS_Rechenwerte.KategorieNr, tbl_IDS_Rechenwerte.Zeitstempel, tbl_IDS_Rechenwerte.Sachbearbeiter - ' FROM tbl_IDS_Produkte - ' INNER JOIN (tbl_IDS_Länder - ' INNER JOIN (tbl_IDS_Stationen - ' INNER JOIN tbl_IDS_Rechenwerte ON (tbl_IDS_Stationen.OutletCountryCode = tbl_IDS_Rechenwerte.OutletCountryCode) AND (tbl_IDS_Stationen.OutletCode = tbl_IDS_Rechenwerte.OutletCode)) ON tbl_IDS_Länder.OutletCountryCode = tbl_IDS_Rechenwerte.OutletCountryCode) - ' ON tbl_IDS_Produkte.ProductTypeCode = tbl_IDS_Rechenwerte.ProductTypeCode - ' WHERE (((tbl_IDS_Rechenwerte.OutletCode) Is Not Null) AND ((tbl_IDS_Rechenwerte.CustomerCode) Is Null) " & IIf(OutletCountryCode > 0, " AND tbl_IDS_Rechenwerte.OutletCountryCode = " & OutletCountryCode & ") ", ") ") & SQL_WHERE & " - ' ORDER BY tbl_IDS_Länder.OutletCountry, tbl_IDS_Rechenwerte.OutletCountryCode, tbl_IDS_Stationen.OutletName, tbl_IDS_Rechenwerte.OutletCode, tbl_IDS_Produkte.ProductDescription, tbl_IDS_Rechenwerte.ProductTypeCode;" + Case "LS" + SQL_ = "SELECT tbl_IDS_Rechenwerte.ID as ID,tbl_IDS_Rechenwerte.OutletCountryCode, tbl_IDS_Länder.OutletCountry, tbl_IDS_Rechenwerte.OutletCode, tbl_IDS_Stationen.OutletName,tbl_IDS_Rechenwerte.ProductTypeCode, tbl_IDS_Produkte.ProductDescription, tbl_IDS_Rechenwerte.Rechenwert, tbl_IDS_Rechenwerte.Kz, tbl_IDS_Rechenwerte.KategorieNr, tbl_IDS_Rechenwerte.Zeitstempel, tbl_IDS_Rechenwerte.Sachbearbeiter + FROM tbl_IDS_Produkte + INNER JOIN (tbl_IDS_Länder + INNER JOIN (tbl_IDS_Stationen + INNER JOIN tbl_IDS_Rechenwerte ON (tbl_IDS_Stationen.OutletCountryCode = tbl_IDS_Rechenwerte.OutletCountryCode) AND (tbl_IDS_Stationen.OutletCode = tbl_IDS_Rechenwerte.OutletCode)) ON tbl_IDS_Länder.OutletCountryCode = tbl_IDS_Rechenwerte.OutletCountryCode) + ON tbl_IDS_Produkte.ProductTypeCode = tbl_IDS_Rechenwerte.ProductTypeCode + WHERE (((tbl_IDS_Rechenwerte.OutletCode) Is Not Null) AND ((tbl_IDS_Rechenwerte.CustomerCode) Is Null) " & IIf(OutletCountryCode > 0, " AND tbl_IDS_Rechenwerte.OutletCountryCode = " & OutletCountryCode & ") ", ") ") & SQL_WHERE & " + ORDER BY tbl_IDS_Länder.OutletCountry, tbl_IDS_Rechenwerte.OutletCountryCode, tbl_IDS_Stationen.OutletName, tbl_IDS_Rechenwerte.OutletCode, tbl_IDS_Produkte.ProductDescription, tbl_IDS_Rechenwerte.ProductTypeCode;" - ' Case "LK" - ' FUNC.dgvCellToCbo(dgvOfferteDetails, 1, "OutletCountryCode", "OutletCountryCode", " SELECT [OutletCountryCode], OutletCountry FROM [tbl_IDS_Länder] ORDER BY OutletCountry ", "FMZOLL", 150) - ' 'FUNC.dgvCellToCbo(dgvOfferteDetails, 5, "BGebLeist.", "BGebLeistungsNr", " SELECT [LeistungsNr], CAST(LeistungsNr as varchar(3)) + ' - ' + [LeistungsBez] as LeistungsBez FROM [Leistungen] ORDER BY [LeistungsNr] ", "FMZOLL", 250) + Case "LK" - ' Case "LSK" - ' SQL_ = "SELECT tbl_IDS_Rechenwerte.ID as ID,tbl_IDS_Rechenwerte.OutletCountryCode, tbl_IDS_Länder.OutletCountry,tbl_IDS_Rechenwerte.OutletCode, tbl_IDS_Stationen.OutletName, tbl_IDS_Rechenwerte.CustomerCode,Adressen.Ordnungsbegriff AS CustomerName, tbl_IDS_Rechenwerte.ProductTypeCode, tbl_IDS_Produkte.ProductDescription, tbl_IDS_Rechenwerte.Rechenwert, tbl_IDS_Rechenwerte.Kz, tbl_IDS_Rechenwerte.KategorieNr, tbl_IDS_Rechenwerte.Zeitstempel, tbl_IDS_Rechenwerte.Sachbearbeiter - ' FROM tbl_IDS_Produkte INNER JOIN (tbl_IDS_Länder INNER JOIN (Adressen INNER JOIN (tbl_IDS_Stationen INNER JOIN tbl_IDS_Rechenwerte ON (tbl_IDS_Stationen.OutletCountryCode = tbl_IDS_Rechenwerte.OutletCountryCode) AND (tbl_IDS_Stationen.OutletCode = tbl_IDS_Rechenwerte.OutletCode)) ON Adressen.AdressenNr = tbl_IDS_Rechenwerte.CustomerCode) ON tbl_IDS_Länder.OutletCountryCode = tbl_IDS_Rechenwerte.OutletCountryCode) ON tbl_IDS_Produkte.ProductTypeCode = tbl_IDS_Rechenwerte.ProductTypeCode - ' WHERE (((tbl_IDS_Rechenwerte.OutletCode) Is Not Null) AND ((tbl_IDS_Rechenwerte.CustomerCode) Is Not Null) " & IIf(OutletCountryCode > 0, " AND tbl_IDS_Rechenwerte.OutletCountryCode = " & OutletCountryCode & ") ", ") ") & SQL_WHERE & " - ' ORDER BY tbl_IDS_Länder.OutletCountry, tbl_IDS_Rechenwerte.OutletCountryCode, tbl_IDS_Stationen.OutletName, tbl_IDS_Rechenwerte.OutletCode, Adressen.Ordnungsbegriff, tbl_IDS_Rechenwerte.CustomerCode, tbl_IDS_Produkte.ProductDescription, tbl_IDS_Rechenwerte.ProductTypeCode;" + FUNC.dgvCellToCbo(dgvOfferteDetails, 1, "OutletCountryCode", "OutletCountryCode", " SELECT [OutletCountryCode], OutletCountry FROM [tbl_IDS_Länder] ORDER BY OutletCountry ", "FMZOLL", 150) + 'FUNC.dgvCellToCbo(dgvOfferteDetails, 5, "BGebLeist.", "BGebLeistungsNr", " SELECT [LeistungsNr], CAST(LeistungsNr as varchar(3)) + ' - ' + [LeistungsBez] as LeistungsBez FROM [Leistungen] ORDER BY [LeistungsNr] ", "FMZOLL", 250) - ' Case "KRW" - ' SQL_ = "SELECT tbl_IDS_Kategorien_Rechenwerte.ID as ID, tbl_IDS_Kategorien_Rechenwerte.KategorieNr, tbl_IDS_Kategorien_Rechenwerte.ProductTypeCode, tbl_IDS_Produkte.ProductDescription, tbl_IDS_Kategorien_Rechenwerte.Rechenwert, tbl_IDS_Kategorien_Rechenwerte.Zeitstempel, tbl_IDS_Kategorien_Rechenwerte.Sachbearbeiter - ' FROM tbl_IDS_Produkte INNER JOIN tbl_IDS_Kategorien_Rechenwerte ON tbl_IDS_Produkte.ProductTypeCode = tbl_IDS_Kategorien_Rechenwerte.ProductTypeCode - ' WHERE 1 = 1 " & SQL_WHERE & " - ' ORDER BY tbl_IDS_Kategorien_Rechenwerte.KategorieNr, tbl_IDS_Kategorien_Rechenwerte.ProductTypeCode;" + Case "LSK" + SQL_ = "SELECT tbl_IDS_Rechenwerte.ID as ID,tbl_IDS_Rechenwerte.OutletCountryCode, tbl_IDS_Länder.OutletCountry,tbl_IDS_Rechenwerte.OutletCode, tbl_IDS_Stationen.OutletName, tbl_IDS_Rechenwerte.CustomerCode,Adressen.Ordnungsbegriff AS CustomerName, tbl_IDS_Rechenwerte.ProductTypeCode, tbl_IDS_Produkte.ProductDescription, tbl_IDS_Rechenwerte.Rechenwert, tbl_IDS_Rechenwerte.Kz, tbl_IDS_Rechenwerte.KategorieNr, tbl_IDS_Rechenwerte.Zeitstempel, tbl_IDS_Rechenwerte.Sachbearbeiter + FROM tbl_IDS_Produkte INNER JOIN (tbl_IDS_Länder INNER JOIN (Adressen INNER JOIN (tbl_IDS_Stationen INNER JOIN tbl_IDS_Rechenwerte ON (tbl_IDS_Stationen.OutletCountryCode = tbl_IDS_Rechenwerte.OutletCountryCode) AND (tbl_IDS_Stationen.OutletCode = tbl_IDS_Rechenwerte.OutletCode)) ON Adressen.AdressenNr = tbl_IDS_Rechenwerte.CustomerCode) ON tbl_IDS_Länder.OutletCountryCode = tbl_IDS_Rechenwerte.OutletCountryCode) ON tbl_IDS_Produkte.ProductTypeCode = tbl_IDS_Rechenwerte.ProductTypeCode + WHERE (((tbl_IDS_Rechenwerte.OutletCode) Is Not Null) AND ((tbl_IDS_Rechenwerte.CustomerCode) Is Not Null) " & IIf(OutletCountryCode > 0, " AND tbl_IDS_Rechenwerte.OutletCountryCode = " & OutletCountryCode & ") ", ") ") & SQL_WHERE & " + ORDER BY tbl_IDS_Länder.OutletCountry, tbl_IDS_Rechenwerte.OutletCountryCode, tbl_IDS_Stationen.OutletName, tbl_IDS_Rechenwerte.OutletCode, Adressen.Ordnungsbegriff, tbl_IDS_Rechenwerte.CustomerCode, tbl_IDS_Produkte.ProductDescription, tbl_IDS_Rechenwerte.ProductTypeCode;" + + Case "KRW" + SQL_ = "SELECT tbl_IDS_Kategorien_Rechenwerte.ID as ID, tbl_IDS_Kategorien_Rechenwerte.KategorieNr, tbl_IDS_Kategorien_Rechenwerte.ProductTypeCode, tbl_IDS_Produkte.ProductDescription, tbl_IDS_Kategorien_Rechenwerte.Rechenwert, tbl_IDS_Kategorien_Rechenwerte.Zeitstempel, tbl_IDS_Kategorien_Rechenwerte.Sachbearbeiter + FROM tbl_IDS_Produkte INNER JOIN tbl_IDS_Kategorien_Rechenwerte ON tbl_IDS_Produkte.ProductTypeCode = tbl_IDS_Kategorien_Rechenwerte.ProductTypeCode + WHERE 1 = 1 " & SQL_WHERE & " + ORDER BY tbl_IDS_Kategorien_Rechenwerte.KategorieNr, tbl_IDS_Kategorien_Rechenwerte.ProductTypeCode;" - ' Case "KOR" - ' SQL_ = "SELECT tbl_IDS_Kunden_ohne_Rabatt.CustomerCode, tbl_IDS_Kunden_ohne_Rabatt.Zeitstempel, tbl_IDS_Kunden_ohne_Rabatt.Sachbearbeiter - ' FROM tbl_IDS_Kunden_ohne_Rabatt - ' WHERE 1 = 1 " & SQL_WHERE & " - ' ORDER BY tbl_IDS_Kunden_ohne_Rabatt.CustomerCode;" + Case "KOR" + SQL_ = "SELECT tbl_IDS_Kunden_ohne_Rabatt.CustomerCode, tbl_IDS_Kunden_ohne_Rabatt.Zeitstempel, tbl_IDS_Kunden_ohne_Rabatt.Sachbearbeiter + FROM tbl_IDS_Kunden_ohne_Rabatt + WHERE 1 = 1 " & SQL_WHERE & " + ORDER BY tbl_IDS_Kunden_ohne_Rabatt.CustomerCode;" - 'End Select + End Select End If @@ -514,8 +515,8 @@ Public Class usrCntlIDSPreise Case "LK" Select Case dgvOfferteDetails.CurrentCell.ColumnIndex - ' Case 1 : If dgvOfferteDetails.CurrentCell.Value IsNot Nothing AndAlso IsNumeric(dgvOfferteDetails.CurrentCell.Value) Then currentIDS.OutletCode = CInt(dgvOfferteDetails.CurrentCell.Value) - ' Case 2 : If dgvOfferteDetails.CurrentCell.Value IsNot Nothing AndAlso dgvOfferteDetails.CurrentCell.Value <> "" Then dgvOfferteDetails.CurrentRow.Cells("").Value = + Case 1 : If dgvOfferteDetails.CurrentCell.Value IsNot Nothing AndAlso IsNumeric(dgvOfferteDetails.CurrentCell.Value) Then currentIDS.OutletCode = CInt(dgvOfferteDetails.CurrentCell.Value) + 'Case 2 : If dgvOfferteDetails.CurrentCell.Value IsNot Nothing AndAlso dgvOfferteDetails.CurrentCell.Value <> "" Then dgvOfferteDetails.CurrentRow.Cells("").Value = Case 5 : If dgvOfferteDetails.CurrentCell.Value IsNot Nothing AndAlso IsNumeric(dgvOfferteDetails.CurrentCell.Value) Then currentIDS.Rechenwert = CDbl(dgvOfferteDetails.CurrentCell.Value) Case 6 : If dgvOfferteDetails.CurrentCell.Value IsNot Nothing AndAlso dgvOfferteDetails.CurrentCell.Value <> "" AndAlso (dgvOfferteDetails.CurrentCell.Value = "R" Or dgvOfferteDetails.CurrentCell.Value = "P") Then currentIDS.Kz = dgvOfferteDetails.CurrentCell.Value.ToString End Select @@ -762,7 +763,7 @@ Public Class usrCntlIDSPreise Else - 'currentIDS = New cIDSDieselpreisRW() + currentIDS = New cIDSDieselpreisRW() End If diff --git a/VERAG_PROG_ALLGEMEIN/Schnittstellen/Creditsafe/cCreditSafeAPI.vb b/VERAG_PROG_ALLGEMEIN/Schnittstellen/Creditsafe/cCreditSafeAPI.vb index 35a6f83a..ff895f01 100644 --- a/VERAG_PROG_ALLGEMEIN/Schnittstellen/Creditsafe/cCreditSafeAPI.vb +++ b/VERAG_PROG_ALLGEMEIN/Schnittstellen/Creditsafe/cCreditSafeAPI.vb @@ -5,6 +5,7 @@ Imports System.Net Imports System.Reflection Imports System.Text.RegularExpressions Imports System.Threading +Imports VERAG_PROG_ALLGEMEIN.TESTJSON Public Class cCreditSafeAPI @@ -97,7 +98,7 @@ Public Class cCreditSafeAPI - Shared Function SendGetRequestWithAuthHeader(url As String, company As Company, acceptContentType As String, method As String, authenticationToken As String, ByRef failureDesc As String, Optional isMonitoring As Boolean = False, Optional csvImport As Boolean = False, Optional csvFile As String = "") As String + Shared Function SendGetRequestWithAuthHeader(url As String, company As Company, acceptContentType As String, method As String, authenticationToken As String, ByRef failureDesc As String, Optional isMonitoring As Boolean = False, Optional csvImport As Boolean = False, Optional csvFile As String = "", Optional notifEvents As Boolean = False, Optional page As Integer = 0) As String Try VERAG_PROG_ALLGEMEIN.cChilkat_Helper.UnlockCilkat() @@ -118,9 +119,9 @@ Public Class cCreditSafeAPI rest.ClearAllQueryParams() - If company IsNot Nothing AndAlso Not isMonitoring Then + If company IsNot Nothing Then - setSearchParam(rest, company) + setSearchParam(rest, company, isMonitoring, notifEvents, page) End If @@ -175,7 +176,7 @@ Public Class cCreditSafeAPI End If - Else + ElseIf Not notifEvents Then Dim json As New Chilkat.JsonObject success = json.UpdateString("id", company.creditSafeId) @@ -207,6 +208,7 @@ Public Class cCreditSafeAPI End If + End If End If @@ -340,7 +342,6 @@ Public Class cCreditSafeAPI End Function - Shared Function AddCompaniesCSVToPortfolio(csvFilePath As String, sync As Boolean, Optional PortfolioID As String = "1662419") As String Dim myUri As String = API_STRING & "/v1/monitoring/portfolios/" & PortfolioID & IIf(sync, "/sync", "/import") 'Default @@ -471,7 +472,7 @@ Public Class cCreditSafeAPI End Function - Shared Function getCompanyEvents(company As Company, ByRef dtEvents As DataTable, Optional checklastChecked As Boolean = False, Optional updateKunden As Boolean = False, Optional showError As Boolean = False, Optional getTotalNr As Boolean = False, Optional setzeKundenbesonderheiten As Boolean = False, Optional sendMail As Boolean = False) As String + Shared Function getCompanyEvents(company As Company, ByRef dtEvents As DataTable, ByRef companyDetailEvents As Boolean, ByRef maxPages As Integer, Optional checklastChecked As Boolean = False, Optional updateKunden As Boolean = False, Optional showError As Boolean = False, Optional getTotalNr As Boolean = False, Optional setzeKundenbesonderheiten As Boolean = False, Optional sendMail As Boolean = False, Optional firma As String = "VERAG", Optional page As Integer = 0) As String 'rest.AddQueryParam("from", Today().AddDays(-1)) @@ -485,8 +486,17 @@ Public Class cCreditSafeAPI End If Dim failureDesc As String - Dim myUrl As String = API_STRING & "/v1/monitoring/companies/" & company.creditSafeId & "/events" & IIf(checklastChecked, "?startDate=" & checkDate, "") - Dim jsonRespString = SendGetRequestWithAuthHeader(myUrl, company, "application/json", "GET", token, failureDesc) + + Dim myUrl As String = "" + + If Not companyDetailEvents Then + myUrl = API_STRING & "/v1/monitoring/portfolios/1662419/notificationEvents" + Else + myUrl = API_STRING & "/v1/monitoring/companies/" & company.creditSafeId & "/events" & IIf(checklastChecked, "?startDate=" & checkDate, "") + End If + + + Dim jsonRespString = SendGetRequestWithAuthHeader(myUrl, company, "application/json", "GET", token, failureDesc, Not companyDetailEvents,,, Not companyDetailEvents, page) If failureDesc <> "" Then If showError Then MsgBox(failureDesc) @@ -525,6 +535,15 @@ Public Class cCreditSafeAPI Return "data not found." End If + + Dim pagination As Chilkat.JsonObject = json.ObjectOf("pagination") + If Not (json.LastMethodSuccess = False) Then + Dim Lastpage As String = pagination.StringOf("last") + If IsNumeric(Lastpage) Then maxPages = Lastpage + End If + + + Dim numCompanies As Integer = companieData.Size Dim defaultCL As Double = -10000000 @@ -566,84 +585,51 @@ Public Class cCreditSafeAPI R("eventDate") = dateTime.GetAsTimestamp(getAsLocal) R("createdDate") = dateTime.GetAsTimestamp(getAsLocal) + If IsDBNull(R("companyId")) Then + Dim compObjHead As Chilkat.JsonObject = compObj.ObjectOf("company") + R("companyId") = compObjHead.StringOf("id") + If IsDBNull(R("portfolioId")) Then R("portfolioId") = compObjHead.StringOf("portfolioId") + End If + dtEvents.Rows.Add(R) - Dim cEvent As New cCreditsafeEvent(CLng(R("eventId")), company.kdNr) - - cEvent.eventId = R("eventId") - cEvent.companyId = R("companyId") - cEvent.portfolioId = R("portfolioId") - cEvent.ruleName = R("ruleName") - cEvent.localEventCode = R("localEventCode").trim() - cEvent.globalEventCode = R("globalEventCode").trim() - cEvent.eventDate = R("eventDate") - cEvent.createdDate = R("createdDate") - cEvent.importDate = Now() - cEvent.Sachbearbeiter = IIf(VERAG_PROG_ALLGEMEIN.cAllgemein.USRKURZNAME Is Nothing, "AUTO", VERAG_PROG_ALLGEMEIN.cAllgemein.USRKURZNAME) - cEvent.oldValue = R("oldValue") - cEvent.newValue = R("newValue") + Dim dtKundenNr As New DataTable + If company.kdNr = 0 Then + dtKundenNr = SQL.loadDgvBySql("select distinct(ba_KundenNr),f.Firma from Kunden + inner join tblKundenErweitert on Kunden.KundenNr = kde_KundenNr + inner join Filialen as f on f.FilialenNr = Kunden.FilialenNr + inner join tblBonitaetsauskunft on ba_KundenNr = kde_KundenNr + where isnull(tblKundenErweitert.kde_CreditSaveId,'') ='" & R("companyId") & "'", "FMZOLL") - 'OLD-VALUES - If cEvent.oldValue IsNot Nothing AndAlso IsNumeric(cEvent.oldValue) AndAlso Not cEvent.oldValue.ToString.Contains("€") Then - If cEvent.localEventCode = "CL" Or cEvent.globalEventCode = "CL" Then - cEvent.oldValueCL = cEvent.oldValue - ElseIf cEvent.localEventCode = "CR" Or cEvent.globalEventCode = "CR" Then - cEvent.oldValueCR = cEvent.oldValue - cEvent.oldValueCRIndex = calculatedBonIndexFromBonScore(cEvent.oldValue, cEvent.oldRiskClass) - End If + End If + + If dtKundenNr.Rows.Count > 0 Then + + For Each row As DataRow In dtKundenNr.Rows + company.kdNr = row("ba_KundenNr") + company.creditSafeId = R("companyId") + firma = row("Firma") + Dim currentBonID As String = (New SQL).getValueTxtBySql("Select Top(1) isnull(ba_id, -1) FROM [tblBonitaetsauskunft] where ba_KundenNr = " & company.kdNr & " AND [ba_Pruefungstool] = 'creditsafe API' ORDER BY ba_Datum DESC", "FMZOLL") + If currentBonID <> "" AndAlso IsNumeric(currentBonID) AndAlso currentBonID > 0 Then + company.csBonID = currentBonID + End If + createEvents(R, company.kdNr, company, CL, CR, CL_Datum, CR_Datum) + updateKundenWithEvent(company, CL, CR, CL_Datum, CR_Datum, setzeKundenbesonderheiten, defaultCR, defaultCL, updateKunden, sendMail, firma) + Next + + company.kdNr = 0 'wichtig, wieder zurücksetzen! Else - If cEvent.localEventCode = "CL" Or cEvent.globalEventCode = "CL" Then - cEvent.oldValue = Regex.Replace(cEvent.oldValue, "\s+", "") - cEvent.oldValue = Regex.Replace(cEvent.oldValue, "[^\d]", "") - cEvent.oldValueCL = cEvent.oldValue - ElseIf cEvent.localEventCode = "CR" Or cEvent.globalEventCode = "CR" Then - cEvent.oldValue = Regex.Replace(cEvent.oldValue, "\s+", "") - cEvent.oldValue = Regex.Replace(cEvent.oldValue, "[^\d]", "") - cEvent.oldValueCR = cEvent.oldValue - cEvent.oldValueCRIndex = calculatedBonIndexFromBonScore(cEvent.oldValue, cEvent.oldRiskClass) + + If company.kdNr <> 0 Then + createEvents(R, company.kdNr, company, CL, CR, CL_Datum, CR_Datum) End If End If - - 'NEW-VALUES - If cEvent.newValue IsNot Nothing AndAlso IsNumeric(cEvent.newValue) AndAlso Not cEvent.newValue.ToString.Contains("€") Then - If cEvent.localEventCode = "CL" Or cEvent.globalEventCode = "CL" Then - cEvent.newValueCL = cEvent.newValue - setCL_CR_Entry(CDate(cEvent.eventDate), "CL", cEvent.newValueCL, CL, CR, CL_Datum, CR_Datum) - ElseIf cEvent.localEventCode = "CR" Or cEvent.globalEventCode = "CR" Then - cEvent.newValueCR = cEvent.newValue - cEvent.newValueCRIndex = calculatedBonIndexFromBonScore(cEvent.newValue, cEvent.newRiskClass) - setCL_CR_Entry(CDate(cEvent.eventDate), "CR", cEvent.newValueCR, CL, CR, CL_Datum, CR_Datum) - End If - Else - - If cEvent.localEventCode = "CL" Or cEvent.globalEventCode = "CL" Then - cEvent.newValue = Regex.Replace(cEvent.newValue, "\s+", "") - cEvent.newValue = Regex.Replace(cEvent.newValue, "[^\d]", "") - cEvent.newValueCL = cEvent.newValue - setCL_CR_Entry(CDate(cEvent.eventDate), "CL", cEvent.newValueCL, CL, CR, CL_Datum, CR_Datum) - - ElseIf cEvent.localEventCode = "CR" Or cEvent.globalEventCode = "CR" Then - cEvent.newValue = Regex.Replace(cEvent.newValue, "\s+", "") - cEvent.newValue = Regex.Replace(cEvent.newValue, "[^\d]", "") - cEvent.newValueCR = cEvent.newValue - cEvent.newValueCRIndex = calculatedBonIndexFromBonScore(cEvent.newValue, cEvent.newRiskClass) - setCL_CR_Entry(CDate(cEvent.eventDate), "CR", cEvent.newValueCR, CL, CR, CL_Datum, CR_Datum) - End If - - End If - - If cEvent.bonId Is Nothing AndAlso company.csBonID > 0 Then - cEvent.bonId = company.csBonID - End If - - cEvent.kundenNr = company.kdNr - cEvent.SAVE() - j = j + 1 + End While 'Next @@ -654,6 +640,15 @@ Public Class cCreditSafeAPI 'viewEvents = New DataView(dtEvents, "localEventCode IN ('CL','CR') or e.globalEventCode IN ('CL','CR')", "", DataViewRowState.CurrentRows) End If + If company.kdNr <> 0 AndAlso companyDetailEvents Then updateKundenWithEvent(company, CL, CR, CL_Datum, CR_Datum, setzeKundenbesonderheiten, defaultCR, defaultCL, updateKunden, sendMail, firma) + + + Return "Anzahl gefundener Datensätze: " & numCompanies + + End Function + + Private Shared Sub updateKundenWithEvent(company As Company, CL As Integer, CR As Integer, CL_Datum As Date, CR_Datum As Date, setzeKundenbesonderheiten As Boolean, defaultCR As Integer, defaultCL As Integer, updateKunden As Boolean, sendMail As Boolean, Optional firma As String = "VERAG") + Dim triggerMail As Boolean = False If company.kdNr > 0 AndAlso (CR <> -1000000 Or CL <> -1000000) Then @@ -699,6 +694,10 @@ Public Class cCreditSafeAPI End If End If + If company.BANKRUPT_REGISTERED Then + createInfo("BANKRUPT_REGISTERED", KUNDE_ERW, KUNDE, CL, riskClass, Mailtext, triggerMail, setzeKundenbesonderheiten, company) + End If + If updateKunden Then KUNDE_ERW.SAVE() End If @@ -706,15 +705,119 @@ Public Class cCreditSafeAPI If triggerMail AndAlso sendMail Then Dim ADR As New cAdressen(KUNDE.KundenNr) - VERAG_PROG_ALLGEMEIN.cProgramFunctions.sendMail(IIf(VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM, "d.breimaier@verag.ag", "as@verag.ag"), IIf(VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM, "TEST-", "") & "CREDITSAFE " & KUNDE.KundenNr, "Änderungen der Creditsafe-Daten von Kunden " & KUNDE.KundenNr & " " & ADR.Ordnungsbegriff & Mailtext.ToString & "

" & "*Automatic generated e-mail*",,,,, "d.breimaier@verag.ag") + Dim empfanegerMail = IIf(VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM, "d.breimaier@verag.ag", "as@verag.ag") + If Not VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM Then + Select Case firma + Case "VERAG" : empfanegerMail = "as@verag.ag" + Case "IMEX" : empfanegerMail = "Viktoria.Leirich@imex-group.at" + Case "AMBAR" : empfanegerMail = "Buchhaltung@ambarlog.com" + Case "UNISPED" : empfanegerMail = "sabine.muehlboeck@unisped.at" + End Select + End If + VERAG_PROG_ALLGEMEIN.cProgramFunctions.sendMail(empfanegerMail, IIf(VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM, "TEST-", "") & "CREDITSAFE " & KUNDE.KundenNr, "Änderungen der Creditsafe-Daten von Kunden " & KUNDE.KundenNr & " " & ADR.Ordnungsbegriff & Mailtext.ToString & "

" & "*Automatic generated e-mail*",,,,, "d.breimaier@verag.ag") + End If + + End If + End Sub + + Private Shared Sub createEvents(R As DataRow, KundeNr As Integer, company As Company, CL As Integer, CR As Integer, ByRef CL_Datum As Date, ByRef CR_Datum As Date) + + + Dim cEvent As New cCreditsafeEvent(CLng(R("eventId")), KundeNr) + Dim globaleventcode As String = "" + + If Not IsDBNull(R("globalEventCode")) Then + globaleventcode = R("globalEventCode").trim() + ElseIf Not IsDBNull(R("localEventCode")) Then + Select Case R("localEventCode").trim() + Case "DECREASE_LIMIT", "INCREASE_LIMIT" : globaleventcode = "CL" + Case "DECREASE_RATING", "INCREASE_RATING" : globaleventcode = "CR" + End Select + End If + + + cEvent.eventId = R("eventId") + cEvent.companyId = R("companyId") + cEvent.portfolioId = R("portfolioId") + cEvent.ruleName = R("ruleName") + cEvent.localEventCode = R("localEventCode").trim() + cEvent.globalEventCode = globaleventcode + cEvent.eventDate = R("eventDate") + cEvent.createdDate = R("createdDate") + cEvent.importDate = Now() + cEvent.Sachbearbeiter = IIf(VERAG_PROG_ALLGEMEIN.cAllgemein.USRKURZNAME Is Nothing, "AUTO", VERAG_PROG_ALLGEMEIN.cAllgemein.USRKURZNAME) + cEvent.oldValue = R("oldValue") + cEvent.newValue = R("newValue") + + + 'OLD-VALUES + If cEvent.oldValue IsNot Nothing AndAlso IsNumeric(cEvent.oldValue) AndAlso Not cEvent.oldValue.ToString.Contains("€") Then + If cEvent.localEventCode = "CL" Or cEvent.globalEventCode = "CL" Then + cEvent.oldValueCL = cEvent.oldValue + ElseIf cEvent.localEventCode = "CR" Or cEvent.globalEventCode = "CR" Then + cEvent.oldValueCR = cEvent.oldValue + cEvent.oldValueCRIndex = calculatedBonIndexFromBonScore(cEvent.oldValue, cEvent.oldRiskClass) + End If + + Else + If cEvent.localEventCode = "CL" Or cEvent.globalEventCode = "CL" Then + cEvent.oldValue = Regex.Replace(cEvent.oldValue, "\s+", "") + cEvent.oldValue = Regex.Replace(cEvent.oldValue, "[^\d]", "") + cEvent.oldValueCL = cEvent.oldValue + ElseIf cEvent.localEventCode = "CR" Or cEvent.globalEventCode = "CR" Then + cEvent.oldValue = Regex.Replace(cEvent.oldValue, "\s+", "") + cEvent.oldValue = Regex.Replace(cEvent.oldValue, "[^\d]", "") + cEvent.oldValueCR = cEvent.oldValue + cEvent.oldValueCRIndex = calculatedBonIndexFromBonScore(cEvent.oldValue, cEvent.oldRiskClass) End If End If - Return "Anzahl gefundener Datensätze: " & numCompanies + 'NEW-VALUES + If cEvent.newValue IsNot Nothing AndAlso IsNumeric(cEvent.newValue) AndAlso Not cEvent.newValue.ToString.Contains("€") Then + If cEvent.localEventCode = "CL" Or cEvent.globalEventCode = "CL" Then + cEvent.newValueCL = cEvent.newValue + setCL_CR_Entry(CDate(cEvent.eventDate), "CL", cEvent.newValueCL, CL, CR, CL_Datum, CR_Datum) + ElseIf cEvent.localEventCode = "CR" Or cEvent.globalEventCode = "CR" Then + cEvent.newValueCR = cEvent.newValue + cEvent.newValueCRIndex = calculatedBonIndexFromBonScore(cEvent.newValue, cEvent.newRiskClass) + setCL_CR_Entry(CDate(cEvent.eventDate), "CR", cEvent.newValueCR, CL, CR, CL_Datum, CR_Datum) + End If + Else + + If cEvent.localEventCode = "CL" Or cEvent.globalEventCode = "CL" Then + cEvent.newValue = Regex.Replace(cEvent.newValue, "\s+", "") + cEvent.newValue = Regex.Replace(cEvent.newValue, "[^\d]", "") + cEvent.newValueCL = cEvent.newValue + setCL_CR_Entry(CDate(cEvent.eventDate), "CL", cEvent.newValueCL, CL, CR, CL_Datum, CR_Datum) + + ElseIf cEvent.localEventCode = "CR" Or cEvent.globalEventCode = "CR" Then + cEvent.newValue = Regex.Replace(cEvent.newValue, "\s+", "") + cEvent.newValue = Regex.Replace(cEvent.newValue, "[^\d]", "") + cEvent.newValueCR = cEvent.newValue + cEvent.newValueCRIndex = calculatedBonIndexFromBonScore(cEvent.newValue, cEvent.newRiskClass) + setCL_CR_Entry(CDate(cEvent.eventDate), "CR", cEvent.newValueCR, CL, CR, CL_Datum, CR_Datum) + End If + + End If + + If cEvent.localEventCode = "BANKRUPT_REGISTERED" Or cEvent.globalEventCode = "PR" Then + setBANCKRUPT_Entry(company, cEvent.eventDate) + End If + + If cEvent.bonId Is Nothing AndAlso company.csBonID > 0 Then + cEvent.bonId = company.csBonID + End If + + cEvent.kundenNr = company.kdNr + cEvent.SAVE() + + + + End Sub + - End Function Private Shared Sub setCL_CR_Entry(ByVal cs_date As Date, ByVal type As String, ByRef value As Object, ByRef CL As Double, ByRef CR As Integer, ByRef CL_Datum As Date, ByRef CR_Datum As Date) @@ -727,7 +830,9 @@ Public Class cCreditSafeAPI saveCR = True End If - If saveCR AndAlso IsNumeric(value) Then CR = value + If saveCR AndAlso IsNumeric(value) Then + CR = value + End If Case "CL" Dim saveCL As Boolean = False @@ -736,12 +841,24 @@ Public Class cCreditSafeAPI saveCL = True End If - If saveCL AndAlso IsNumeric(value) Then CL = value + If saveCL AndAlso IsNumeric(value) Then + CL = value + End If End Select End Sub + Private Shared Sub setBANCKRUPT_Entry(company As Company, ByVal BK_date As Date) + + If company.kdNr > 0 Then + company.BANKRUPT_REGISTERED = True + company.BANKRUPT_REGISTERED_DATE = BK_date + End If + + + End Sub + Shared Function getReport(ByRef company As Company, withPDF As Boolean) As String 'Shared Function getReport(ByRef company As Company, withPDF As Boolean, ByRef bytes As Byte()) As String Dim failureDesc As String = "" Dim myUrl As String = API_STRING & "/v1/companies/" & company.creditSafeId & "/" @@ -1019,30 +1136,58 @@ Public Class cCreditSafeAPI End Function - Shared Sub setSearchParam(ByRef rest As Chilkat.Rest, ByRef company As Company) + Shared Sub setSearchParam(ByRef rest As Chilkat.Rest, ByRef company As Company, ByRef isMonitoring As Boolean, isNotEvent As Boolean, Optional page As Integer = 0) + + If company IsNot Nothing Then + + If isMonitoring Then + + If isNotEvent Then + + rest.AddQueryParam("sortBy", "companyName") + rest.AddQueryParam("sortDir", "asc") + + If company.lastChecked >= Today.AddYears(-50) Then + + rest.AddQueryParam("startDate", company.lastChecked.ToString("yyyy-MM-ddTHH:mm:ss")) + rest.AddQueryParam("endDate", Now().ToString("yyyy-MM-ddTHH:mm:ss")) + rest.AddQueryParam("filterByCreatedDate", "true") + rest.AddQueryParam("pageSize", "1000") 'maximum + rest.AddQueryParam("page", page) + End If + + End If - rest.AddQueryParam("countries", company.country) - - - If company.creditsafeNo <> "" Then 'Eindeutiger Schlüssel - rest.AddQueryParam("safeNo", company.creditsafeNo) - - Else - If company.language <> "" Then rest.AddQueryParam("language", company.language) - - - If company.vatNo <> "" Then - rest.AddQueryParam("vatNo", company.vatNo) Else - If company.name <> "" Then rest.AddQueryParam("name", company.name) - If company.Street <> "" Then rest.AddQueryParam("street", company.Street) - If company.Postalcode <> "" Then rest.AddQueryParam("postCode", company.Postalcode) - If company.City <> "" Then rest.AddQueryParam("city", company.City) - End If + rest.AddQueryParam("countries", company.country) + + + If company.creditsafeNo <> "" Then 'Eindeutiger Schlüssel + rest.AddQueryParam("safeNo", company.creditsafeNo) + + Else + If company.language <> "" Then rest.AddQueryParam("language", company.language) + + + If company.vatNo <> "" Then + rest.AddQueryParam("vatNo", company.vatNo) + Else + If company.name <> "" Then rest.AddQueryParam("name", company.name) + If company.Street <> "" Then rest.AddQueryParam("street", company.Street) + If company.Postalcode <> "" Then rest.AddQueryParam("postCode", company.Postalcode) + If company.City <> "" Then rest.AddQueryParam("city", company.City) + End If + + End If + + + + End If End If + End Sub @@ -1196,7 +1341,7 @@ Public Class cCreditSafeAPI End Select End Function - Shared Sub createInfo(typ As String, kundeErw As cKundenErweitert, kunde As cKunde, newValue As Object, risikoklasse As String, ByRef mailText As String, ByRef triggerMail As Boolean, setzeKundeninfo As Boolean) + Shared Sub createInfo(typ As String, kundeErw As cKundenErweitert, kunde As cKunde, newValue As Object, risikoklasse As String, ByRef mailText As String, ByRef triggerMail As Boolean, setzeKundeninfo As Boolean, Optional company As Company = Nothing) Dim createInfo As Boolean = False @@ -1249,6 +1394,12 @@ Public Class cCreditSafeAPI createInfo = True triggerMail = True End If + + Case "BANKRUPT_REGISTERED" + createInfo = True + triggerMail = True + + End Select If Not createInfo Then Exit Sub @@ -1257,7 +1408,12 @@ Public Class cCreditSafeAPI Risk = " Risikoklasse: " & oldRiksClass & " -> " & risikoklasse End If - Dim textVermerk As String = "ACHTUNG, Veränderung des " & typ & " von " & oldValue.ToString & " auf " & newValue.ToString & " ( um " & changedInProzent.ToString("F2") & "% ) " & Risk + Dim textVermerk As String = "" + + Select Case typ + Case "B-INDEX", "B-SCORE", "KREDITLIMIT" : textVermerk &= "ACHTUNG, Veränderung des " & typ & " von " & oldValue.ToString & " auf " & newValue.ToString & " ( um " & changedInProzent.ToString("F2") & "% ) " & Risk + Case "BANKRUPT_REGISTERED" : textVermerk &= " KUNDE WURDE LAUT CREDITSAFE " & IIf(company IsNot Nothing, " AM " & company.BANKRUPT_REGISTERED_DATE.ToShortDateString, "") & " FÜR INSOLVENT ERKLÄRT " + End Select mailText &= "

" & textVermerk @@ -1343,6 +1499,8 @@ Public Class cCreditSafeAPI Public Property language As String Public Property csBank As String Public Property csBonID As Integer = -1 + Public Property BANKRUPT_REGISTERED As Boolean = False + Public Property BANKRUPT_REGISTERED_DATE As Date