Constraints for search export documents
This commit is contained in:
@@ -4,6 +4,7 @@ Imports DigitalData.GUIs.Common
|
||||
Imports DigitalData.Modules.Config
|
||||
Imports DigitalData.Modules.Database
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports DigitalData.Modules.Language
|
||||
Imports MultiTool.Shared
|
||||
Imports MultiTool.Shared.Templates
|
||||
Imports MultiTool.Shared.Exceptions
|
||||
@@ -81,6 +82,15 @@ Public Class frmExportMain
|
||||
lookupDocumentKind.ForceInitialize()
|
||||
lookupDocumentKind.Properties.View.BestFitColumns()
|
||||
|
||||
comboDocumentType.Properties.DisplayMember = "Key"
|
||||
comboDocumentType.Properties.ValueMember = "Value"
|
||||
comboDocumentType.Properties.DataSource = [Enum].
|
||||
GetValues(GetType(WinlineData.DocumentType)).
|
||||
Cast(Of WinlineData.DocumentType)().
|
||||
Select(AddressOf MapDocumentTypeFromEnum).
|
||||
ToList()
|
||||
|
||||
|
||||
If ConfigManager.Config.LastUsedMandator <> "" Then
|
||||
lookupMandator.EditValue = Winline.Mandators.
|
||||
Where(Function(mandator) mandator.Id = ConfigManager.Config.LastUsedMandator).
|
||||
@@ -91,6 +101,38 @@ Public Class frmExportMain
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Private Function MapDocumentTypeFromEnum(pValue As WinlineData.DocumentType)
|
||||
Select Case pValue
|
||||
Case WinlineData.DocumentType.IncomingOffer
|
||||
Return New KeyValuePair(Of String, Integer)("Angebot EK", pValue)
|
||||
|
||||
Case WinlineData.DocumentType.IncomingOrder
|
||||
Return New KeyValuePair(Of String, Integer)("Auftrag EK", pValue)
|
||||
|
||||
Case WinlineData.DocumentType.IncomingDeliveryNote
|
||||
Return New KeyValuePair(Of String, Integer)("Lieferschein EK", pValue)
|
||||
|
||||
Case WinlineData.DocumentType.IncomingInvoice
|
||||
Return New KeyValuePair(Of String, Integer)("Rechnung EK", pValue)
|
||||
|
||||
Case WinlineData.DocumentType.OutgoingOffer
|
||||
Return New KeyValuePair(Of String, Integer)("Angebot VK", pValue)
|
||||
|
||||
Case WinlineData.DocumentType.OutgoingOrder
|
||||
Return New KeyValuePair(Of String, Integer)("Auftrag VK", pValue)
|
||||
|
||||
Case WinlineData.DocumentType.OutgoingDeliveryNote
|
||||
Return New KeyValuePair(Of String, Integer)("Lieferschein VK", pValue)
|
||||
|
||||
Case WinlineData.DocumentType.OutgoingInvoice
|
||||
Return New KeyValuePair(Of String, Integer)("Rechnung VK", pValue)
|
||||
|
||||
Case Else
|
||||
Return Nothing
|
||||
|
||||
End Select
|
||||
End Function
|
||||
|
||||
Private Sub BarButtonItem1_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem1.ItemClick
|
||||
SearchDocuments()
|
||||
End Sub
|
||||
@@ -109,7 +151,7 @@ Public Class frmExportMain
|
||||
End Sub
|
||||
|
||||
Private Sub lookup_Properties_ButtonClick(sender As Object, e As DevExpress.XtraEditors.Controls.ButtonPressedEventArgs) _
|
||||
Handles lookupDocumentKind.Properties.ButtonClick, lookupAccount.Properties.ButtonClick
|
||||
Handles lookupDocumentKind.Properties.ButtonClick, lookupAccount.Properties.ButtonClick, comboDocumentType.ButtonClick
|
||||
Dim oLookup As GridLookUpEdit = sender
|
||||
If e.Button.Kind = DevExpress.XtraEditors.Controls.ButtonPredefines.Clear Then
|
||||
oLookup.EditValue = Nothing
|
||||
@@ -120,37 +162,32 @@ Public Class frmExportMain
|
||||
|
||||
Private Sub SearchDocuments()
|
||||
Try
|
||||
dateDocDateFrom.DoValidate()
|
||||
dateDocDateTo.DoValidate()
|
||||
|
||||
Dim oMandator = lookupMandator.EditValue
|
||||
Dim oAccount = lookupAccount.EditValue
|
||||
Dim oKind = lookupDocumentKind.EditValue
|
||||
Dim oDateRanges = dateDocDate.SelectedRanges
|
||||
Dim oDateFrom = dateDocDateFrom.EditValue
|
||||
Dim oDateTo = dateDocDateTo.EditValue
|
||||
Dim oShowExported = chkShowExported.Checked
|
||||
Dim oDocNumberFrom = Utils.NotNull(txtDocumentFrom.EditValue, String.Empty)
|
||||
Dim oDocNumberTo = Utils.NotNull(txtDocumentTo.EditValue, String.Empty)
|
||||
|
||||
If oMandator Is Nothing Then
|
||||
FormHelper.ShowWarning("Bitte einen Mandanten auswählen!")
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
If oDateRanges.Count > 1 Then
|
||||
FormHelper.ShowWarning("Bitte nur einen Datumsbereich auswählen!")
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Dim oStartDate As Date = Nothing
|
||||
Dim oEndDate As Date = Nothing
|
||||
If oDateRanges.Count > 0 Then
|
||||
Dim oRange = oDateRanges.First()
|
||||
oStartDate = oRange.StartDate
|
||||
oEndDate = oRange.EndDate
|
||||
End If
|
||||
|
||||
'TODO: Make Document Type configurable
|
||||
Dim oDocuments = Winline.GetDocuments(oMandator, CurrentTemplate, WinlineData.DocumentType.Order, New WinlineData.GetDocumentArgs With {
|
||||
Dim oDocuments = Winline.GetDocuments(oMandator, CurrentTemplate, comboDocumentType.EditValue, New WinlineData.GetDocumentArgs With {
|
||||
.Account = oAccount,
|
||||
.Kind = oKind,
|
||||
.DateFrom = oStartDate,
|
||||
.DateTo = oEndDate,
|
||||
.ShowExported = oShowExported
|
||||
.DateFrom = oDateFrom,
|
||||
.DateTo = oDateTo,
|
||||
.ShowExported = oShowExported,
|
||||
.DocNumberFrom = oDocNumberFrom,
|
||||
.DocNumberTo = oDocNumberTo
|
||||
})
|
||||
|
||||
GridControlDocuments.DataSource = oDocuments
|
||||
|
||||
Reference in New Issue
Block a user