Fix DocumentTypes for Exports, Prepare Price calculation, load template parameters
This commit is contained in:
@@ -89,7 +89,13 @@ Public Class frmExportMain
|
||||
Select(AddressOf MapDocumentTypeFromEnum).
|
||||
ToList()
|
||||
|
||||
Dim oDocType = CurrentTemplate.GetParameter("DOCTYPE")
|
||||
Dim oPreselectedDocType As Integer = 0
|
||||
If oDocType IsNot Nothing Then
|
||||
Integer.TryParse(oDocType, oPreselectedDocType)
|
||||
End If
|
||||
|
||||
comboDocumentType.EditValue = oPreselectedDocType
|
||||
|
||||
If ConfigManager.Config.LastUsedMandator <> "" Then
|
||||
lookupMandator.EditValue = Winline.Mandators.
|
||||
@@ -101,8 +107,15 @@ Public Class frmExportMain
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Private Function MapDocumentTypeToEnum(Of T)(pValue As Integer) As T
|
||||
Return [Enum].Parse(GetType(T), pValue)
|
||||
End Function
|
||||
|
||||
Private Function MapDocumentTypeFromEnum(pValue As WinlineData.DocumentType)
|
||||
Select Case pValue
|
||||
Case WinlineData.DocumentType.Undefined
|
||||
Return New KeyValuePair(Of String, Integer)("Alle", pValue)
|
||||
|
||||
Case WinlineData.DocumentType.IncomingOffer
|
||||
Return New KeyValuePair(Of String, Integer)("Angebot EK", pValue)
|
||||
|
||||
@@ -156,7 +169,7 @@ Public Class frmExportMain
|
||||
ConfigManager.Save()
|
||||
End Sub
|
||||
|
||||
Private Sub lookup_Properties_ButtonClick(sender As Object, e As DevExpress.XtraEditors.Controls.ButtonPressedEventArgs) Handles comboDocumentKind.Properties.ButtonClick, lookupAccount.Properties.ButtonClick, comboDocumentType.ButtonClick
|
||||
Private Sub lookup_Properties_ButtonClick(sender As Object, e As DevExpress.XtraEditors.Controls.ButtonPressedEventArgs) Handles lookupAccount.Properties.ButtonClick
|
||||
Dim oLookup As GridLookUpEdit = sender
|
||||
If e.Button.Kind = DevExpress.XtraEditors.Controls.ButtonPredefines.Clear Then
|
||||
oLookup.EditValue = Nothing
|
||||
@@ -170,9 +183,6 @@ Public Class frmExportMain
|
||||
End If
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
|
||||
Private Sub SearchDocuments()
|
||||
Try
|
||||
dateDocDateFrom.DoValidate()
|
||||
@@ -189,6 +199,7 @@ Public Class frmExportMain
|
||||
Dim oDocNumberFrom = Utils.NotNull(txtDocumentFrom.EditValue, String.Empty)
|
||||
Dim oDocNumberTo = Utils.NotNull(txtDocumentTo.EditValue, String.Empty)
|
||||
|
||||
Dim oDocType As WinlineData.DocumentType = MapDocumentTypeToEnum(Of WinlineData.DocumentType)(comboDocumentType.EditValue)
|
||||
|
||||
If oMandator Is Nothing Then
|
||||
FormHelper.ShowWarning("Bitte einen Mandanten auswählen!")
|
||||
@@ -196,7 +207,7 @@ Public Class frmExportMain
|
||||
End If
|
||||
|
||||
'TODO: Make Document Type configurable
|
||||
Dim oDocuments = Winline.GetDocuments(oMandator, CurrentTemplate, comboDocumentType.EditValue, New WinlineData.GetDocumentArgs With {
|
||||
Dim oDocuments = Winline.GetDocuments(oMandator, CurrentTemplate, oDocType, New WinlineData.GetDocumentArgs With {
|
||||
.Account = oAccount,
|
||||
.Kinds = oKinds,
|
||||
.DateFrom = oDateFrom,
|
||||
|
||||
Reference in New Issue
Block a user