diff --git a/MultiTool.Common/Winline/Entities/ExportDocument.vb b/MultiTool.Common/Winline/Entities/ExportDocument.vb index 3967abd..06c0aa6 100644 --- a/MultiTool.Common/Winline/Entities/ExportDocument.vb +++ b/MultiTool.Common/Winline/Entities/ExportDocument.vb @@ -11,9 +11,6 @@ Namespace Winline.Entities End Get End Property - - - Public Property Kind As DocumentKind Public Property RunningNumber As String Public Property Number As String @@ -25,7 +22,6 @@ Namespace Winline.Entities Public Property IsSelected As Boolean = False Public Property IsExported As Boolean - Public Property ExportType As Integer Public Property FilenameExport As String Public Property ExportedWhen As Date Public Property ExportedWho As String diff --git a/MultiTool.Common/Winline/WinlineData.vb b/MultiTool.Common/Winline/WinlineData.vb index 889b6a3..c07f159 100644 --- a/MultiTool.Common/Winline/WinlineData.vb +++ b/MultiTool.Common/Winline/WinlineData.vb @@ -1012,9 +1012,8 @@ Namespace Winline Dim oExportedType As Integer = pDataRow.ItemEx("ALREADY_EXPORTED", 0) Dim oExportedWho As String = pDataRow.ItemEx("EXPORTED_WHO", "") Dim oExportedWhen As Date = pDataRow.ItemEx(Of Date)("EXPORTED_WHEN", Nothing) - Dim oExportFile As String = pDataRow.ItemEx("EXPORTED_FILE", "") - Dim oDocumentType2 As Integer = 0 - Dim oIsExported As Boolean = False + Dim oExportedFile As String = pDataRow.ItemEx("EXPORTED_FILE", "") + Dim oIsExported As Boolean = GetIsExported(oExportedType, pDocumentType) Dim oDocumentNumber As String = Nothing Dim oDocumentDate As Date = Nothing @@ -1033,40 +1032,24 @@ Namespace Winline oDocumentNumber = pDataRow.Item("OFFER_NUMBER") oDocumentDate = pDataRow.Item("OFFER_DATE") oDocumentDateColumn = "c027" - oDocumentType2 = Math.Abs(oDocumentType) Case 2, -2 oDocumentNumber = pDataRow.Item("ORDER_NUMBER") oDocumentDate = pDataRow.Item("ORDER_DATE") oDocumentDateColumn = "c028" - oDocumentType2 = Math.Abs(oDocumentType) Case 3, -3 oDocumentNumber = pDataRow.Item("DELIVERY_NUMBER") oDocumentDate = pDataRow.Item("DELIVERY_DATE") oDocumentDateColumn = "c029" - oDocumentType2 = Math.Abs(oDocumentType) Case 4, -4 oDocumentNumber = pDataRow.Item("INVOICE_NUMBER") oDocumentDate = pDataRow.Item("INVOICE_DATE") oDocumentDateColumn = "c032" - oDocumentType2 = Math.Abs(oDocumentType) 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 { .Account = oAccount, .RunningNumber = oRunningNumber, @@ -1078,14 +1061,29 @@ Namespace Winline .NetAmount = oNetAmount, .ExportedWhen = oExportedWhen, .ExportedWho = oExportedWho, - .FilenameExport = oExportFile, - .ExportType = oDocumentType2, + .FilenameExport = oExportedFile, .IsExported = oIsExported } Return oDocument End Function + Private Function GetIsExported(pExportedType As Integer, pDocumentType As DocumentType) As Boolean + Dim oIsExported = False + + If pExportedType = 1 AndAlso (pDocumentType = DocumentType.IncomingOffer Or pDocumentType = DocumentType.OutgoingOffer) Then + oIsExported = True + ElseIf pExportedType = 2 AndAlso (pDocumentType = DocumentType.IncomingOrder Or pDocumentType = DocumentType.OutgoingOrder) Then + oIsExported = True + ElseIf pExportedType = 3 AndAlso (pDocumentType = DocumentType.IncomingDeliveryNote Or pDocumentType = DocumentType.OutgoingDeliveryNote) Then + oIsExported = True + ElseIf pExportedType = 4 AndAlso (pDocumentType = DocumentType.IncomingInvoice Or pDocumentType = DocumentType.OutgoingInvoice) Then + oIsExported = True + End If + + Return oIsExported + End Function + ''' ''' Turns a database info like "SQLCWLDATEN on SERVER\INSTANCE" into a Tuple of two strings '''