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 Property Schema As Templates.Template
|
||||
|
||||
@@ -9,6 +11,9 @@
|
||||
End Get
|
||||
End Property
|
||||
|
||||
|
||||
|
||||
|
||||
Public Property Kind As DocumentKind
|
||||
Public Property RunningNumber As String
|
||||
Public Property Number As String
|
||||
@@ -18,8 +23,9 @@
|
||||
Public Property GrossAmount As Double
|
||||
|
||||
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 ExportedWhen As Date
|
||||
Public Property ExportedWho As String
|
||||
|
||||
@@ -896,7 +896,7 @@ Namespace Winline
|
||||
|
||||
For Each oRow As DataRow In oTable.Rows
|
||||
Try
|
||||
Dim oDocument = GetDocumentFromDataRow(oRow)
|
||||
Dim oDocument = GetDocumentFromDataRow(oRow, pDocumentType)
|
||||
oDocument.Schema = pTemplate
|
||||
oDocuments.Add(oDocument)
|
||||
|
||||
@@ -1001,17 +1001,20 @@ Namespace Winline
|
||||
End Try
|
||||
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 oRunningNumber As String = pDataRow.Item("RUNNING_NUMBER")
|
||||
Dim oDocumentType As Integer = pDataRow.Item("DOCUMENT_TYPE")
|
||||
Dim oDocumentKind As Integer = pDataRow.Item("DOCUMENT_KIND")
|
||||
Dim oGrossAmount As Double = pDataRow.Item("GROSS_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 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 oDocumentNumber As String = Nothing
|
||||
Dim oDocumentDate As Date = Nothing
|
||||
@@ -1030,21 +1033,40 @@ 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,
|
||||
@@ -1054,10 +1076,11 @@ Namespace Winline
|
||||
.Kind = oKind,
|
||||
.GrossAmount = oGrossAmount,
|
||||
.NetAmount = oNetAmount,
|
||||
.IsExported = oExported,
|
||||
.ExportedWhen = oExportedWhen,
|
||||
.ExportedWho = oExportedWho,
|
||||
.FilenameExport = oExportFile
|
||||
.FilenameExport = oExportFile,
|
||||
.ExportType = oDocumentType2,
|
||||
.IsExported = oIsExported
|
||||
}
|
||||
|
||||
Return oDocument
|
||||
|
||||
@@ -244,8 +244,6 @@ Public Class frmExportMain
|
||||
If oFinalSqlResult = False Then
|
||||
Throw New DatabaseException("FinalSQL was not executed successfully!")
|
||||
End If
|
||||
|
||||
oDocument.IsExported = True
|
||||
Next
|
||||
|
||||
MsgBox($"{oExportCount} Dateien wurden erfolgreich exportiert!", MsgBoxStyle.Information, Text)
|
||||
|
||||
Reference in New Issue
Block a user