From 7c161a29a2111bcd22dbb92b8c46b1aeec222dc4 Mon Sep 17 00:00:00 2001 From: "d.breimaier" Date: Tue, 20 Aug 2024 09:27:27 +0200 Subject: [PATCH] MDM UST, MSE-API, API-Einstellungen --- SDL/My Project/AssemblyInfo.vb | 4 +- SDL/USTV/frmMDM_USTVAntrag.vb | 2 +- SDL/USTV/usrCntlUSTV.Designer.vb | 186 +++++++++++++++--- SDL/USTV/usrCntlUSTV.vb | 31 ++- VERAG_PROG_ALLGEMEIN/Classes/SQL.vb | 16 +- .../DATENSERVER/cDATENSERVER.vb | 60 +++++- .../Schnittstellen/MSE/cMSEAPI.vb | 2 +- 7 files changed, 262 insertions(+), 39 deletions(-) diff --git a/SDL/My Project/AssemblyInfo.vb b/SDL/My Project/AssemblyInfo.vb index cef18913..c4994e53 100644 --- a/SDL/My Project/AssemblyInfo.vb +++ b/SDL/My Project/AssemblyInfo.vb @@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices ' übernehmen, indem Sie "*" eingeben: ' - - + + diff --git a/SDL/USTV/frmMDM_USTVAntrag.vb b/SDL/USTV/frmMDM_USTVAntrag.vb index 9d072336..07dda763 100644 --- a/SDL/USTV/frmMDM_USTVAntrag.vb +++ b/SDL/USTV/frmMDM_USTVAntrag.vb @@ -122,7 +122,7 @@ Public Class frmMDM_USTVAntrag Select Case If(r.Cells("UStVPo_SchnittstellenNr").Value, -1) Case 6, 0 : da_id = SQL.getValueTxtBySql("SELECT TOP(1) [plInv_daId] FROM [tblPLOSE_Inv_Data] where plInv_SupplierRechnungsDatum='" & r.Cells("UStVPo_ReDat").Value & "' and plInv_SupplierRechnungsNr='" & r.Cells("UStVPo_ReNr").Value & "' and plInv_SupplierCountry='" & Antrag_LandKz & "' AND [plInv_daId] is not null", "FMZOLL",,, -1) - Case 7 : da_id = SQL.getValueTxtBySql("SELECT TOP(1) [rmc_daId] FROM [tblRMCImport] where rmc_reDatum='" & r.Cells("UStVPo_ReDat").Value & "' and rmc_reNr='" & r.Cells("UStVPo_ReNr") & "' and rmc_landKZ='" & Antrag_LandKz & "' AND [rmc_daId] is not null", "FMZOLL",,, -1) + Case 7 : da_id = SQL.getValueTxtBySql("SELECT TOP(1) [rmc_daId] FROM [tblRMCImport] where rmc_reDatum='" & r.Cells("UStVPo_ReDat").Value & "' and rmc_reNr='" & r.Cells("UStVPo_ReNr").Value & "' and rmc_landKZ='" & Antrag_LandKz & "' AND [rmc_daId] is not null", "FMZOLL",,, -1) End Select If da_id > 0 Then diff --git a/SDL/USTV/usrCntlUSTV.Designer.vb b/SDL/USTV/usrCntlUSTV.Designer.vb index 0caedc8a..dd8c6ec8 100644 --- a/SDL/USTV/usrCntlUSTV.Designer.vb +++ b/SDL/USTV/usrCntlUSTV.Designer.vb @@ -28,6 +28,7 @@ Partial Class usrCntlUSTV Me.dgvUSTV = New VERAG_PROG_ALLGEMEIN.MyDatagridview(Me.components) Me.Label1 = New System.Windows.Forms.Label() Me.Panel1 = New System.Windows.Forms.Panel() + Me.cbxDifferenzbetrag = New System.Windows.Forms.CheckBox() Me.cbxEingereicht = New System.Windows.Forms.CheckBox() Me.cbxTopMax = New System.Windows.Forms.CheckBox() Me.txtMaxSrch = New VERAG_PROG_ALLGEMEIN.MyTextBox() @@ -41,12 +42,18 @@ Partial Class usrCntlUSTV Me.FlatButton2 = New System.Windows.Forms.Button() Me.Panel2 = New System.Windows.Forms.Panel() Me.Panel3 = New System.Windows.Forms.Panel() + Me.btnRMCalle = New System.Windows.Forms.Button() Me.btnMail = New System.Windows.Forms.Button() Me.btnPLOSEAlle = New System.Windows.Forms.Button() Me.Button5 = New System.Windows.Forms.Button() Me.Button8 = New System.Windows.Forms.Button() Me.ContextMenuStrip1 = New System.Windows.Forms.ContextMenuStrip(Me.components) - Me.btnRMCalle = New System.Windows.Forms.Button() + Me.Label3 = New System.Windows.Forms.Label() + Me.Label4 = New System.Windows.Forms.Label() + Me.Label5 = New System.Windows.Forms.Label() + Me.txtSumUst = New VERAG_PROG_ALLGEMEIN.MyTextBox() + Me.txtSumErst = New VERAG_PROG_ALLGEMEIN.MyTextBox() + Me.txtSumDiff = New VERAG_PROG_ALLGEMEIN.MyTextBox() CType(Me.dgvUSTV, System.ComponentModel.ISupportInitialize).BeginInit() Me.Panel1.SuspendLayout() Me.Panel2.SuspendLayout() @@ -60,7 +67,7 @@ Partial Class usrCntlUSTV Me.pnlFilter.Dock = System.Windows.Forms.DockStyle.Bottom Me.pnlFilter.Location = New System.Drawing.Point(0, 53) Me.pnlFilter.Name = "pnlFilter" - Me.pnlFilter.Size = New System.Drawing.Size(1072, 31) + Me.pnlFilter.Size = New System.Drawing.Size(1627, 31) Me.pnlFilter.TabIndex = 6 ' 'dgvUSTV @@ -77,7 +84,7 @@ Partial Class usrCntlUSTV Me.dgvUSTV.Name = "dgvUSTV" Me.dgvUSTV.ReadOnly = True Me.dgvUSTV.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect - Me.dgvUSTV.Size = New System.Drawing.Size(1072, 457) + Me.dgvUSTV.Size = New System.Drawing.Size(1627, 455) Me.dgvUSTV.TabIndex = 1 ' 'Label1 @@ -94,6 +101,7 @@ Partial Class usrCntlUSTV 'Panel1 ' Me.Panel1.BackColor = System.Drawing.Color.FromArgb(CType(CType(240, Byte), Integer), CType(CType(245, Byte), Integer), CType(CType(255, Byte), Integer)) + Me.Panel1.Controls.Add(Me.cbxDifferenzbetrag) Me.Panel1.Controls.Add(Me.cbxEingereicht) Me.Panel1.Controls.Add(Me.cbxTopMax) Me.Panel1.Controls.Add(Me.txtMaxSrch) @@ -107,9 +115,22 @@ Partial Class usrCntlUSTV Me.Panel1.Dock = System.Windows.Forms.DockStyle.Top Me.Panel1.Location = New System.Drawing.Point(0, 0) Me.Panel1.Name = "Panel1" - Me.Panel1.Size = New System.Drawing.Size(1072, 84) + Me.Panel1.Size = New System.Drawing.Size(1627, 84) Me.Panel1.TabIndex = 0 ' + 'cbxDifferenzbetrag + ' + Me.cbxDifferenzbetrag.AutoSize = True + Me.cbxDifferenzbetrag.Checked = True + Me.cbxDifferenzbetrag.CheckState = System.Windows.Forms.CheckState.Indeterminate + Me.cbxDifferenzbetrag.Location = New System.Drawing.Point(503, 35) + Me.cbxDifferenzbetrag.Name = "cbxDifferenzbetrag" + Me.cbxDifferenzbetrag.Size = New System.Drawing.Size(132, 17) + Me.cbxDifferenzbetrag.TabIndex = 47 + Me.cbxDifferenzbetrag.Text = "nur mit Differenzbetrag" + Me.cbxDifferenzbetrag.ThreeState = True + Me.cbxDifferenzbetrag.UseVisualStyleBackColor = True + ' 'cbxEingereicht ' Me.cbxEingereicht.AutoSize = True @@ -236,7 +257,7 @@ Partial Class usrCntlUSTV Me.Button1.ForeColor = System.Drawing.Color.Black Me.Button1.Image = Global.SDL.My.Resources.Resources.Excel_logo Me.Button1.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft - Me.Button1.Location = New System.Drawing.Point(955, 6) + Me.Button1.Location = New System.Drawing.Point(1510, 6) Me.Button1.Name = "Button1" Me.Button1.Size = New System.Drawing.Size(114, 39) Me.Button1.TabIndex = 5 @@ -279,15 +300,21 @@ Partial Class usrCntlUSTV Me.Panel2.BackColor = System.Drawing.Color.White Me.Panel2.Controls.Add(Me.Panel3) Me.Panel2.Dock = System.Windows.Forms.DockStyle.Bottom - Me.Panel2.Location = New System.Drawing.Point(0, 541) + Me.Panel2.Location = New System.Drawing.Point(0, 539) Me.Panel2.MinimumSize = New System.Drawing.Size(0, 50) Me.Panel2.Name = "Panel2" - Me.Panel2.Size = New System.Drawing.Size(1072, 66) + Me.Panel2.Size = New System.Drawing.Size(1627, 77) Me.Panel2.TabIndex = 2 ' 'Panel3 ' Me.Panel3.AutoSize = True + Me.Panel3.Controls.Add(Me.txtSumDiff) + Me.Panel3.Controls.Add(Me.txtSumErst) + Me.Panel3.Controls.Add(Me.txtSumUst) + Me.Panel3.Controls.Add(Me.Label5) + Me.Panel3.Controls.Add(Me.Label4) + Me.Panel3.Controls.Add(Me.Label3) Me.Panel3.Controls.Add(Me.btnRMCalle) Me.Panel3.Controls.Add(Me.btnMail) Me.Panel3.Controls.Add(Me.btnPLOSEAlle) @@ -299,9 +326,24 @@ Partial Class usrCntlUSTV Me.Panel3.Dock = System.Windows.Forms.DockStyle.Fill Me.Panel3.Location = New System.Drawing.Point(0, 0) Me.Panel3.Name = "Panel3" - Me.Panel3.Size = New System.Drawing.Size(1072, 66) + Me.Panel3.Size = New System.Drawing.Size(1627, 77) Me.Panel3.TabIndex = 0 ' + 'btnRMCalle + ' + Me.btnRMCalle.FlatStyle = System.Windows.Forms.FlatStyle.Flat + Me.btnRMCalle.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.0!) + Me.btnRMCalle.ForeColor = System.Drawing.Color.Black + Me.btnRMCalle.Image = Global.SDL.My.Resources.Resources.plus + Me.btnRMCalle.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft + Me.btnRMCalle.Location = New System.Drawing.Point(545, 6) + Me.btnRMCalle.Name = "btnRMCalle" + Me.btnRMCalle.Size = New System.Drawing.Size(172, 40) + Me.btnRMCalle.TabIndex = 26 + Me.btnRMCalle.Text = "RMC für offene " & Global.Microsoft.VisualBasic.ChrW(13) & Global.Microsoft.VisualBasic.ChrW(10) & "Anträge übernehmen" + Me.btnRMCalle.TextAlign = System.Drawing.ContentAlignment.MiddleRight + Me.btnRMCalle.UseVisualStyleBackColor = True + ' 'btnMail ' Me.btnMail.FlatStyle = System.Windows.Forms.FlatStyle.Flat @@ -335,7 +377,7 @@ Partial Class usrCntlUSTV Me.Button5.FlatStyle = System.Windows.Forms.FlatStyle.Flat Me.Button5.Image = Global.SDL.My.Resources.Resources.kunden Me.Button5.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft - Me.Button5.Location = New System.Drawing.Point(831, 5) + Me.Button5.Location = New System.Drawing.Point(1386, 5) Me.Button5.Name = "Button5" Me.Button5.Size = New System.Drawing.Size(118, 40) Me.Button5.TabIndex = 23 @@ -362,20 +404,110 @@ Partial Class usrCntlUSTV Me.ContextMenuStrip1.Name = "ContextMenuStrip1" Me.ContextMenuStrip1.Size = New System.Drawing.Size(61, 4) ' - 'btnRMCalle + 'Label3 ' - Me.btnRMCalle.FlatStyle = System.Windows.Forms.FlatStyle.Flat - Me.btnRMCalle.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.0!) - Me.btnRMCalle.ForeColor = System.Drawing.Color.Black - Me.btnRMCalle.Image = Global.SDL.My.Resources.Resources.plus - Me.btnRMCalle.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft - Me.btnRMCalle.Location = New System.Drawing.Point(545, 6) - Me.btnRMCalle.Name = "btnRMCalle" - Me.btnRMCalle.Size = New System.Drawing.Size(172, 40) - Me.btnRMCalle.TabIndex = 26 - Me.btnRMCalle.Text = "RMC für offene " & Global.Microsoft.VisualBasic.ChrW(13) & Global.Microsoft.VisualBasic.ChrW(10) & "Anträge übernehmen" - Me.btnRMCalle.TextAlign = System.Drawing.ContentAlignment.MiddleRight - Me.btnRMCalle.UseVisualStyleBackColor = True + Me.Label3.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.Label3.AutoSize = True + Me.Label3.Location = New System.Drawing.Point(1074, 8) + Me.Label3.Name = "Label3" + Me.Label3.Size = New System.Drawing.Size(59, 13) + Me.Label3.TabIndex = 27 + Me.Label3.Text = "USt-Betrag" + ' + 'Label4 + ' + Me.Label4.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.Label4.AutoSize = True + Me.Label4.Location = New System.Drawing.Point(1074, 29) + Me.Label4.Name = "Label4" + Me.Label4.Size = New System.Drawing.Size(90, 13) + Me.Label4.TabIndex = 28 + Me.Label4.Text = "Erstattungsbetrag" + ' + 'Label5 + ' + Me.Label5.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.Label5.AutoSize = True + Me.Label5.Location = New System.Drawing.Point(1074, 49) + Me.Label5.Name = "Label5" + Me.Label5.Size = New System.Drawing.Size(79, 13) + Me.Label5.TabIndex = 29 + Me.Label5.Text = "Differenzbetrag" + ' + 'txtSumUst + ' + Me.txtSumUst._DateTimeOnly = False + Me.txtSumUst._numbersOnly = False + Me.txtSumUst._numbersOnlyKommastellen = "" + Me.txtSumUst._numbersOnlyTrennzeichen = True + Me.txtSumUst._Prozent = False + Me.txtSumUst._ShortDateNew = False + Me.txtSumUst._ShortDateOnly = False + Me.txtSumUst._TimeOnly = False + Me.txtSumUst._TimeOnly_Seconds = False + Me.txtSumUst._value = "" + Me.txtSumUst._Waehrung = True + Me.txtSumUst._WaehrungZeichen = True + Me.txtSumUst.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.txtSumUst.ForeColor = System.Drawing.Color.Black + Me.txtSumUst.Location = New System.Drawing.Point(1179, 6) + Me.txtSumUst.MaxLineLength = -1 + Me.txtSumUst.MaxLines_Warning = "" + Me.txtSumUst.MaxLines_Warning_Label = Nothing + Me.txtSumUst.Name = "txtSumUst" + Me.txtSumUst.ReadOnly = True + Me.txtSumUst.Size = New System.Drawing.Size(107, 20) + Me.txtSumUst.TabIndex = 30 + ' + 'txtSumErst + ' + Me.txtSumErst._DateTimeOnly = False + Me.txtSumErst._numbersOnly = False + Me.txtSumErst._numbersOnlyKommastellen = "" + Me.txtSumErst._numbersOnlyTrennzeichen = True + Me.txtSumErst._Prozent = False + Me.txtSumErst._ShortDateNew = False + Me.txtSumErst._ShortDateOnly = False + Me.txtSumErst._TimeOnly = False + Me.txtSumErst._TimeOnly_Seconds = False + Me.txtSumErst._value = "" + Me.txtSumErst._Waehrung = True + Me.txtSumErst._WaehrungZeichen = True + Me.txtSumErst.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.txtSumErst.ForeColor = System.Drawing.Color.Black + Me.txtSumErst.Location = New System.Drawing.Point(1179, 26) + Me.txtSumErst.MaxLineLength = -1 + Me.txtSumErst.MaxLines_Warning = "" + Me.txtSumErst.MaxLines_Warning_Label = Nothing + Me.txtSumErst.Name = "txtSumErst" + Me.txtSumErst.ReadOnly = True + Me.txtSumErst.Size = New System.Drawing.Size(107, 20) + Me.txtSumErst.TabIndex = 31 + ' + 'txtSumDiff + ' + Me.txtSumDiff._DateTimeOnly = False + Me.txtSumDiff._numbersOnly = False + Me.txtSumDiff._numbersOnlyKommastellen = "" + Me.txtSumDiff._numbersOnlyTrennzeichen = True + Me.txtSumDiff._Prozent = False + Me.txtSumDiff._ShortDateNew = False + Me.txtSumDiff._ShortDateOnly = False + Me.txtSumDiff._TimeOnly = False + Me.txtSumDiff._TimeOnly_Seconds = False + Me.txtSumDiff._value = "" + Me.txtSumDiff._Waehrung = True + Me.txtSumDiff._WaehrungZeichen = True + Me.txtSumDiff.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.txtSumDiff.ForeColor = System.Drawing.Color.Black + Me.txtSumDiff.Location = New System.Drawing.Point(1179, 46) + Me.txtSumDiff.MaxLineLength = -1 + Me.txtSumDiff.MaxLines_Warning = "" + Me.txtSumDiff.MaxLines_Warning_Label = Nothing + Me.txtSumDiff.Name = "txtSumDiff" + Me.txtSumDiff.ReadOnly = True + Me.txtSumDiff.Size = New System.Drawing.Size(107, 20) + Me.txtSumDiff.TabIndex = 32 ' 'usrCntlUSTV ' @@ -385,13 +517,14 @@ Partial Class usrCntlUSTV Me.Controls.Add(Me.Panel2) Me.Controls.Add(Me.Panel1) Me.Name = "usrCntlUSTV" - Me.Size = New System.Drawing.Size(1072, 607) + Me.Size = New System.Drawing.Size(1627, 616) CType(Me.dgvUSTV, System.ComponentModel.ISupportInitialize).EndInit() Me.Panel1.ResumeLayout(False) Me.Panel1.PerformLayout() Me.Panel2.ResumeLayout(False) Me.Panel2.PerformLayout() Me.Panel3.ResumeLayout(False) + Me.Panel3.PerformLayout() Me.ResumeLayout(False) End Sub @@ -418,4 +551,11 @@ Partial Class usrCntlUSTV Friend WithEvents txtMaxSrch As VERAG_PROG_ALLGEMEIN.MyTextBox Friend WithEvents cbxEingereicht As CheckBox Friend WithEvents btnRMCalle As Button + Friend WithEvents cbxDifferenzbetrag As CheckBox + Friend WithEvents Label5 As Label + Friend WithEvents Label4 As Label + Friend WithEvents Label3 As Label + Friend WithEvents txtSumDiff As VERAG_PROG_ALLGEMEIN.MyTextBox + Friend WithEvents txtSumErst As VERAG_PROG_ALLGEMEIN.MyTextBox + Friend WithEvents txtSumUst As VERAG_PROG_ALLGEMEIN.MyTextBox End Class diff --git a/SDL/USTV/usrCntlUSTV.vb b/SDL/USTV/usrCntlUSTV.vb index cc21463d..a8b48640 100644 --- a/SDL/USTV/usrCntlUSTV.vb +++ b/SDL/USTV/usrCntlUSTV.vb @@ -111,6 +111,27 @@ Public Class usrCntlUSTV .Columns("UStVAn_Sachbearbeiter").AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill End If + Dim GesamtUSteuer As Double + Dim GesamtErstattung As Double + Dim Differnezbetrag As Double + + If KdSearchBox1.KdNr > 0 Then + GesamtUSteuer = SQL.DLookup("isnull(sum(UStVAn_USteuerbetragEUR),0)", "tblUStVAntrag", "UStVAn_KuNr='" & KdSearchBox1.KdNr & "'", "FMZOLL", "0") + GesamtErstattung = SQL.DLookup("isnull(sum(UStVAn_ErstattungsbetragEUR),0)", "tblUStVAntrag", "UStVAn_KuNr='" & KdSearchBox1.KdNr & "'", "FMZOLL", "0") + Else + For Each rows As DataGridViewRow In .Rows + If IsNumeric(rows.Cells("UStVAn_USteuerbetragEUR").Value) Then GesamtUSteuer += rows.Cells("UStVAn_USteuerbetragEUR").Value + If IsNumeric(rows.Cells("UStVAn_ErstattungsbetragEUR").Value) Then GesamtErstattung += rows.Cells("UStVAn_ErstattungsbetragEUR").Value + Next + End If + + + Differnezbetrag = GesamtUSteuer - GesamtErstattung + + txtSumUst.Text = GesamtUSteuer.ToString("C2") + txtSumErst.Text = GesamtErstattung.ToString("C2") + txtSumDiff.Text = Differnezbetrag.ToString("C2") + End With @@ -139,6 +160,14 @@ Public Class usrCntlUSTV Case CheckState.Indeterminate End Select + Select Case cbxDifferenzbetrag.CheckState + Case CheckState.Checked + whereStr &= " AND ([UStVAn_USteuerbetrag]-[UStVAn_Erstattungsbetrag]) <> 0" + Case CheckState.Unchecked + whereStr &= " AND ([UStVAn_USteuerbetrag]-[UStVAn_Erstattungsbetrag]) = 0 " + Case CheckState.Indeterminate + End Select + If KdSearchBox1.KdNr > 0 Then whereStr &= " AND UStVAn_KuNr=" & KdSearchBox1.KdNr & " " Return whereStr End Function @@ -434,7 +463,7 @@ Public Class usrCntlUSTV init() End Sub - Private Sub cbxEingereicht_CheckedChanged(sender As Object, e As EventArgs) Handles cbxEingereicht.CheckStateChanged + Private Sub cbxEingereicht_CheckedChanged(sender As Object, e As EventArgs) Handles cbxEingereicht.CheckStateChanged, cbxDifferenzbetrag.CheckStateChanged If loaded = False Then Exit Sub init() End Sub diff --git a/VERAG_PROG_ALLGEMEIN/Classes/SQL.vb b/VERAG_PROG_ALLGEMEIN/Classes/SQL.vb index 470a16b1..651d6f57 100644 --- a/VERAG_PROG_ALLGEMEIN/Classes/SQL.vb +++ b/VERAG_PROG_ALLGEMEIN/Classes/SQL.vb @@ -1,4 +1,5 @@ Imports System.Data.SqlClient +Imports DocumentFormat.OpenXml.Bibliography Public Class SQL Public Const LeerDatum As Date = #12/30/1899# @@ -21,9 +22,20 @@ Public Class SQL Public Shared Function GetADMINConnectionString() As String If VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM Then - Return My.MySettings.Default.ADMINConnectionString_DEV + Try + Return My.MySettings.Default.ADMINConnectionString_DEV + Catch ex As Exception + Return "Data Source=SQLGUIDE01.verag.ost.dmn;Initial Catalog=ADMIN;Integrated Security=false;User ID=AppUser;Password=yp/THDd?xM+pZ$;" + + End Try + Else - Return My.MySettings.Default.ADMINConnectionString_DEV + Try + Return My.MySettings.Default.ADMINConnectionString_DEV + Catch ex As Exception + Return "Data Source=SQLGUIDE01.verag.ost.dmn;Initial Catalog=ADMIN;Integrated Security=false;User ID=AppUser;Password=yp/THDd?xM+pZ$;" + + End Try End If End Function Public Shared Function GetFMZOLLConnectionString() As String diff --git a/VERAG_PROG_ALLGEMEIN/DATENSERVER/cDATENSERVER.vb b/VERAG_PROG_ALLGEMEIN/DATENSERVER/cDATENSERVER.vb index ba3a0e08..d49ceaef 100644 --- a/VERAG_PROG_ALLGEMEIN/DATENSERVER/cDATENSERVER.vb +++ b/VERAG_PROG_ALLGEMEIN/DATENSERVER/cDATENSERVER.vb @@ -11,10 +11,9 @@ Imports Spire.Pdf Imports Spire.Pdf.HtmlConverter Imports System.Threading Imports System.Net -Imports Spire.Pdf.Tables -Imports System.Windows.Forms.VisualStyles + Imports System.Text.RegularExpressions -Imports System.Runtime.InteropServices.ComTypes +Imports System.Runtime.DesignerServices Public Class cDATENSERVER @@ -1249,6 +1248,7 @@ Public Class cFormularManager Public Shared Sub PrintViaSpirePDF(PDFFile As String(), Optional printerName As String = "") Try + Dim printerPaperSizeA4 As Boolean = False If printerName = "" Then Dim sPrinters As ArrayList @@ -1263,9 +1263,22 @@ Public Class cFormularManager If VERAG_PROG_ALLGEMEIN.cAllgemein.PRINTER_STANDARD <> String.Empty Then - For i As Integer = 0 To sPrinters.Count - 1 - If i.ToString.ToLower.Contains(VERAG_PROG_ALLGEMEIN.cAllgemein.PRINTER_STANDARD.ToLower) Then - printerName = i + For Each printer In sPrinters + + If printer.ToString.ToLower.Contains(VERAG_PROG_ALLGEMEIN.cAllgemein.PRINTER_STANDARD.ToLower) Then + printerName = printer + For Each installedPrinter In System.Drawing.Printing.PrinterSettings.InstalledPrinters + If printerName = installedPrinter.ToString Then + Dim currentInstalledPrinter As New System.Drawing.Printing.PrinterSettings + currentInstalledPrinter.PrinterName = printerName + For Each sizes In currentInstalledPrinter.PaperSizes + If sizes.PaperName = "A4" Then printerPaperSizeA4 = True + Exit For + Next + Exit For + End If + Next + Exit For End If Next End If @@ -1273,14 +1286,35 @@ Public Class cFormularManager If printerName = "" Then Dim oPS As New System.Drawing.Printing.PrinterSettings printerName = oPS.PrinterName + For Each sizes In oPS.PaperSizes + If sizes.PaperName = "A4" Then printerPaperSizeA4 = True + Exit For + Next + Else + If Not printerPaperSizeA4 Then + Dim currentInstalledPrinter As New System.Drawing.Printing.PrinterSettings + currentInstalledPrinter.PrinterName = printerName + For Each sizes In currentInstalledPrinter.PaperSizes + If sizes.PaperName = "A4" Then printerPaperSizeA4 = True + Exit For + Next + End If + End If - End If + End If 'Dim docs As Spire.Pdf.PdfDocument() = {New Spire.Pdf.PdfDocument("C:\Users\DEVELOPER1\Desktop\Agrotel.pdf")} If printerName = "" Then MsgBox("Drucker konnte nicht ermittelt werden!") + Exit Sub End If + + If Not printerPaperSizeA4 Then + MsgBox("Der ermittelte Drucker " & printerName & " unterstützt keinen A4 Ausdrucke!" & vbNewLine & "Vorang wird abgebrochen!") + Exit Sub + End If + VERAG_PROG_ALLGEMEIN.cProgramFunctions.spireLoadLicense() For Each pdfPath In PDFFile Dim doc As New Spire.Pdf.PdfDocument(pdfPath) @@ -1290,7 +1324,14 @@ Public Class cFormularManager doc.PageSettings.Orientation = Spire.Pdf.PdfPageOrientation.Landscape doc.PrintSettings.SelectSinglePageLayout(PdfSinglePageScalingMode.FitSize, True) doc.PrintSettings.PrinterName = printerName - doc.Print() + + If doc.PrintSettings.IsValid Then + doc.Print() + Else + MsgBox("Druckereinstellungen ungültig!") + Exit Sub + End If + 'doc.PrintDocument.DefaultPageSettings.Landscape = True @@ -1485,8 +1526,9 @@ Public Class cFormularManager If openFileAfterDownload Then - End If End If + End If + End Using End Using diff --git a/VERAG_PROG_ALLGEMEIN/Schnittstellen/MSE/cMSEAPI.vb b/VERAG_PROG_ALLGEMEIN/Schnittstellen/MSE/cMSEAPI.vb index 4a992b2b..c1074263 100644 --- a/VERAG_PROG_ALLGEMEIN/Schnittstellen/MSE/cMSEAPI.vb +++ b/VERAG_PROG_ALLGEMEIN/Schnittstellen/MSE/cMSEAPI.vb @@ -11,7 +11,7 @@ Public Class cMSEAPI Dim SQL As New SQL Dim apiSettingsloaded As Boolean = False Dim test As Boolean = False - Public PDFRECHNUNGENPFAD As String + Dim PDFRECHNUNGENPFAD As String = "" Sub New(program As String)