First attempt at fixing documenttype dependent export status
This commit is contained in:
@@ -1,4 +1,6 @@
|
|||||||
Namespace Winline.Entities
|
Imports MultiTool.Common.Winline.WinlineData
|
||||||
|
|
||||||
|
Namespace Winline.Entities
|
||||||
Public Class ExportDocument
|
Public Class ExportDocument
|
||||||
Public Property Schema As Templates.Template
|
Public Property Schema As Templates.Template
|
||||||
|
|
||||||
@@ -9,6 +11,9 @@
|
|||||||
End Get
|
End Get
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Public Property Kind As DocumentKind
|
Public Property Kind As DocumentKind
|
||||||
Public Property RunningNumber As String
|
Public Property RunningNumber As String
|
||||||
Public Property Number As String
|
Public Property Number As String
|
||||||
@@ -18,8 +23,9 @@
|
|||||||
Public Property GrossAmount As Double
|
Public Property GrossAmount As Double
|
||||||
|
|
||||||
Public Property IsSelected As Boolean = False
|
Public Property IsSelected As Boolean = False
|
||||||
Public Property IsExported As Boolean = False
|
Public Property IsExported As Boolean
|
||||||
|
|
||||||
|
Public Property ExportType As Integer
|
||||||
Public Property FilenameExport As String
|
Public Property FilenameExport As String
|
||||||
Public Property ExportedWhen As Date
|
Public Property ExportedWhen As Date
|
||||||
Public Property ExportedWho As String
|
Public Property ExportedWho As String
|
||||||
|
|||||||
@@ -896,7 +896,7 @@ Namespace Winline
|
|||||||
|
|
||||||
For Each oRow As DataRow In oTable.Rows
|
For Each oRow As DataRow In oTable.Rows
|
||||||
Try
|
Try
|
||||||
Dim oDocument = GetDocumentFromDataRow(oRow)
|
Dim oDocument = GetDocumentFromDataRow(oRow, pDocumentType)
|
||||||
oDocument.Schema = pTemplate
|
oDocument.Schema = pTemplate
|
||||||
oDocuments.Add(oDocument)
|
oDocuments.Add(oDocument)
|
||||||
|
|
||||||
@@ -1001,17 +1001,20 @@ Namespace Winline
|
|||||||
End Try
|
End Try
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Private Function GetDocumentFromDataRow(pDataRow As DataRow) As ExportDocument
|
Private Function GetDocumentFromDataRow(pDataRow As DataRow, pDocumentType As DocumentType) As ExportDocument
|
||||||
Dim oAccountNumber = pDataRow.Item("ACCOUNT_NUMBER")
|
Dim oAccountNumber = pDataRow.Item("ACCOUNT_NUMBER")
|
||||||
Dim oRunningNumber As String = pDataRow.Item("RUNNING_NUMBER")
|
Dim oRunningNumber As String = pDataRow.Item("RUNNING_NUMBER")
|
||||||
Dim oDocumentType As Integer = pDataRow.Item("DOCUMENT_TYPE")
|
Dim oDocumentType As Integer = pDataRow.Item("DOCUMENT_TYPE")
|
||||||
Dim oDocumentKind As Integer = pDataRow.Item("DOCUMENT_KIND")
|
Dim oDocumentKind As Integer = pDataRow.Item("DOCUMENT_KIND")
|
||||||
Dim oGrossAmount As Double = pDataRow.Item("GROSS_AMOUNT")
|
Dim oGrossAmount As Double = pDataRow.Item("GROSS_AMOUNT")
|
||||||
Dim oNetAmount As Double = pDataRow.Item("NET_AMOUNT")
|
Dim oNetAmount As Double = pDataRow.Item("NET_AMOUNT")
|
||||||
Dim oExported As Boolean = pDataRow.ItemEx("ALREADY_EXPORTED", False)
|
|
||||||
|
Dim oExportedType As Integer = pDataRow.ItemEx("ALREADY_EXPORTED", 0)
|
||||||
Dim oExportedWho As String = pDataRow.ItemEx("EXPORTED_WHO", "")
|
Dim oExportedWho As String = pDataRow.ItemEx("EXPORTED_WHO", "")
|
||||||
Dim oExportedWhen As Date = pDataRow.ItemEx(Of Date)("EXPORTED_WHEN", Nothing)
|
Dim oExportedWhen As Date = pDataRow.ItemEx(Of Date)("EXPORTED_WHEN", Nothing)
|
||||||
Dim oExportFile As String = pDataRow.ItemEx("EXPORTED_FILE", "")
|
Dim oExportFile As String = pDataRow.ItemEx("EXPORTED_FILE", "")
|
||||||
|
Dim oDocumentType2 As Integer = 0
|
||||||
|
Dim oIsExported As Boolean = False
|
||||||
|
|
||||||
Dim oDocumentNumber As String = Nothing
|
Dim oDocumentNumber As String = Nothing
|
||||||
Dim oDocumentDate As Date = Nothing
|
Dim oDocumentDate As Date = Nothing
|
||||||
@@ -1030,21 +1033,40 @@ Namespace Winline
|
|||||||
oDocumentNumber = pDataRow.Item("OFFER_NUMBER")
|
oDocumentNumber = pDataRow.Item("OFFER_NUMBER")
|
||||||
oDocumentDate = pDataRow.Item("OFFER_DATE")
|
oDocumentDate = pDataRow.Item("OFFER_DATE")
|
||||||
oDocumentDateColumn = "c027"
|
oDocumentDateColumn = "c027"
|
||||||
|
oDocumentType2 = Math.Abs(oDocumentType)
|
||||||
|
|
||||||
Case 2, -2
|
Case 2, -2
|
||||||
oDocumentNumber = pDataRow.Item("ORDER_NUMBER")
|
oDocumentNumber = pDataRow.Item("ORDER_NUMBER")
|
||||||
oDocumentDate = pDataRow.Item("ORDER_DATE")
|
oDocumentDate = pDataRow.Item("ORDER_DATE")
|
||||||
oDocumentDateColumn = "c028"
|
oDocumentDateColumn = "c028"
|
||||||
|
oDocumentType2 = Math.Abs(oDocumentType)
|
||||||
|
|
||||||
Case 3, -3
|
Case 3, -3
|
||||||
oDocumentNumber = pDataRow.Item("DELIVERY_NUMBER")
|
oDocumentNumber = pDataRow.Item("DELIVERY_NUMBER")
|
||||||
oDocumentDate = pDataRow.Item("DELIVERY_DATE")
|
oDocumentDate = pDataRow.Item("DELIVERY_DATE")
|
||||||
oDocumentDateColumn = "c029"
|
oDocumentDateColumn = "c029"
|
||||||
|
oDocumentType2 = Math.Abs(oDocumentType)
|
||||||
|
|
||||||
Case 4, -4
|
Case 4, -4
|
||||||
oDocumentNumber = pDataRow.Item("INVOICE_NUMBER")
|
oDocumentNumber = pDataRow.Item("INVOICE_NUMBER")
|
||||||
oDocumentDate = pDataRow.Item("INVOICE_DATE")
|
oDocumentDate = pDataRow.Item("INVOICE_DATE")
|
||||||
oDocumentDateColumn = "c032"
|
oDocumentDateColumn = "c032"
|
||||||
|
oDocumentType2 = Math.Abs(oDocumentType)
|
||||||
|
|
||||||
End Select
|
End Select
|
||||||
|
|
||||||
|
'---
|
||||||
|
If oExportedType = 1 AndAlso (pDocumentType = DocumentType.IncomingOffer Or pDocumentType = DocumentType.OutgoingOffer) Then
|
||||||
|
oIsExported = True
|
||||||
|
ElseIf oExportedType = 2 AndAlso (pDocumentType = DocumentType.IncomingOrder Or pDocumentType = DocumentType.OutgoingOrder) Then
|
||||||
|
oIsExported = True
|
||||||
|
ElseIf oExportedType = 3 AndAlso (pDocumentType = DocumentType.IncomingDeliveryNote Or pDocumentType = DocumentType.OutgoingDeliveryNote) Then
|
||||||
|
oIsExported = True
|
||||||
|
ElseIf oExportedType = 4 AndAlso (pDocumentType = DocumentType.IncomingInvoice Or pDocumentType = DocumentType.OutgoingInvoice) Then
|
||||||
|
oIsExported = True
|
||||||
|
End If
|
||||||
|
'---
|
||||||
|
|
||||||
Dim oDocument As New ExportDocument With {
|
Dim oDocument As New ExportDocument With {
|
||||||
.Account = oAccount,
|
.Account = oAccount,
|
||||||
.RunningNumber = oRunningNumber,
|
.RunningNumber = oRunningNumber,
|
||||||
@@ -1054,10 +1076,11 @@ Namespace Winline
|
|||||||
.Kind = oKind,
|
.Kind = oKind,
|
||||||
.GrossAmount = oGrossAmount,
|
.GrossAmount = oGrossAmount,
|
||||||
.NetAmount = oNetAmount,
|
.NetAmount = oNetAmount,
|
||||||
.IsExported = oExported,
|
|
||||||
.ExportedWhen = oExportedWhen,
|
.ExportedWhen = oExportedWhen,
|
||||||
.ExportedWho = oExportedWho,
|
.ExportedWho = oExportedWho,
|
||||||
.FilenameExport = oExportFile
|
.FilenameExport = oExportFile,
|
||||||
|
.ExportType = oDocumentType2,
|
||||||
|
.IsExported = oIsExported
|
||||||
}
|
}
|
||||||
|
|
||||||
Return oDocument
|
Return oDocument
|
||||||
|
|||||||
@@ -244,8 +244,6 @@ Public Class frmExportMain
|
|||||||
If oFinalSqlResult = False Then
|
If oFinalSqlResult = False Then
|
||||||
Throw New DatabaseException("FinalSQL was not executed successfully!")
|
Throw New DatabaseException("FinalSQL was not executed successfully!")
|
||||||
End If
|
End If
|
||||||
|
|
||||||
oDocument.IsExported = True
|
|
||||||
Next
|
Next
|
||||||
|
|
||||||
MsgBox($"{oExportCount} Dateien wurden erfolgreich exportiert!", MsgBoxStyle.Information, Text)
|
MsgBox($"{oExportCount} Dateien wurden erfolgreich exportiert!", MsgBoxStyle.Information, Text)
|
||||||
|
|||||||
Reference in New Issue
Block a user