From ea00c1783380987380837aa1e492e43b6cfaaf82 Mon Sep 17 00:00:00 2001 From: "d.breimaier" Date: Wed, 19 Apr 2023 17:42:49 +0200 Subject: [PATCH] Creditsafe-API --- SDL/Creditsafe/usrcntlCreditsafe.vb | 4 + SDL/SDL.vbproj | 2 +- SDL/kunden/frmBonitätsverlauf.vb | 69 +++++-- .../usrCntlKundenuebersicht.Designer.vb | 186 +++++++++--------- SDL/kunden/usrCntlKundenuebersicht.vb | 106 +++++++++- .../Classes/cBonitaetsauskunft.vb | 2 + .../Schnittstellen/cCreditSafeAPI.vb | 115 ++++++++++- 7 files changed, 354 insertions(+), 130 deletions(-) diff --git a/SDL/Creditsafe/usrcntlCreditsafe.vb b/SDL/Creditsafe/usrcntlCreditsafe.vb index e0ad5d7e..dfa751e7 100644 --- a/SDL/Creditsafe/usrcntlCreditsafe.vb +++ b/SDL/Creditsafe/usrcntlCreditsafe.vb @@ -32,6 +32,10 @@ Public Class usrcntlCreditsafe user = VERAG_PROG_ALLGEMEIN.cAllgemein.MITARBEITER.mit_CSuser pw = VERAG_PROG_ALLGEMEIN.cAllgemein.MITARBEITER.mit_CSpwd + 'Zugangsdaten hartcoded, da Webservice-User nicht Mitarbeiterabhängig ist!!! + user = "creditsafe@verag.ag" + pw = "^AZcBVTBUIHTT5SQ1C9OOH" + cbxLand.fillWithSQL(" SELECT [Länderverzeichnis für die Außenhandelsstatistik].LandKz,[Länderverzeichnis für die Außenhandelsstatistik].LandBez " & " FROM [Länderverzeichnis für die Außenhandelsstatistik] LEFT JOIN [Währungstabelle] ON [Länderverzeichnis für die Außenhandelsstatistik].LandNr = [Währungstabelle].[Währungsschlüssel] " & " WHERE ([Währungstabelle].[MitgliedslandEU] = 1) " & diff --git a/SDL/SDL.vbproj b/SDL/SDL.vbproj index 0203198b..066863b5 100644 --- a/SDL/SDL.vbproj +++ b/SDL/SDL.vbproj @@ -28,7 +28,7 @@ http://localhost/SDL/ true publish.htm - 2 + 3 1.0.0.%2a false true diff --git a/SDL/kunden/frmBonitätsverlauf.vb b/SDL/kunden/frmBonitätsverlauf.vb index 770b9fa6..1aff9e01 100644 --- a/SDL/kunden/frmBonitätsverlauf.vb +++ b/SDL/kunden/frmBonitätsverlauf.vb @@ -66,10 +66,26 @@ .Columns("ba_Sonstiges").Visible = False .Columns("ba_Umsatz").DefaultCellStyle.Format = "C2" .Columns("ba_Hoechstkredit").DefaultCellStyle.Format = "C2" + .Columns("ba_datenarchivId").Visible = False - For Each c As DataGridViewColumn In .Columns - c.HeaderText = c.Name.Replace("ba_", "") + Dim c As New DataGridViewImageColumn + c.Name = "PDF" : c.HeaderText = "Bericht" + c.Image = My.Resources.pdf_gray : c.ImageLayout = DataGridViewImageCellLayout.Zoom + c.Width = 40 : c.DefaultCellStyle.Padding = New Padding(2) : c.DefaultCellStyle.BackColor = Color.White + c.DefaultCellStyle.Tag = "PDF anzeigen" + .Columns.Add(c) + + + For Each r As DataGridViewRow In .Rows + If r.Cells("ba_datenarchivId").Value IsNot DBNull.Value AndAlso CInt(r.Cells("ba_datenarchivId").Value) > 0 Then + DirectCast(r.Cells("PDF"), DataGridViewImageCell).Value = My.Resources.pdf + End If Next + + For Each cc As DataGridViewColumn In .Columns + cc.HeaderText = cc.Name.Replace("ba_", "") + Next + If .RowCount = 0 Then Me.Cursor = Cursors.Default : Exit Sub End With End If @@ -93,24 +109,43 @@ Private Sub MyDatagridview1_CellDoubleClick(sender As Object, e As DataGridViewCellEventArgs) Handles MyDatagridview1.CellDoubleClick If e.RowIndex < 0 Then Exit Sub - If PARENT_USRCNTL IsNot Nothing Then - PARENT_USRCNTL.LoadValues(MyDatagridview1.Rows(e.RowIndex).Cells("ba_id").Value) - Me.Close() - ElseIf PARENT_FORMULARMANAGER IsNot Nothing Then - Dim found = False - For Each c In PARENT_FORMULARMANAGER.MyFlowLayoutPanel1.Controls - If c.GetType.ToString = GetType(usrcntlCreditreformBoniAuskunft).ToString Then - DirectCast(c, usrcntlCreditreformBoniAuskunft).LoadValues(MyDatagridview1.Rows(e.RowIndex).Cells("ba_id").Value) - found = True - End If - Next - If found Then Me.Close() : Exit Sub + If MyDatagridview1.Columns(e.ColumnIndex).Name = "PDF" Then + openPDF(sender, e) Else - Dim f As New frmFormulare - f.Show() - f.addForm("Boniteatsauskunft", {MyDatagridview1.Rows(e.RowIndex).Cells("ba_id").Value}) + + If PARENT_USRCNTL IsNot Nothing Then + PARENT_USRCNTL.LoadValues(MyDatagridview1.Rows(e.RowIndex).Cells("ba_id").Value) + Me.Close() + ElseIf PARENT_FORMULARMANAGER IsNot Nothing Then + Dim found = False + For Each c In PARENT_FORMULARMANAGER.MyFlowLayoutPanel1.Controls + If c.GetType.ToString = GetType(usrcntlCreditreformBoniAuskunft).ToString Then + DirectCast(c, usrcntlCreditreformBoniAuskunft).LoadValues(MyDatagridview1.Rows(e.RowIndex).Cells("ba_id").Value) + found = True + End If + Next + If found Then Me.Close() : Exit Sub + Else + Dim f As New frmFormulare + f.Show() + f.addForm("Boniteatsauskunft", {MyDatagridview1.Rows(e.RowIndex).Cells("ba_id").Value}) + + End If End If + + + + End Sub + + Private Sub openPDF(sender As Object, e As DataGridViewCellEventArgs) + + If MyDatagridview1.Rows(e.RowIndex).Cells("ba_datenarchivId").Value IsNot DBNull.Value AndAlso CInt(MyDatagridview1.Rows(e.RowIndex).Cells("ba_datenarchivId").Value) > 0 Then + + Dim DS As New VERAG_PROG_ALLGEMEIN.cDATENSERVER(MyDatagridview1.Rows(e.RowIndex).Cells("ba_datenarchivId").Value) + DS.OPEN_SINGLE(True) + End If + End Sub End Class \ No newline at end of file diff --git a/SDL/kunden/usrCntlKundenuebersicht.Designer.vb b/SDL/kunden/usrCntlKundenuebersicht.Designer.vb index 26bf15f8..9b0a93d5 100644 --- a/SDL/kunden/usrCntlKundenuebersicht.Designer.vb +++ b/SDL/kunden/usrCntlKundenuebersicht.Designer.vb @@ -23,19 +23,19 @@ Partial Class usrCntlKundenuebersicht Private Sub InitializeComponent() Me.components = New System.ComponentModel.Container() - Dim DataGridViewCellStyle13 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() - Dim DataGridViewCellStyle14 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() - Dim DataGridViewCellStyle15 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() - Dim DataGridViewCellStyle16 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() - Dim DataGridViewCellStyle17 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() - Dim DataGridViewCellStyle18 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() + Dim DataGridViewCellStyle1 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() + Dim DataGridViewCellStyle2 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() + Dim DataGridViewCellStyle3 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() + Dim DataGridViewCellStyle4 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() + Dim DataGridViewCellStyle5 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() + Dim DataGridViewCellStyle6 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(usrCntlKundenuebersicht)) - Dim DataGridViewCellStyle19 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() - Dim DataGridViewCellStyle20 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() - Dim DataGridViewCellStyle21 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() - Dim DataGridViewCellStyle22 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() - Dim DataGridViewCellStyle24 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() - Dim DataGridViewCellStyle23 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() + Dim DataGridViewCellStyle7 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() + Dim DataGridViewCellStyle8 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() + Dim DataGridViewCellStyle9 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() + Dim DataGridViewCellStyle10 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() + Dim DataGridViewCellStyle12 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() + Dim DataGridViewCellStyle11 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle() Me.cntxtAddVM = New System.Windows.Forms.ContextMenuStrip(Me.components) Me.DToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.btnExcel = New System.Windows.Forms.Button() @@ -84,7 +84,6 @@ Partial Class usrCntlKundenuebersicht Me.txtVorauskasse = New System.Windows.Forms.TextBox() Me.lblAviso = New System.Windows.Forms.TextBox() Me.Label2 = New System.Windows.Forms.Label() - Me.UsrCntlKundenBesonderheiten1 = New SDL.usrCntlKundenBesonderheiten() Me.lblAbfertigungsverbot = New System.Windows.Forms.Label() Me.Label45 = New System.Windows.Forms.Label() Me.txtSammelrechnung = New System.Windows.Forms.TextBox() @@ -110,6 +109,7 @@ Partial Class usrCntlKundenuebersicht Me.rtbAbf_Besonderheiten = New System.Windows.Forms.RichTextBox() Me.lblBesonderheiten = New System.Windows.Forms.Label() Me.Panel4 = New System.Windows.Forms.Panel() + Me.FlatButton2 = New VERAG_PROG_ALLGEMEIN.FlatButton() Me.btnCreditsafe = New System.Windows.Forms.Button() Me.FlatButton6 = New VERAG_PROG_ALLGEMEIN.FlatButton() Me.btnBonitaetBearbeiten = New VERAG_PROG_ALLGEMEIN.FlatButton() @@ -152,7 +152,6 @@ Partial Class usrCntlKundenuebersicht Me.PictureBox3 = New System.Windows.Forms.PictureBox() Me.PictureBox5 = New System.Windows.Forms.PictureBox() Me.tbKontaktSpez = New System.Windows.Forms.TabPage() - Me.ucKundenKontakte = New SDL.usrCntlKundenKontakte() Me.Label38 = New System.Windows.Forms.Label() Me.txtDebitorennr = New System.Windows.Forms.TextBox() Me.lblFwlFiskal = New System.Windows.Forms.LinkLabel() @@ -198,7 +197,6 @@ Partial Class usrCntlKundenuebersicht Me.Button8 = New System.Windows.Forms.Button() Me.Button9 = New System.Windows.Forms.Button() Me.tbAvisoMail = New System.Windows.Forms.TabPage() - Me.UsrCntlKundenAvisoMailBenachrichtigung1 = New SDL.usrCntlKundenAvisoMailBenachrichtigung() Me.tbKdSpez = New System.Windows.Forms.TabPage() Me.Label14 = New System.Windows.Forms.Label() Me.Label43 = New System.Windows.Forms.Label() @@ -250,7 +248,9 @@ Partial Class usrCntlKundenuebersicht Me.GültigungültigToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.btnReloadOP = New System.Windows.Forms.Button() Me.cboFirmaFMZOLL = New VERAG_PROG_ALLGEMEIN.MyComboBox() - Me.FlatButton2 = New VERAG_PROG_ALLGEMEIN.FlatButton() + Me.UsrCntlKundenBesonderheiten1 = New SDL.usrCntlKundenBesonderheiten() + Me.ucKundenKontakte = New SDL.usrCntlKundenKontakte() + Me.UsrCntlKundenAvisoMailBenachrichtigung1 = New SDL.usrCntlKundenAvisoMailBenachrichtigung() Me.cntxtAddVM.SuspendLayout() Me.tbWeitereKundenDetails.SuspendLayout() Me.tbOfferten.SuspendLayout() @@ -387,8 +387,8 @@ Partial Class usrCntlKundenuebersicht Me.dgvOfferteDetailsUebersicht.AllowUserToDeleteRows = False Me.dgvOfferteDetailsUebersicht.AllowUserToOrderColumns = True Me.dgvOfferteDetailsUebersicht.AllowUserToResizeRows = False - DataGridViewCellStyle13.BackColor = System.Drawing.Color.FromArgb(CType(CType(240, Byte), Integer), CType(CType(245, Byte), Integer), CType(CType(255, Byte), Integer)) - Me.dgvOfferteDetailsUebersicht.AlternatingRowsDefaultCellStyle = DataGridViewCellStyle13 + DataGridViewCellStyle1.BackColor = System.Drawing.Color.FromArgb(CType(CType(240, Byte), Integer), CType(CType(245, Byte), Integer), CType(CType(255, Byte), Integer)) + Me.dgvOfferteDetailsUebersicht.AlternatingRowsDefaultCellStyle = DataGridViewCellStyle1 Me.dgvOfferteDetailsUebersicht.BackgroundColor = System.Drawing.Color.White Me.dgvOfferteDetailsUebersicht.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D Me.dgvOfferteDetailsUebersicht.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize @@ -408,8 +408,8 @@ Partial Class usrCntlKundenuebersicht Me.dgvOffertenSperrliste.AllowUserToDeleteRows = False Me.dgvOffertenSperrliste.AllowUserToOrderColumns = True Me.dgvOffertenSperrliste.AllowUserToResizeRows = False - DataGridViewCellStyle14.BackColor = System.Drawing.Color.FromArgb(CType(CType(240, Byte), Integer), CType(CType(245, Byte), Integer), CType(CType(255, Byte), Integer)) - Me.dgvOffertenSperrliste.AlternatingRowsDefaultCellStyle = DataGridViewCellStyle14 + DataGridViewCellStyle2.BackColor = System.Drawing.Color.FromArgb(CType(CType(240, Byte), Integer), CType(CType(245, Byte), Integer), CType(CType(255, Byte), Integer)) + Me.dgvOffertenSperrliste.AlternatingRowsDefaultCellStyle = DataGridViewCellStyle2 Me.dgvOffertenSperrliste.BackgroundColor = System.Drawing.Color.White Me.dgvOffertenSperrliste.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D Me.dgvOffertenSperrliste.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize @@ -419,10 +419,10 @@ Partial Class usrCntlKundenuebersicht Me.dgvOffertenSperrliste.Name = "dgvOffertenSperrliste" Me.dgvOffertenSperrliste.ReadOnly = True Me.dgvOffertenSperrliste.RowHeadersVisible = False - DataGridViewCellStyle15.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - DataGridViewCellStyle15.SelectionBackColor = System.Drawing.Color.FromArgb(CType(CType(240, Byte), Integer), CType(CType(240, Byte), Integer), CType(CType(240, Byte), Integer)) - DataGridViewCellStyle15.SelectionForeColor = System.Drawing.Color.Black - Me.dgvOffertenSperrliste.RowsDefaultCellStyle = DataGridViewCellStyle15 + DataGridViewCellStyle3.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + DataGridViewCellStyle3.SelectionBackColor = System.Drawing.Color.FromArgb(CType(CType(240, Byte), Integer), CType(CType(240, Byte), Integer), CType(CType(240, Byte), Integer)) + DataGridViewCellStyle3.SelectionForeColor = System.Drawing.Color.Black + Me.dgvOffertenSperrliste.RowsDefaultCellStyle = DataGridViewCellStyle3 Me.dgvOffertenSperrliste.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect Me.dgvOffertenSperrliste.Size = New System.Drawing.Size(173, 257) Me.dgvOffertenSperrliste.TabIndex = 0 @@ -560,8 +560,8 @@ Partial Class usrCntlKundenuebersicht Me.dgvOffenePosten.AllowUserToAddRows = False Me.dgvOffenePosten.AllowUserToDeleteRows = False Me.dgvOffenePosten.AllowUserToResizeRows = False - DataGridViewCellStyle16.BackColor = System.Drawing.Color.FromArgb(CType(CType(240, Byte), Integer), CType(CType(245, Byte), Integer), CType(CType(255, Byte), Integer)) - Me.dgvOffenePosten.AlternatingRowsDefaultCellStyle = DataGridViewCellStyle16 + DataGridViewCellStyle4.BackColor = System.Drawing.Color.FromArgb(CType(CType(240, Byte), Integer), CType(CType(245, Byte), Integer), CType(CType(255, Byte), Integer)) + Me.dgvOffenePosten.AlternatingRowsDefaultCellStyle = DataGridViewCellStyle4 Me.dgvOffenePosten.BackgroundColor = System.Drawing.Color.White Me.dgvOffenePosten.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize Me.dgvOffenePosten.Dock = System.Windows.Forms.DockStyle.Fill @@ -641,8 +641,8 @@ Partial Class usrCntlKundenuebersicht Me.dgvUmsatzbericht.AllowUserToDeleteRows = False Me.dgvUmsatzbericht.AllowUserToOrderColumns = True Me.dgvUmsatzbericht.AllowUserToResizeRows = False - DataGridViewCellStyle17.BackColor = System.Drawing.Color.FromArgb(CType(CType(240, Byte), Integer), CType(CType(245, Byte), Integer), CType(CType(255, Byte), Integer)) - Me.dgvUmsatzbericht.AlternatingRowsDefaultCellStyle = DataGridViewCellStyle17 + DataGridViewCellStyle5.BackColor = System.Drawing.Color.FromArgb(CType(CType(240, Byte), Integer), CType(CType(245, Byte), Integer), CType(CType(255, Byte), Integer)) + Me.dgvUmsatzbericht.AlternatingRowsDefaultCellStyle = DataGridViewCellStyle5 Me.dgvUmsatzbericht.BackgroundColor = System.Drawing.Color.White Me.dgvUmsatzbericht.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize Me.dgvUmsatzbericht.Dock = System.Windows.Forms.DockStyle.Fill @@ -704,8 +704,8 @@ Partial Class usrCntlKundenuebersicht Me.dgvAnhaenge.AllowUserToAddRows = False Me.dgvAnhaenge.AllowUserToDeleteRows = False Me.dgvAnhaenge.AllowUserToResizeRows = False - DataGridViewCellStyle18.BackColor = System.Drawing.Color.FromArgb(CType(CType(240, Byte), Integer), CType(CType(245, Byte), Integer), CType(CType(255, Byte), Integer)) - Me.dgvAnhaenge.AlternatingRowsDefaultCellStyle = DataGridViewCellStyle18 + DataGridViewCellStyle6.BackColor = System.Drawing.Color.FromArgb(CType(CType(240, Byte), Integer), CType(CType(245, Byte), Integer), CType(CType(255, Byte), Integer)) + Me.dgvAnhaenge.AlternatingRowsDefaultCellStyle = DataGridViewCellStyle6 Me.dgvAnhaenge.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) Me.dgvAnhaenge.BackgroundColor = System.Drawing.Color.White Me.dgvAnhaenge.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize @@ -997,16 +997,6 @@ Partial Class usrCntlKundenuebersicht Me.Label2.Text = "Aviso:" Me.Label2.Visible = False ' - 'UsrCntlKundenBesonderheiten1 - ' - Me.UsrCntlKundenBesonderheiten1.BackColor = System.Drawing.Color.White - Me.UsrCntlKundenBesonderheiten1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle - Me.UsrCntlKundenBesonderheiten1.Location = New System.Drawing.Point(7, 32) - Me.UsrCntlKundenBesonderheiten1.Name = "UsrCntlKundenBesonderheiten1" - Me.UsrCntlKundenBesonderheiten1.Size = New System.Drawing.Size(107, 52) - Me.UsrCntlKundenBesonderheiten1.TabIndex = 6 - Me.UsrCntlKundenBesonderheiten1.Visible = False - ' 'lblAbfertigungsverbot ' Me.lblAbfertigungsverbot.BackColor = System.Drawing.Color.Red @@ -1426,6 +1416,20 @@ Partial Class usrCntlKundenuebersicht Me.Panel4.Size = New System.Drawing.Size(662, 26) Me.Panel4.TabIndex = 37 ' + 'FlatButton2 + ' + Me.FlatButton2.allowBorder = False + Me.FlatButton2.BackgroundImage = Global.SDL.My.Resources.Resources.pdf + Me.FlatButton2.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom + Me.FlatButton2.FlatAppearance.BorderSize = 0 + Me.FlatButton2.FlatStyle = System.Windows.Forms.FlatStyle.Flat + Me.FlatButton2.ForeColor = System.Drawing.Color.Black + Me.FlatButton2.Location = New System.Drawing.Point(222, 6) + Me.FlatButton2.Name = "FlatButton2" + Me.FlatButton2.Size = New System.Drawing.Size(15, 12) + Me.FlatButton2.TabIndex = 11 + Me.FlatButton2.UseVisualStyleBackColor = True + ' 'btnCreditsafe ' Me.btnCreditsafe.Location = New System.Drawing.Point(582, 3) @@ -2083,14 +2087,6 @@ Partial Class usrCntlKundenuebersicht Me.tbKontaktSpez.Text = "Spezifisch" Me.tbKontaktSpez.UseVisualStyleBackColor = True ' - 'ucKundenKontakte - ' - Me.ucKundenKontakte.Dock = System.Windows.Forms.DockStyle.Fill - Me.ucKundenKontakte.Location = New System.Drawing.Point(3, 3) - Me.ucKundenKontakte.Name = "ucKundenKontakte" - Me.ucKundenKontakte.Size = New System.Drawing.Size(473, 158) - Me.ucKundenKontakte.TabIndex = 0 - ' 'Label38 ' Me.Label38.AutoSize = True @@ -2362,8 +2358,8 @@ Partial Class usrCntlKundenuebersicht Me.dgvVollmachten.AllowUserToDeleteRows = False Me.dgvVollmachten.AllowUserToOrderColumns = True Me.dgvVollmachten.AllowUserToResizeRows = False - DataGridViewCellStyle19.BackColor = System.Drawing.Color.FromArgb(CType(CType(240, Byte), Integer), CType(CType(245, Byte), Integer), CType(CType(255, Byte), Integer)) - Me.dgvVollmachten.AlternatingRowsDefaultCellStyle = DataGridViewCellStyle19 + DataGridViewCellStyle7.BackColor = System.Drawing.Color.FromArgb(CType(CType(240, Byte), Integer), CType(CType(245, Byte), Integer), CType(CType(255, Byte), Integer)) + Me.dgvVollmachten.AlternatingRowsDefaultCellStyle = DataGridViewCellStyle7 Me.dgvVollmachten.BackgroundColor = System.Drawing.Color.White Me.dgvVollmachten.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize Me.dgvVollmachten.Dock = System.Windows.Forms.DockStyle.Fill @@ -2416,8 +2412,8 @@ Partial Class usrCntlKundenuebersicht Me.dgvVertraege.AllowUserToDeleteRows = False Me.dgvVertraege.AllowUserToOrderColumns = True Me.dgvVertraege.AllowUserToResizeRows = False - DataGridViewCellStyle20.BackColor = System.Drawing.Color.FromArgb(CType(CType(240, Byte), Integer), CType(CType(245, Byte), Integer), CType(CType(255, Byte), Integer)) - Me.dgvVertraege.AlternatingRowsDefaultCellStyle = DataGridViewCellStyle20 + DataGridViewCellStyle8.BackColor = System.Drawing.Color.FromArgb(CType(CType(240, Byte), Integer), CType(CType(245, Byte), Integer), CType(CType(255, Byte), Integer)) + Me.dgvVertraege.AlternatingRowsDefaultCellStyle = DataGridViewCellStyle8 Me.dgvVertraege.BackgroundColor = System.Drawing.Color.White Me.dgvVertraege.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize Me.dgvVertraege.Dock = System.Windows.Forms.DockStyle.Fill @@ -2580,8 +2576,8 @@ Partial Class usrCntlKundenuebersicht Me.dgvGestGarantie.AllowUserToDeleteRows = False Me.dgvGestGarantie.AllowUserToOrderColumns = True Me.dgvGestGarantie.AllowUserToResizeRows = False - DataGridViewCellStyle21.BackColor = System.Drawing.Color.FromArgb(CType(CType(240, Byte), Integer), CType(CType(245, Byte), Integer), CType(CType(255, Byte), Integer)) - Me.dgvGestGarantie.AlternatingRowsDefaultCellStyle = DataGridViewCellStyle21 + DataGridViewCellStyle9.BackColor = System.Drawing.Color.FromArgb(CType(CType(240, Byte), Integer), CType(CType(245, Byte), Integer), CType(CType(255, Byte), Integer)) + Me.dgvGestGarantie.AlternatingRowsDefaultCellStyle = DataGridViewCellStyle9 Me.dgvGestGarantie.BackgroundColor = System.Drawing.Color.White Me.dgvGestGarantie.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize Me.dgvGestGarantie.Dock = System.Windows.Forms.DockStyle.Fill @@ -2717,15 +2713,6 @@ Partial Class usrCntlKundenuebersicht Me.tbAvisoMail.Text = "Aviso E-Mails" Me.tbAvisoMail.UseVisualStyleBackColor = True ' - 'UsrCntlKundenAvisoMailBenachrichtigung1 - ' - Me.UsrCntlKundenAvisoMailBenachrichtigung1.BackColor = System.Drawing.Color.White - Me.UsrCntlKundenAvisoMailBenachrichtigung1.Dock = System.Windows.Forms.DockStyle.Fill - Me.UsrCntlKundenAvisoMailBenachrichtigung1.Location = New System.Drawing.Point(3, 3) - Me.UsrCntlKundenAvisoMailBenachrichtigung1.Name = "UsrCntlKundenAvisoMailBenachrichtigung1" - Me.UsrCntlKundenAvisoMailBenachrichtigung1.Size = New System.Drawing.Size(473, 158) - Me.UsrCntlKundenAvisoMailBenachrichtigung1.TabIndex = 0 - ' 'tbKdSpez ' Me.tbKdSpez.Controls.Add(Me.Label14) @@ -3034,24 +3021,24 @@ Partial Class usrCntlKundenuebersicht Me.dgvAufschub.AllowUserToResizeColumns = False Me.dgvAufschub.AllowUserToResizeRows = False Me.dgvAufschub.BackgroundColor = System.Drawing.Color.White - DataGridViewCellStyle22.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft - DataGridViewCellStyle22.BackColor = System.Drawing.SystemColors.Control - DataGridViewCellStyle22.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - DataGridViewCellStyle22.ForeColor = System.Drawing.SystemColors.WindowText - DataGridViewCellStyle22.SelectionBackColor = System.Drawing.SystemColors.Highlight - DataGridViewCellStyle22.SelectionForeColor = System.Drawing.SystemColors.HighlightText - DataGridViewCellStyle22.WrapMode = System.Windows.Forms.DataGridViewTriState.[True] - Me.dgvAufschub.ColumnHeadersDefaultCellStyle = DataGridViewCellStyle22 + DataGridViewCellStyle10.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft + DataGridViewCellStyle10.BackColor = System.Drawing.SystemColors.Control + DataGridViewCellStyle10.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + DataGridViewCellStyle10.ForeColor = System.Drawing.SystemColors.WindowText + DataGridViewCellStyle10.SelectionBackColor = System.Drawing.SystemColors.Highlight + DataGridViewCellStyle10.SelectionForeColor = System.Drawing.SystemColors.HighlightText + DataGridViewCellStyle10.WrapMode = System.Windows.Forms.DataGridViewTriState.[True] + Me.dgvAufschub.ColumnHeadersDefaultCellStyle = DataGridViewCellStyle10 Me.dgvAufschub.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize Me.dgvAufschub.Columns.AddRange(New System.Windows.Forms.DataGridViewColumn() {Me.KtoId, Me.Art, Me.HZA, Me.KontoNr, Me.EORI, Me.NL}) - DataGridViewCellStyle24.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft - DataGridViewCellStyle24.BackColor = System.Drawing.SystemColors.Window - DataGridViewCellStyle24.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - DataGridViewCellStyle24.ForeColor = System.Drawing.SystemColors.ControlText - DataGridViewCellStyle24.SelectionBackColor = System.Drawing.SystemColors.Highlight - DataGridViewCellStyle24.SelectionForeColor = System.Drawing.SystemColors.HighlightText - DataGridViewCellStyle24.WrapMode = System.Windows.Forms.DataGridViewTriState.[False] - Me.dgvAufschub.DefaultCellStyle = DataGridViewCellStyle24 + DataGridViewCellStyle12.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft + DataGridViewCellStyle12.BackColor = System.Drawing.SystemColors.Window + DataGridViewCellStyle12.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + DataGridViewCellStyle12.ForeColor = System.Drawing.SystemColors.ControlText + DataGridViewCellStyle12.SelectionBackColor = System.Drawing.SystemColors.Highlight + DataGridViewCellStyle12.SelectionForeColor = System.Drawing.SystemColors.HighlightText + DataGridViewCellStyle12.WrapMode = System.Windows.Forms.DataGridViewTriState.[False] + Me.dgvAufschub.DefaultCellStyle = DataGridViewCellStyle12 Me.dgvAufschub.Location = New System.Drawing.Point(13, 61) Me.dgvAufschub.MultiSelect = False Me.dgvAufschub.Name = "dgvAufschub" @@ -3078,8 +3065,8 @@ Partial Class usrCntlKundenuebersicht ' 'HZA ' - DataGridViewCellStyle23.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight - Me.HZA.DefaultCellStyle = DataGridViewCellStyle23 + DataGridViewCellStyle11.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight + Me.HZA.DefaultCellStyle = DataGridViewCellStyle11 Me.HZA.HeaderText = "HZA" Me.HZA.Name = "HZA" Me.HZA.ReadOnly = True @@ -3257,19 +3244,32 @@ Partial Class usrCntlKundenuebersicht Me.cboFirmaFMZOLL.TabIndex = 10 Me.cboFirmaFMZOLL.Visible = False ' - 'FlatButton2 + 'UsrCntlKundenBesonderheiten1 ' - Me.FlatButton2.allowBorder = False - Me.FlatButton2.BackgroundImage = Global.SDL.My.Resources.Resources.pdf - Me.FlatButton2.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom - Me.FlatButton2.FlatAppearance.BorderSize = 0 - Me.FlatButton2.FlatStyle = System.Windows.Forms.FlatStyle.Flat - Me.FlatButton2.ForeColor = System.Drawing.Color.Black - Me.FlatButton2.Location = New System.Drawing.Point(222, 6) - Me.FlatButton2.Name = "FlatButton2" - Me.FlatButton2.Size = New System.Drawing.Size(15, 12) - Me.FlatButton2.TabIndex = 11 - Me.FlatButton2.UseVisualStyleBackColor = True + Me.UsrCntlKundenBesonderheiten1.BackColor = System.Drawing.Color.White + Me.UsrCntlKundenBesonderheiten1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle + Me.UsrCntlKundenBesonderheiten1.Location = New System.Drawing.Point(7, 32) + Me.UsrCntlKundenBesonderheiten1.Name = "UsrCntlKundenBesonderheiten1" + Me.UsrCntlKundenBesonderheiten1.Size = New System.Drawing.Size(107, 52) + Me.UsrCntlKundenBesonderheiten1.TabIndex = 6 + Me.UsrCntlKundenBesonderheiten1.Visible = False + ' + 'ucKundenKontakte + ' + Me.ucKundenKontakte.Dock = System.Windows.Forms.DockStyle.Fill + Me.ucKundenKontakte.Location = New System.Drawing.Point(3, 3) + Me.ucKundenKontakte.Name = "ucKundenKontakte" + Me.ucKundenKontakte.Size = New System.Drawing.Size(473, 158) + Me.ucKundenKontakte.TabIndex = 0 + ' + 'UsrCntlKundenAvisoMailBenachrichtigung1 + ' + Me.UsrCntlKundenAvisoMailBenachrichtigung1.BackColor = System.Drawing.Color.White + Me.UsrCntlKundenAvisoMailBenachrichtigung1.Dock = System.Windows.Forms.DockStyle.Fill + Me.UsrCntlKundenAvisoMailBenachrichtigung1.Location = New System.Drawing.Point(3, 3) + Me.UsrCntlKundenAvisoMailBenachrichtigung1.Name = "UsrCntlKundenAvisoMailBenachrichtigung1" + Me.UsrCntlKundenAvisoMailBenachrichtigung1.Size = New System.Drawing.Size(473, 158) + Me.UsrCntlKundenAvisoMailBenachrichtigung1.TabIndex = 0 ' 'usrCntlKundenuebersicht ' diff --git a/SDL/kunden/usrCntlKundenuebersicht.vb b/SDL/kunden/usrCntlKundenuebersicht.vb index 730a65cb..bd119ad2 100644 --- a/SDL/kunden/usrCntlKundenuebersicht.vb +++ b/SDL/kunden/usrCntlKundenuebersicht.vb @@ -55,6 +55,7 @@ Public Class usrCntlKundenuebersicht Dim WHEREStatistik = "" Public selectedTAB = "" Property BER_STUFE = 99 + Private datenarchivId = -1 Public Sub New() Try @@ -633,6 +634,8 @@ Public Class usrCntlKundenuebersicht txtKundenbetreuer.Text = VERAGSQL.DLookup("team_bezeichnung", "tblTeams", "[team_id]='" & KUNDE_ERW.kde_TeamId & "'", "ADMIN") txtKundenbetreuerTeam.Text = VERAGSQL.DLookup("mit_vname +' '+mit_nname", "tblMitarbeiter", "[mit_id]='" & KUNDE_ERW.kde_TeamMAId & "'", "ADMIN") + updateDatenarchivId() + 'cbxAbf_SvsRvs.CheckedValue = checkNullBool(KUNDE.SVS) @@ -1294,7 +1297,7 @@ Public Class usrCntlKundenuebersicht - .DataSource = SQL.loadDgvBySql("SELECT [KundenNr] as KdNr,[Datum] as Datum,[Rechnung] as Nummer,[Saldo] as Betrag,'-' as [OP-Saldo],'EUR' as Währung ,'-' as [KumSaldoEUR] ,[Buchungstext] " & + .DataSource = SQL.loadDgvBySql("SELECT [KundenNr] as KdNr,[Datum] as Datum,[Rechnung] as Nummer,[Saldo] as Betrag,'-' as [OP-Saldo],'EUR' as Währung ,'-' as [KumSaldoEUR],[Buchungstext] " & " FROM [Offene_Posten_DVO] " & " WHERE KundenNr='" & KUNDE.KundenNrZentrale & "' " & where & " order BY datum DESC, [OP_ID] DESC", "FMZOLL") If .Columns.Count > 0 Then @@ -1444,7 +1447,7 @@ Public Class usrCntlKundenuebersicht Else where = If(VERAG_PROG_ALLGEMEIN.cAllgemein.MITARBEITER.mit_FirmenDatenAnzeige.contains("A"), "", " AND Firma_ID IN(" & VERAG_PROG_ALLGEMEIN.cAllgemein.MITARBEITER.mit_FirmenDatenAnzeige & ")") End If - .DataSource = SQL.loadDgvBySql("SELECT [Kontonummer] as KdNr,[Belegdatum] as Datum,[Belegnummer] as Nummer,[Bruttobetrag] as Betrag,[Gesamtausstand] as [OP-Saldo],[Waehrung] as Währung,[KumSaldoEUR] ,[Buchungstext] as Referenz " & + .DataSource = SQL.loadDgvBySql("SELECT [Kontonummer] as KdNr,[Belegdatum] as Datum,[Belegnummer] as Nummer,[Bruttobetrag] as Betrag,[Gesamtausstand] as [OP-Saldo],[Waehrung] as Währung,[KumSaldoEUR],[Mahnstufe] as M, [Fälligkeitsdatum] ,[Buchungstext] as Referenz " & " FROM [Offene Posten] " & " WHERE [Kontonummer]='" & KUNDE.KundenNrZentrale & "' " & where & " ORDER BY OP_ID DESC /*, Belegdatum DESC*/", "FMZOLL") @@ -1465,14 +1468,22 @@ Public Class usrCntlKundenuebersicht .Columns(4).DefaultCellStyle.Format = "N2" .Columns(4).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight - .Columns(5).Width = 60 + .Columns(5).Width = 40 .Columns(5).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter .Columns(6).Width = 80 .Columns(6).DefaultCellStyle.Format = "N2" .Columns(6).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight - .Columns(7).AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill + .Columns(7).Width = 20 + .Columns(6).DefaultCellStyle.Format = "N0" + .Columns(7).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter + + .Columns(8).Width = 70 + .Columns(8).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter + + + .Columns(9).AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill Dim OP_tmp As Double = 0 @@ -2742,8 +2753,8 @@ Public Class usrCntlKundenuebersicht Else Dim cs = New cCreditSafeAPI() - If cs.authenticate(VERAG_PROG_ALLGEMEIN.cAllgemein.MITARBEITER.mit_CSuser, VERAG_PROG_ALLGEMEIN.cAllgemein.MITARBEITER.mit_CSpwd) = "200" Then - + 'If cs.authenticate(VERAG_PROG_ALLGEMEIN.cAllgemein.MITARBEITER.mit_CSuser, VERAG_PROG_ALLGEMEIN.cAllgemein.MITARBEITER.mit_CSpwd) = "200" Then + If cs.authenticate("creditsafe@verag.ag", "^AZcBVTBUIHTT5SQ1C9OOH") = "200" Then If checkNullStr(ADRESSE.LandKz) = "" Then @@ -2766,6 +2777,7 @@ Public Class usrCntlKundenuebersicht Dim company As New cCreditSafeAPI.Company("", "", laenderKZ, KUNDE_ERW.kde_CreditSaveNo, KUNDE_ERW.kde_CreditSaveId, Nothing) + Dim pdfObject As Byte() = Nothing If lblBonitaetsdatum._value <> Nothing Then Dim lastChecked As Date = Date.ParseExact(lblBonitaetsdatum._value, "dd.MM.yyyy", System.Globalization.DateTimeFormatInfo.InvariantInfo) @@ -2774,14 +2786,19 @@ Public Class usrCntlKundenuebersicht If cs.checkDateOfLastRequest(company) < lastChecked Then Dim a As MsgBoxResult = MsgBox("Seit der letzen Abfrage (" & lastChecked.ToShortDateString & ") wurde bei Creditsafe keine Änderung gemacht!" & vbNewLine & "Trotzdem Creditreport-Daten aktualisieren?", vbYesNo) If a = vbYes Then - MsgBox(cs.getReport(company, True)) + MsgBox(cs.getReport(company, True, pdfObject)) + setCreditSafeEntry(company, pdfObject, kdNr) End If + Else + cs.getReport(company, True, pdfObject) + setCreditSafeEntry(company, pdfObject, kdNr) End If Else - MsgBox(cs.getReport(company, True)) + MsgBox(cs.getReport(company, True, pdfObject)) + setCreditSafeEntry(company, pdfObject, kdNr) End If @@ -2798,7 +2815,78 @@ Public Class usrCntlKundenuebersicht End Sub - Private Sub FlatButton2_Click(sender As Object, e As EventArgs) Handles FlatButton2.Click + Private Sub setCreditSafeEntry(company As cCreditSafeAPI.Company, PDF As Byte(), krn As Integer) + + + Dim cBonitaetsauskunft = New VERAG_PROG_ALLGEMEIN.cBonitaetsauskunft + + If PDF IsNot Nothing Then + Dim DS = New VERAG_PROG_ALLGEMEIN.cDATENSERVER("DOKUMENTE", "CREDITSAFE", "", "", "", "Bericht_" & kdNr, kdNr) + Dim path = DS.uploadDataToDATENSERVER_fromBytes(PDF, "Bericht_" & kdNr, ".pdf") + + If path Then + cBonitaetsauskunft.ba_datenarchivId = DS.da_id + End If + + End If + + cBonitaetsauskunft.ba_BonitaetsIndex = Nothing + cBonitaetsauskunft.ba_Risikostufe = Nothing + cBonitaetsauskunft.ba_CreditSaveBonitaetsScore = Nothing + cBonitaetsauskunft.ba_CreditSaveBonitaetsIndex = Nothing + cBonitaetsauskunft.ba_CreditSaveRisikoklasse = Nothing + + cBonitaetsauskunft.ba_KundenNr = (kdNr) + cBonitaetsauskunft.ba_Datum = Now() + + If company.country = "AT" Then + cBonitaetsauskunft.ba_CreditSaveBonitaetsScore = If(IsNumeric(company.csIndex), CInt(company.csIndex), 0) + cBonitaetsauskunft.ba_Pruefungstool = "creditsafe AT" + Else + cBonitaetsauskunft.ba_CreditSaveBonitaetsIndex = If(IsNumeric(company.csIndex), CDbl(company.csIndex), 0) + cBonitaetsauskunft.ba_Pruefungstool = "creditsafe" + End If + + + cBonitaetsauskunft.ba_CreditSaveRisikoklasse = cProgramFunctions.isLeerNothing(company.csRiskclass) + + cBonitaetsauskunft.ba_MaId = VERAG_PROG_ALLGEMEIN.cAllgemein.USRID + cBonitaetsauskunft.ba_Sachbearbeiter = VERAG_PROG_ALLGEMEIN.cAllgemein.USRKURZNAME + cBonitaetsauskunft.ba_Hoechstkredit = cProgramFunctions.isLeerNothingDbl(company.csMaxCreditAmount) + cBonitaetsauskunft.ba_Bankverbindung = "" + cBonitaetsauskunft.ba_Zahlungsweise = "" + cBonitaetsauskunft.ba_GFName = "" + cBonitaetsauskunft.ba_Sonstiges = "" + cBonitaetsauskunft.ba_GruendundsDatum = company.csDFoundingDate + + If cBonitaetsauskunft.SAVE Then + SQL.doSQL("UPDATE Kunden SET Bonität='" & cBonitaetsauskunft.ba_BonitaetsIndex & "', Bonitätsdatum='" & cBonitaetsauskunft.ba_Datum & "', Höchstkredit=" & If(cBonitaetsauskunft.ba_Hoechstkredit Is Nothing, "null", "'" & cBonitaetsauskunft.ba_Hoechstkredit & "'") & " WHERE KundenNr='" & cBonitaetsauskunft.ba_KundenNr & "'", "FMZOLL") + + Dim KDERW As New VERAG_PROG_ALLGEMEIN.cKundenErweitert(kdNr) + KDERW.kde_CreditSaveBonitaetsIndex = cBonitaetsauskunft.ba_CreditSaveBonitaetsIndex + KDERW.kde_CreditSaveBonitaetsScore = cBonitaetsauskunft.ba_CreditSaveBonitaetsScore + KDERW.kde_CreditSaveBonitaetsklasse = cBonitaetsauskunft.ba_CreditSaveRisikoklasse + KDERW.kde_BonitaetsStufe = cBonitaetsauskunft.ba_Risikostufe + KDERW.SAVE() + updateDatenarchivId() + End If End Sub + + Private Sub FlatButton2_Click(sender As Object, e As EventArgs) Handles FlatButton2.Click + + If datenarchivId = -1 Then Exit Sub + + Dim DS As New VERAG_PROG_ALLGEMEIN.cDATENSERVER(datenarchivId) + DS.OPEN_SINGLE(True) + + End Sub + + Private Sub updateDatenarchivId() + If kdNr < 0 Then Exit Sub + datenarchivId = VERAGSQL.DLookup("ba_datenarchivId", "[tblBonitaetsauskunft]", "[ba_KundenNr]='" & kdNr & "' ORDER BY ba_Datum DESC", "FMZOLL", "-1") + If datenarchivId = -1 Then + Button2.BackgroundImage = SDL.My.Resources.Resources.pdf_gray + End If + End Sub End Class diff --git a/VERAG_PROG_ALLGEMEIN/Classes/cBonitaetsauskunft.vb b/VERAG_PROG_ALLGEMEIN/Classes/cBonitaetsauskunft.vb index dbc54deb..1952efb2 100644 --- a/VERAG_PROG_ALLGEMEIN/Classes/cBonitaetsauskunft.vb +++ b/VERAG_PROG_ALLGEMEIN/Classes/cBonitaetsauskunft.vb @@ -29,6 +29,7 @@ Public Class cBonitaetsauskunft Property ba_CreditSaveBonitaetsScore As Object = Nothing Property ba_CreditSaveBonitaetsIndex As Object = Nothing Property ba_Pruefungstool As Object = Nothing + Property ba_datenarchivId As Object = Nothing Dim SQL As New SQL @@ -69,6 +70,7 @@ Public Class cBonitaetsauskunft list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ba_Pruefungstool", ba_Pruefungstool)) list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ba_CreditSaveBonitaetsScore", ba_CreditSaveBonitaetsScore)) list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ba_CreditSaveBonitaetsIndex", ba_CreditSaveBonitaetsIndex)) + list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ba_datenarchivId", ba_datenarchivId)) Return list End Function diff --git a/VERAG_PROG_ALLGEMEIN/Schnittstellen/cCreditSafeAPI.vb b/VERAG_PROG_ALLGEMEIN/Schnittstellen/cCreditSafeAPI.vb index 54eb5142..5aa117bd 100644 --- a/VERAG_PROG_ALLGEMEIN/Schnittstellen/cCreditSafeAPI.vb +++ b/VERAG_PROG_ALLGEMEIN/Schnittstellen/cCreditSafeAPI.vb @@ -3,6 +3,7 @@ Imports System.Net Imports System.Text Imports System.Web.UI.WebControls Imports System.Windows.Forms +Imports Chilkat Imports Microsoft.Office.Interop.Outlook Imports Newtonsoft.Json Imports Spire.Pdf.Lists @@ -12,10 +13,10 @@ Imports VERAG_PROG_ALLGEMEIN.TESTJSON Public Class cCreditSafeAPI 'Test - Shared API_STRING As String = "https://connect.sandbox.creditsafe.com" + 'Shared API_STRING As String = "https://connect.sandbox.creditsafe.com" 'PROD - 'Shared API_STRING As String = "https://connect.creditsafe.com" + Shared API_STRING As String = "https://connect.creditsafe.com" Shared token As String = "" Public dataTable As New DataTable() @@ -144,9 +145,6 @@ Public Class cCreditSafeAPI Dim jsonRespString = SendGetRequestWithAuthHeader(myUrl, company, "application/json", "GET", token) - 'Dim test As String = "{""correlationId"":""9194edd0-1a4a-4520-a332-7306b7c027ca"",""totalSize"":1,""companies"":[{""id"":""AT-X-7256130"",""country"":""AT"",""regNo"":""FN 410356 s"",""vatNo"":[""ATU 68490714""],""safeNo"":""AT05607514"",""name"":""Imex Customs Service GmbH"",""address"":{""simpleValue"":""Autobahngrenze 15, 4975, Suben"",""street"":""Autobahngrenze 15"",""city"":""Suben"",""postCode"":""4975""},""status"":""active"",""officeType"":""headOffice"",""type"":""Ltd"",""dateOfLatestAccounts"":""2021-12-31T00:00:00.000000Z"",""dateOfLatestChange"":""2023-03-03T02:38:30.000Z""}]}" - 'jsonRespString = test - Dim json As New Chilkat.JsonObject Dim success As Boolean = json.Load(jsonRespString) If (success <> True) Then @@ -207,8 +205,10 @@ Public Class cCreditSafeAPI End Function - Shared Function getReport(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 myUrl As String = API_STRING & "/v1/companies/" & company.creditSafeId + myUrl &= "/?language=DE" + myUrl &= "&?template=full" Dim acceptContentType = "application/json" If withPDF Then acceptContentType &= "+pdf" @@ -222,13 +222,103 @@ Public Class cCreditSafeAPI Return "Verbindungsfehler" End If - Dim num As Integer = json.SizeOfArray("companies") - If num = -1 Then - Return json.StringOf("details") + + 'Aubbau JSON Object + + ' "report" { + ' "companyIdentification" : { + ' "basicInformation" : { + ' "companyRegistrationDate" : "01.01.2022", + ' "creditScore" : { + ' "currentCreditRating" : { + ' "commonValue" : "A", + ' "providerValue" : { + ' "value" : "350", + '....} + ' "pdfReportStream": "base64" + '}, + + + + Dim reportObj As Chilkat.JsonObject = json.ObjectOf("report") + If (json.LastMethodSuccess = True) Then + + Dim companyIDObj As Chilkat.JsonObject = reportObj.ObjectOf("companyIdentification") + If (json.LastMethodSuccess = True) Then + + Dim basicInfoObj As Chilkat.JsonObject = companyIDObj.ObjectOf("basicInformation") + If (json.LastMethodSuccess = True) Then + + Dim dateTime As New Chilkat.CkDateTime + Dim getAsLocal As Boolean = False + basicInfoObj.DateOf("companyRegistrationDate", DateTime) + company.csDFoundingDate = dateTime.GetAsTimestamp(getAsLocal) + Debug.WriteLine(dateTime) + + Else + + Debug.WriteLine("basicInfoObj object not found.") + End If + + Else + Debug.WriteLine("companyIDObj object not found.") + End If + + + Dim creditScoreObj As Chilkat.JsonObject = reportObj.ObjectOf("creditScore") + If (json.LastMethodSuccess = True) Then + + + Dim creditRatingObj As Chilkat.JsonObject = creditScoreObj.ObjectOf("currentCreditRating") + If (json.LastMethodSuccess = True) Then + + company.csRiskclass = creditRatingObj.StringOf("commonValue") + + Dim creditLimitObj As Chilkat.JsonObject = creditRatingObj.ObjectOf("creditLimit") + If (json.LastMethodSuccess = True) Then + company.csMaxCreditAmount = creditLimitObj.StringOf("value") + Else + Debug.WriteLine("creditRating object not found.") + End If + + Dim providerValueObj As Chilkat.JsonObject = creditRatingObj.ObjectOf("providerValue") + If (json.LastMethodSuccess = True) Then + company.csIndex = providerValueObj.StringOf("value") + Else + Debug.WriteLine("providerValue object not found.") + + End If + + Else + + Debug.WriteLine("currentCreditRating object not found.") + End If + + + Else + Debug.WriteLine("creditScore object not found.") + Return "creditScore object not found" + End If + + Else + Debug.WriteLine("report object not found.") + Return "report object not found" End If - Return "test" + If withPDF Then + Dim sb As New Chilkat.StringBuilder + json.StringOfSb("pdfReportStream", sb) + Dim bd As New Chilkat.BinData + bd.AppendEncodedSb(sb, "base64") + + bytes = Convert.FromBase64String(sb.ToString) + + Return "mitPDF" + + End If + + Return "ohnePDF" End Function @@ -307,6 +397,11 @@ Public Class cCreditSafeAPI Public Property country As String Public Property creditsafeNo As String Public Property lastChecked As Date + Public Property csIndex As String + Public Property csRiskclass As String + Public Property csMaxCreditAmount As Double + Public Property csDFoundingDate As Date + Public Property csPDF As String Public Sub New(_name As String, _vatNo As String, _country As String, _creditsafeNo As String, _creditSafeId As String, _lastChecked As Date)