Improve config screen, add waiting days

This commit is contained in:
Jonathan Jenne
2022-03-31 11:57:54 +02:00
parent f289a1d34c
commit 147f72b8a3
9 changed files with 488 additions and 72 deletions

View File

@@ -420,6 +420,12 @@ Namespace Documents
Dim oArticleNumberField As String = oFieldMap.GetOrDefault("Article", Nothing)
Dim oArticleNumber As String = pRow.Fields.Item(oArticleNumberField).Final
Dim oQuantityField As String = oFieldMap.GetOrDefault("Quantity", Nothing)
Dim oQuantity As Integer = 1
If Integer.TryParse(pRow.Fields.Item(oQuantityField).Final, oQuantity) = False Then
Logger.Warn("Value for parameter Quantity could not be parsed. Setting to 1.")
End If
' These fields a fetched from the head row, ie. the first row
Dim oAccountNumberField As String = oFieldMap.GetOrDefault("Account", Nothing)
Dim oAccountNumber = pDocument.GetFieldValue(oAccountNumberField)
@@ -427,12 +433,21 @@ Namespace Documents
Dim oDocumentDateField As String = oFieldMap.GetOrDefault("DocumentDate", Nothing)
Dim oDocumentDate = pDocument.GetFieldValue(oDocumentDateField)
Dim oDocumentKindField As String = oFieldMap.GetOrDefault("DocumentKind", Nothing)
Dim oDocumentKind As Integer = 0
If Integer.TryParse(pDocument.GetFieldValue(oDocumentKindField), oDocumentKind) Then
Logger.Warn("Value for parameter DocumentKind could not be parsed. Setting to 0.")
End If
' TODO: Add Field Names as Constants
' TODO: Check for missing values
Dim oQuantity As Integer = 1
' TODO: This function should not be hardcoded, but be replaced with virtual field or something..
' It is related to customer SCHAUM and nothing general
Dim oWaitingDays As Integer = Await Winline.TryGetWaitingDays(oDocumentKind, pMandator)
' END TODO
Dim oArticlePrice As Double = Await Winline.TryGetArticlePrice(oArticleNumber, oAccountNumber, oQuantity, oDocumentDate, pMandator, pTemplate)
Dim oArticlePrice As Double = Await Winline.TryGetArticlePrice(oArticleNumber, oAccountNumber, oQuantity, oDocumentDate, pMandator, pTemplate, oWaitingDays)
If oArticlePrice > 0 Then
oPriceItem.External = oArticlePrice