WIP
This commit is contained in:
@@ -14,6 +14,7 @@ Imports ImporterShared.Documents
|
||||
Imports ImporterShared.Winline
|
||||
Imports ImporterShared.Schemas
|
||||
Imports ImporterForm.Positions
|
||||
Imports DevExpress.XtraLayout
|
||||
|
||||
Public Class frmMain
|
||||
Public LogConfig As LogConfig
|
||||
@@ -22,6 +23,7 @@ Public Class frmMain
|
||||
Public Database As MSSQLServer
|
||||
Public DocumentLoader As DocumentLoader
|
||||
Public GridBuilder As GridBuilder
|
||||
Public PositionData As PositionData
|
||||
|
||||
Public Winline As Data
|
||||
Public WebService As WebService
|
||||
@@ -57,11 +59,13 @@ Public Class frmMain
|
||||
Database = New MSSQLServer(LogConfig, oConnectionString)
|
||||
Winline = New Data(LogConfig, Database, ConfigManager.Config)
|
||||
WebService = New WebService(LogConfig, ConfigManager.Config)
|
||||
PositionData = New PositionData(LogConfig, Winline)
|
||||
|
||||
' Load WinLine Data
|
||||
Winline.Mandators.Clear()
|
||||
Winline.LoadMandators()
|
||||
Winline.LoadEconomicYears()
|
||||
Winline.LoadDocumentKinds(Winline.Mandators)
|
||||
For Each oMandator In Winline.Mandators
|
||||
Winline.LoadAccounts(oMandator)
|
||||
Next
|
||||
@@ -69,8 +73,6 @@ Public Class frmMain
|
||||
' Load data for UI Fields
|
||||
cmbMandator.Properties.DataSource = Winline.Mandators
|
||||
|
||||
cmbCustomer.Properties.DataSource = Winline.Accounts
|
||||
cmbDeliveryAddress.Properties.DataSource = Winline.Accounts
|
||||
|
||||
cmbYears.Properties.Items.AddRange(Winline.Years)
|
||||
cmbYears.SelectedItem = ConfigManager.Config.GetYear()
|
||||
@@ -222,9 +224,6 @@ Public Class frmMain
|
||||
txtOrderIssuer.Text = oHead.Fakt_Ansprechpartner
|
||||
txtOrderNumber.Text = oHead.AuftragsBestellnummer
|
||||
|
||||
' TODO: Get Doc Kind from Winline Class
|
||||
cmdDocumentKind.Text = oHead.Belegart
|
||||
|
||||
txtDocumentReference.Text = oHead.Auftragsreferenz
|
||||
dateOrderDate.EditValue = oHead.Datum_AuftragBestellung
|
||||
|
||||
@@ -235,52 +234,77 @@ Public Class frmMain
|
||||
SingleOrDefault()
|
||||
cmbMandator.EditValue = oMandator
|
||||
|
||||
' --- Find DocumentKinds ---------------------------------------------------------------------------------
|
||||
|
||||
Dim oMandatorKinds = Winline.DocumentKinds.
|
||||
Where(Function(k) k.Mandator = oMandator.Id).
|
||||
ToList()
|
||||
Dim oSelectedKind = oMandatorKinds.
|
||||
Where(Function(k) k.Id.ToString = oHead.Belegart).
|
||||
SingleOrDefault()
|
||||
|
||||
cmbDocumentKind.Properties.Items.Clear()
|
||||
cmbDocumentKind.Properties.Items.AddRange(oMandatorKinds)
|
||||
cmbDocumentKind.SelectedItem = oSelectedKind
|
||||
|
||||
' --- Find Accounts --------------------------------------------------------------------------------------
|
||||
|
||||
Dim oMandatorAccounts = Winline.Accounts.
|
||||
Where(Function(a) a.Mandator = oMandator.Id).
|
||||
ToList()
|
||||
cmbCustomer.Properties.DataSource = oMandatorAccounts
|
||||
cmbDeliveryAddress.Properties.DataSource = oMandatorAccounts
|
||||
|
||||
' FAKTURA
|
||||
|
||||
If oHead.Fakt_Kontonummer = oHeadOriginal.Fakt_Kontonummer Then
|
||||
cmbCustomer.ErrorText = GetValidationMessage("Faktura Konto")
|
||||
cmbCustomer.EditValue = Nothing
|
||||
Else
|
||||
Dim oMatchingAccounts = Winline.Accounts.
|
||||
Where(Function(oAccount) oAccount.Mandator = oMandator.Id).
|
||||
Dim oMatchingAccounts = oMandatorAccounts.
|
||||
Where(Function(oAccount) oAccount.Id = oHead.Fakt_Kontonummer)
|
||||
|
||||
If oMatchingAccounts.Count() > 1 Then
|
||||
Throw New Exceptions.MultipleAccountsException("Für die Kontonummer wurden mehrere Konten gefunden.")
|
||||
cmbCustomer.EditValue = Nothing
|
||||
cmbCustomer.ErrorText = "Für die Kontonummer wurden mehrere Konten gefunden."
|
||||
ElseIf oMatchingAccounts.Count() = 0 Then
|
||||
cmbCustomer.EditValue = Nothing
|
||||
cmbCustomer.ErrorText = "Für die Kontonummer wurde kein Konto gefunden."
|
||||
Else
|
||||
cmbCustomer.EditValue = oMatchingAccounts.SingleOrDefault()
|
||||
End If
|
||||
|
||||
If oMatchingAccounts.Count() = 0 Then
|
||||
Throw New Exceptions.NoAccountException("Für die Kontonummer wurde kein Konto gefunden.")
|
||||
End If
|
||||
|
||||
cmbCustomer.EditValue = oMatchingAccounts.SingleOrDefault()
|
||||
|
||||
End If
|
||||
|
||||
' DEVLIERY
|
||||
If oHead.Lief_Kontonummer = oHeadOriginal.Lief_Kontonummer Then
|
||||
cmbDeliveryAddress.ErrorText = GetValidationMessage("Lieferanten Konto")
|
||||
cmbDeliveryAddress.EditValue = Nothing
|
||||
If oHeadOriginal.Lief_Kontonummer = String.Empty Then
|
||||
txtPlace.EditValue = oHeadOriginal.Lief_Ort
|
||||
txtZIP.EditValue = oHeadOriginal.Lief_PLZ
|
||||
txtStreetName.EditValue = oHeadOriginal.Lief_Strasse
|
||||
txtName.EditValue = oHeadOriginal.Lief_Name
|
||||
Else
|
||||
cmbDeliveryAddress.ErrorText = GetValidationMessage("Lieferanten Konto")
|
||||
cmbDeliveryAddress.EditValue = Nothing
|
||||
End If
|
||||
Else
|
||||
Dim oMatchingAccounts = Winline.Accounts.
|
||||
Where(Function(oAccount) oAccount.Mandator = oMandator.Id).
|
||||
Dim oMatchingAccounts = oMandatorAccounts.
|
||||
Where(Function(oAccount) oAccount.Id = oHead.Lief_Kontonummer)
|
||||
|
||||
If oMatchingAccounts.Count() > 1 Then
|
||||
Throw New Exceptions.MultipleAccountsException("Für die Kontonummer wurden mehrere Konten gefunden.")
|
||||
cmbCustomer.EditValue = Nothing
|
||||
cmbCustomer.ErrorText = "Für die Kontonummer wurden mehrere Konten gefunden."
|
||||
ElseIf oMatchingAccounts.Count() = 0 Then
|
||||
cmbCustomer.EditValue = Nothing
|
||||
cmbCustomer.ErrorText = "Für die Kontonummer wurde kein Konto gefunden."
|
||||
Else
|
||||
cmbCustomer.EditValue = oMatchingAccounts.SingleOrDefault()
|
||||
End If
|
||||
|
||||
If oMatchingAccounts.Count() = 0 Then
|
||||
Throw New Exceptions.NoAccountException("Für die Kontonummer wurde kein Konto gefunden.")
|
||||
End If
|
||||
|
||||
cmbDeliveryAddress.EditValue = oMatchingAccounts.SingleOrDefault()
|
||||
|
||||
End If
|
||||
|
||||
Dim oPositionList = PositionData.Load(oData, oDataOriginal)
|
||||
' --- Find Positions ------------------------------------------------------------------------------------
|
||||
|
||||
Dim oPositionList = PositionData.Load(oMandator, oData, oDataOriginal)
|
||||
GridControlPositions.DataSource = oPositionList
|
||||
GridViewPositions.BestFitColumns()
|
||||
End Sub
|
||||
@@ -345,13 +369,17 @@ Public Class frmMain
|
||||
End Sub
|
||||
|
||||
Private Sub btnReloadDocument_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnReloadDocument.ItemClick
|
||||
Dim oDocument As Document = GetFocusedDocument()
|
||||
Dim oResult = MsgBox("Wenn sie das Dokument neu laden, werden alle manuell geänderten Wert verworfen. Wollen Sie fortfahren?", MsgBoxStyle.YesNo Or MsgBoxStyle.Question, Text)
|
||||
|
||||
If oDocument Is Nothing Then
|
||||
Exit Sub
|
||||
If oResult = MsgBoxResult.Yes Then
|
||||
Dim oDocument As Document = GetFocusedDocument()
|
||||
|
||||
If oDocument Is Nothing Then
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
ShowDocument(oDocument)
|
||||
End If
|
||||
|
||||
ShowDocument(oDocument)
|
||||
End Sub
|
||||
|
||||
Private Sub btnDeletePosition_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles btnDeletePosition.ItemClick
|
||||
@@ -373,4 +401,9 @@ Public Class frmMain
|
||||
Private Sub BarButtonItem7_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem7.ItemClick
|
||||
MsgBox("Mach et!")
|
||||
End Sub
|
||||
|
||||
Private Sub BarButtonItem6_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs)
|
||||
Dim oUserConfigDirectory = New FileInfo(ConfigManager.UserConfigPath).Directory
|
||||
TryOpenDirectory(oUserConfigDirectory.FullName, "Konfigurationsverzeichnis")
|
||||
End Sub
|
||||
End Class
|
||||
Reference in New Issue
Block a user