diff --git a/WISAG_PM_REPORT/Form1.vb b/WISAG_PM_REPORT/Form1.vb index fb3f192..4517658 100644 --- a/WISAG_PM_REPORT/Form1.vb +++ b/WISAG_PM_REPORT/Form1.vb @@ -3,6 +3,7 @@ Imports DigitalData.Modules.Database Imports System.IO Imports System.ComponentModel Imports GdPicture14 +Imports DevExpress.DataAccess.Sql Public Class Form1 Dim MyLogger As LogConfig @@ -65,7 +66,7 @@ Public Class Form1 oDocID = oRow.Item(0).ToString Dim oSQL = $"select count(*) from VWCUST_RPTPM_INV_RPT_STAMP_CHECK WHERE docID = {oDocID.ToString}" If MySQLSDB.GetScalarValue(oSQL) >= 1 Then - Create_Report(oDocID.ToString, 0) + Create_EB_Report(oDocID.ToString, 0) Else Logger.Info($"ATTENTION - No FinalFreigabe for DocID: {oDocID.ToString}") Dim oDELETE = $"DELETE FROM TBCUST_PM_RPT_2BCREATED WHERE DocID = {oDocID} AND GEN_ID = '{My.Settings.GEN_ID}'" @@ -86,11 +87,11 @@ Public Class Form1 End Sub - Sub Create_Report(pDocID As String, ReportOption As Integer) + Sub Create_EB_Report(pDocID As String, ReportOption As Integer) MyFreigabebericht = "" MyStempel = "" MyOriginStamped = "" - Logger.Info($"Trying to create report for DocID: {pDocID}...") + Logger.Info($"#### Trying to Create_Report for DocID: {pDocID}... ####") Dim errortext As String Try If DEBUG = True Then @@ -105,14 +106,29 @@ Public Class Form1 Exit Sub End Try Try - Dim report As New XtraReport2() - report.ReportPrintOptions.PrintOnEmptyDataSource = False - report.FilterString = "DocID = " + pDocID - 'report.ObjectDataSource1.Parameters(0).Value = Convert.ToInt64(TextBox1.Text) - report.CreateDocument(False) - If DEBUG = True Then - DocumentViewer1.DocumentSource = report - End If + Dim oReport As New XtraReport2() + Dim oDatasource As SqlDataSource = oReport.DataSource + Dim oSelectQuery As CustomSqlQuery = oDatasource.Queries(0) + Dim oParameter As QueryParameter = oSelectQuery.Parameters(0) + oParameter.Value = pDocID + Try + oReport.ReportPrintOptions.PrintOnEmptyDataSource = False + oReport.FilterString = "DocID = " + pDocID + 'report.ObjectDataSource1.Parameters(0).Value = Convert.ToInt64(TextBox1.Text) + oReport.CreateDocument(False) + If DEBUG = True Then + DocumentViewer1.DocumentSource = oReport + End If + Catch ex As Exception + Dim oUpdate = $"DELETE FROM TBCUST_PM_RPT_2BCREATED WHERE DocID = {pDocID} AND GEN_ID = '{My.Settings.GEN_ID}'" + MySQLSDB.ExecuteNonQuery(oUpdate) + If DEBUG = True Then + MsgBox("Unexpected error in XtraReport2 Create", MsgBoxStyle.Critical, "Error in XtraReport2:") + End If + Logger.Warn($"Unexpected Error in XtraReport2 Create for DocID: {pDocID} - ERROR: {ex.Message}") + Exit Sub + End Try + Dim oMyErgebnisbericht As String = Path.Combine(My.Settings.CONCAT_TEMPFolder, pDocID & "_ERPT.pdf") If File.Exists(oMyErgebnisbericht) Then @@ -125,7 +141,7 @@ Public Class Form1 Exit Sub End Try End If - report.ExportToPdf(oMyErgebnisbericht) + oReport.ExportToPdf(oMyErgebnisbericht) If File.Exists(oMyErgebnisbericht) Then If ReportOption = 1 Then @@ -142,7 +158,6 @@ Public Class Form1 If Not IsNothing(oOriginFile) Then If File.Exists(My.Settings.Path2PDFTK) Then - If Create_MyStempel(DEBUG, pDocID) = True Then 'Jetzt Stempeln des OriginakBeleges mit dem Stamp-Report Dim oStampedResult = CreateStampedPDF(oOriginFile, pDocID) @@ -156,10 +171,15 @@ Public Class Form1 Dim oInsert = $"INSERT INTO TBCUST_PM_RPT_CREATED (DocID) VALUES ({Convert.ToInt64(pDocID)})" MySQLSDB.ExecuteNonQuery(oInsert) End If - Logger.Info($"Concatted file [{oStampedResult}] created!") + Logger.Info($"#### Created Ergebnisbericht for [{pDocID}]! #####") + Logger.Info($"") End If + Else + Logger.Info("!!CreateStampedPDF = False or ""!!") End If + Else + Logger.Info("!!Create_MyStempel = False!!") End If End If Else @@ -182,7 +202,8 @@ Public Class Form1 MsgBox(errortext, MsgBoxStyle.Critical, "Error in 2:") Clipboard.SetText(errortext) End If - Logger.Error(ex) + Logger.Warn($"Unexpected Error in Create_Report for DocID: {pDocID} - ERROR: {ex.Message}") + End Try End Sub Private Function Create_MyStempel(istest As Boolean, pDocID As String) @@ -204,8 +225,14 @@ Public Class Form1 End Try Try Dim myReport As New RptStampIcon() + Dim oDatasource As SqlDataSource = myReport.DataSource + Dim oSelectQuery As CustomSqlQuery = oDatasource.Queries(0) + Dim oParameter As QueryParameter = oSelectQuery.Parameters(0) + oParameter.Value = pDocID + myReport.ReportPrintOptions.PrintOnEmptyDataSource = False myReport.FilterString = "DocID = " + pDocID + 'report.ObjectDataSource1.Parameters(0).Value = Convert.ToInt64(TextBox1.Text) myReport.CreateDocument(False) If istest = True Then @@ -233,7 +260,7 @@ Public Class Form1 If File.Exists(oTempStempel) Then MyStempel = oTempStempel - Logger.Info($"Stampreport created for DocID: {pDocID}!") + Logger.Info($"...Stampreport created for DocID: {pDocID}!") If istest = True Then MsgBox($"Stampreport [{oTempStempel}] created for DocID [{pDocID}]!", MsgBoxStyle.Information) End If @@ -257,7 +284,7 @@ Public Class Form1 End Function Private Function CreateStampedPDF(oOriginFile As String, pDocID As Integer) Try - Logger.Info($"Trying to create stamp on OriginWMFile for DocID: {pDocID}...") + Logger.Info($"Trying to CreateStampedPDF for DocID: {pDocID}...") Logger.Debug($"Now in CreateStampedPDF") Dim myProcess As New Process Dim ProcID @@ -396,7 +423,7 @@ Public Class Form1 If txtDocID.Text = "" Then Exit Sub DEBUG = True MyLogger.Debug = True - Create_Report(txtDocID.Text, 0) + Create_EB_Report(txtDocID.Text, 0) End Sub Private Function Concat_Files(DocID As String, oOriginFile As String) @@ -554,7 +581,7 @@ Public Class Form1 My.Settings.Save() DEBUG = True MyLogger.Debug = True - Create_Report(txtDocID.Text, 1) + Create_EB_Report(txtDocID.Text, 1) End Sub Private Sub ToolStripButton5_Click(sender As Object, e As EventArgs) @@ -571,6 +598,10 @@ Public Class Form1 Private Sub ToolStripButton6_Click(sender As Object, e As EventArgs) Handles ToolStripButton6.Click Dim report As New RptStampIcon() + Dim oDatasource As SqlDataSource = report.DataSource + Dim oSelectQuery As CustomSqlQuery = oDatasource.Queries(0) + Dim oParameter As QueryParameter = oSelectQuery.Parameters(0) + oParameter.Value = txtDocID.Text report.ReportPrintOptions.PrintOnEmptyDataSource = False report.FilterString = "DocID = " + txtDocID.Text 'report.DocID.Value = txtDocID.Text diff --git a/WISAG_PM_REPORT/My Project/AssemblyInfo.vb b/WISAG_PM_REPORT/My Project/AssemblyInfo.vb index 5d868db..1df6b35 100644 --- a/WISAG_PM_REPORT/My Project/AssemblyInfo.vb +++ b/WISAG_PM_REPORT/My Project/AssemblyInfo.vb @@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices ' übernehmen, indem Sie "*" eingeben: ' - + diff --git a/WISAG_PM_REPORT/MyDataset.xss b/WISAG_PM_REPORT/MyDataset.xss index 87867ca..c2f70e3 100644 --- a/WISAG_PM_REPORT/MyDataset.xss +++ b/WISAG_PM_REPORT/MyDataset.xss @@ -8,9 +8,9 @@ - - - + + + \ No newline at end of file diff --git a/WISAG_PM_REPORT/RptStampIcon.Designer.vb b/WISAG_PM_REPORT/RptStampIcon.Designer.vb index dea7864..79966d4 100644 --- a/WISAG_PM_REPORT/RptStampIcon.Designer.vb +++ b/WISAG_PM_REPORT/RptStampIcon.Designer.vb @@ -20,18 +20,8 @@ Partial Public Class RptStampIcon Private Sub InitializeComponent() Me.components = New System.ComponentModel.Container() - Dim SelectQuery1 As DevExpress.DataAccess.Sql.SelectQuery = New DevExpress.DataAccess.Sql.SelectQuery() - Dim Column1 As DevExpress.DataAccess.Sql.Column = New DevExpress.DataAccess.Sql.Column() - Dim ColumnExpression1 As DevExpress.DataAccess.Sql.ColumnExpression = New DevExpress.DataAccess.Sql.ColumnExpression() - Dim Table1 As DevExpress.DataAccess.Sql.Table = New DevExpress.DataAccess.Sql.Table() - Dim Column2 As DevExpress.DataAccess.Sql.Column = New DevExpress.DataAccess.Sql.Column() - Dim ColumnExpression2 As DevExpress.DataAccess.Sql.ColumnExpression = New DevExpress.DataAccess.Sql.ColumnExpression() - Dim Column3 As DevExpress.DataAccess.Sql.Column = New DevExpress.DataAccess.Sql.Column() - Dim ColumnExpression3 As DevExpress.DataAccess.Sql.ColumnExpression = New DevExpress.DataAccess.Sql.ColumnExpression() - Dim Column4 As DevExpress.DataAccess.Sql.Column = New DevExpress.DataAccess.Sql.Column() - Dim ColumnExpression4 As DevExpress.DataAccess.Sql.ColumnExpression = New DevExpress.DataAccess.Sql.ColumnExpression() - Dim Column5 As DevExpress.DataAccess.Sql.Column = New DevExpress.DataAccess.Sql.Column() - Dim ColumnExpression5 As DevExpress.DataAccess.Sql.ColumnExpression = New DevExpress.DataAccess.Sql.ColumnExpression() + Dim CustomSqlQuery1 As DevExpress.DataAccess.Sql.CustomSqlQuery = New DevExpress.DataAccess.Sql.CustomSqlQuery() + Dim QueryParameter1 As DevExpress.DataAccess.Sql.QueryParameter = New DevExpress.DataAccess.Sql.QueryParameter() Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(RptStampIcon)) Me.SqlDataSource1 = New DevExpress.DataAccess.Sql.SqlDataSource(Me.components) Me.TopMarginBand1 = New DevExpress.XtraReports.UI.TopMarginBand() @@ -75,30 +65,13 @@ Partial Public Class RptStampIcon ' Me.SqlDataSource1.ConnectionName = "DD_ECM_ReportConnection" Me.SqlDataSource1.Name = "SqlDataSource1" - ColumnExpression1.ColumnName = "FG_TYP" - Table1.Name = "VWCUST_STAMP" - ColumnExpression1.Table = Table1 - Column1.Expression = ColumnExpression1 - ColumnExpression2.ColumnName = "DocID" - ColumnExpression2.Table = Table1 - Column2.Expression = ColumnExpression2 - ColumnExpression3.ColumnName = "Email" - ColumnExpression3.Table = Table1 - Column3.Expression = ColumnExpression3 - ColumnExpression4.ColumnName = "Freigabe" - ColumnExpression4.Table = Table1 - Column4.Expression = ColumnExpression4 - ColumnExpression5.ColumnName = "Wann" - ColumnExpression5.Table = Table1 - Column5.Expression = ColumnExpression5 - SelectQuery1.Columns.Add(Column1) - SelectQuery1.Columns.Add(Column2) - SelectQuery1.Columns.Add(Column3) - SelectQuery1.Columns.Add(Column4) - SelectQuery1.Columns.Add(Column5) - SelectQuery1.Name = "VWCUST_STAMP" - SelectQuery1.Tables.Add(Table1) - Me.SqlDataSource1.Queries.AddRange(New DevExpress.DataAccess.Sql.SqlQuery() {SelectQuery1}) + CustomSqlQuery1.Name = "VWCUST_STAMP" + QueryParameter1.Name = "pDocID" + QueryParameter1.Type = GetType(Long) + QueryParameter1.ValueInfo = "4712" + CustomSqlQuery1.Parameters.Add(QueryParameter1) + CustomSqlQuery1.Sql = resources.GetString("CustomSqlQuery1.Sql") + Me.SqlDataSource1.Queries.AddRange(New DevExpress.DataAccess.Sql.SqlQuery() {CustomSqlQuery1}) Me.SqlDataSource1.ResultSchemaSerializable = resources.GetString("SqlDataSource1.ResultSchemaSerializable") ' 'TopMarginBand1 diff --git a/WISAG_PM_REPORT/RptStampIcon.resx b/WISAG_PM_REPORT/RptStampIcon.resx index b5ad93e..f362dcf 100644 --- a/WISAG_PM_REPORT/RptStampIcon.resx +++ b/WISAG_PM_REPORT/RptStampIcon.resx @@ -120,6 +120,12 @@ 17, 17 + + select "VWCUST_STAMP"."FG_TYP", "VWCUST_STAMP"."DocID", + "VWCUST_STAMP"."Email", "VWCUST_STAMP"."Freigabe", + "VWCUST_STAMP"."Wann" + from "dbo"."VWCUST_STAMP" "VWCUST_STAMP" where "VWCUST_STAMP"."DocID" = @pDocID + PERhdGFTZXQgTmFtZT0iU3FsRGF0YVNvdXJjZTEiPjxWaWV3IE5hbWU9IlZXQ1VTVF9TVEFNUCI+PEZpZWxkIE5hbWU9IkZHX1RZUCIgVHlwZT0iU3RyaW5nIiAvPjxGaWVsZCBOYW1lPSJEb2NJRCIgVHlwZT0iSW50MzIiIC8+PEZpZWxkIE5hbWU9IkVtYWlsIiBUeXBlPSJTdHJpbmciIC8+PEZpZWxkIE5hbWU9IkZyZWlnYWJlIiBUeXBlPSJTdHJpbmciIC8+PEZpZWxkIE5hbWU9Ildhbm4iIFR5cGU9IkRhdGVUaW1lIiAvPjwvVmlldz48L0RhdGFTZXQ+ diff --git a/WISAG_PM_REPORT/XtraReport2.Designer.vb b/WISAG_PM_REPORT/XtraReport2.Designer.vb index 6cfcdf4..e52fe02 100644 --- a/WISAG_PM_REPORT/XtraReport2.Designer.vb +++ b/WISAG_PM_REPORT/XtraReport2.Designer.vb @@ -1,9 +1,9 @@ - _ + Partial Public Class XtraReport2 Inherits DevExpress.XtraReports.UI.XtraReport 'XtraReport overrides dispose to clean up the component list. - _ + Protected Overrides Sub Dispose(ByVal disposing As Boolean) If disposing AndAlso components IsNot Nothing Then components.Dispose() @@ -17,10 +17,11 @@ Partial Public Class XtraReport2 'NOTE: The following procedure is required by the Designer 'It can be modified using the Designer. 'Do not modify it using the code editor. - _ + Private Sub InitializeComponent() Me.components = New System.ComponentModel.Container() Dim CustomSqlQuery1 As DevExpress.DataAccess.Sql.CustomSqlQuery = New DevExpress.DataAccess.Sql.CustomSqlQuery() + Dim QueryParameter1 As DevExpress.DataAccess.Sql.QueryParameter = New DevExpress.DataAccess.Sql.QueryParameter() Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(XtraReport2)) Me.Detail = New DevExpress.XtraReports.UI.DetailBand() Me.XrTable2 = New DevExpress.XtraReports.UI.XRTable() @@ -188,6 +189,10 @@ Partial Public Class XtraReport2 Me.SqlDataSource1.ConnectionName = "DD_ECM_ReportConnection" Me.SqlDataSource1.Name = "SqlDataSource1" CustomSqlQuery1.Name = "VWCUST_RPTERGEBNISBERICHT" + QueryParameter1.Name = "pDocID" + QueryParameter1.Type = GetType(Long) + QueryParameter1.ValueInfo = "4712" + CustomSqlQuery1.Parameters.Add(QueryParameter1) CustomSqlQuery1.Sql = resources.GetString("CustomSqlQuery1.Sql") Me.SqlDataSource1.Queries.AddRange(New DevExpress.DataAccess.Sql.SqlQuery() {CustomSqlQuery1}) Me.SqlDataSource1.ResultSchemaSerializable = resources.GetString("SqlDataSource1.ResultSchemaSerializable") diff --git a/WISAG_PM_REPORT/XtraReport2.resx b/WISAG_PM_REPORT/XtraReport2.resx index 58b4f76..65cf178 100644 --- a/WISAG_PM_REPORT/XtraReport2.resx +++ b/WISAG_PM_REPORT/XtraReport2.resx @@ -143,7 +143,7 @@ "VWCUST_RPTERGEBNISBERICHT"."Status_Change", "VWCUST_RPTERGEBNISBERICHT"."wannPos", "VWCUST_RPTERGEBNISBERICHT"."Kommentar" - from "dbo"."VWCUST_RPTERGEBNISBERICHT" "VWCUST_RPTERGEBNISBERICHT" ORDER BY wannPos desc + from "dbo"."VWCUST_RPTERGEBNISBERICHT" "VWCUST_RPTERGEBNISBERICHT" where "VWCUST_RPTERGEBNISBERICHT"."DocID" = @pDocID ORDER BY wannPos desc PERhdGFTZXQgTmFtZT0iU3FsRGF0YVNvdXJjZTEiPjxWaWV3IE5hbWU9IlZXQ1VTVF9SUFRFUkdFQk5JU0JFUklDSFQiPjxGaWVsZCBOYW1lPSJEb2NJRCIgVHlwZT0iSW50MzIiIC8+PEZpZWxkIE5hbWU9IkRhdHVtSW4iIFR5cGU9IlN0cmluZyIgLz48RmllbGQgTmFtZT0iQmVsZWdkYXR1bSIgVHlwZT0iU3RyaW5nIiAvPjxGaWVsZCBOYW1lPSJLcmVkaXRvck51bW1lciIgVHlwZT0iU3RyaW5nIiAvPjxGaWVsZCBOYW1lPSJLcmVkaXRvck5hbWVfTGFuZyIgVHlwZT0iU3RyaW5nIiAvPjxGaWVsZCBOYW1lPSJLcmVkaXRvck5hbWUiIFR5cGU9IlN0cmluZyIgLz48RmllbGQgTmFtZT0iUmVjaG51bmdOciIgVHlwZT0iU3RyaW5nIiAvPjxGaWVsZCBOYW1lPSJSZWZlcmVueiIgVHlwZT0iU3RyaW5nIiAvPjxGaWVsZCBOYW1lPSJOZXR0b2JldHJhZyIgVHlwZT0iU3RyaW5nIiAvPjxGaWVsZCBOYW1lPSJCcnV0dG9iZXRyYWciIFR5cGU9IlN0cmluZyIgLz48RmllbGQgTmFtZT0iWmFobHVuZ3N6aWVsIiBUeXBlPSJTdHJpbmciIC8+PEZpZWxkIE5hbWU9Ik1hbmRhbnQiIFR5cGU9IlN0cmluZyIgLz48RmllbGQgTmFtZT0iTWFuZGFudCBOYW1lIiBUeXBlPSJTdHJpbmciIC8+PEZpZWxkIE5hbWU9Iktvc3RlbnN0ZWxsZSIgVHlwZT0iU3RyaW5nIiAvPjxGaWVsZCBOYW1lPSJCZXN0ZWxsTnIiIFR5cGU9IlN0cmluZyIgLz48RmllbGQgTmFtZT0iQWJzZW5kZXIiIFR5cGU9IlN0cmluZyIgLz48RmllbGQgTmFtZT0iRmluYWxlciBGcmVpZ2ViZXIiIFR5cGU9IlN0cmluZyIgLz48RmllbGQgTmFtZT0iUHJvemVzc3NjaHJpdHQiIFR5cGU9IlN0cmluZyIgLz48RmllbGQgTmFtZT0iRHVyY2giIFR5cGU9IlN0cmluZyIgLz48RmllbGQgTmFtZT0iU3RhdHVzX0NoYW5nZSIgVHlwZT0iU3RyaW5nIiAvPjxGaWVsZCBOYW1lPSJ3YW5uUG9zIiBUeXBlPSJEYXRlVGltZSIgLz48RmllbGQgTmFtZT0iS29tbWVudGFyIiBUeXBlPSJTdHJpbmciIC8+PC9WaWV3PjwvRGF0YVNldD4=