WIP Price Calculation

This commit is contained in:
Jonathan Jenne 2022-02-10 16:59:24 +01:00
parent 1aec033282
commit 2e7b0bef8a
13 changed files with 202 additions and 43 deletions

View File

@ -338,6 +338,7 @@
<ItemGroup>
<Content Include="CREATE_DATABASE.sql" />
<Content Include="MultiTool.ico" />
<None Include="Resources\bo_sale.svg" />
<None Include="Resources\editquery.svg" />
<None Include="Resources\actions_checkcircled2.svg" />
<None Include="Resources\actions_deletecircled1.svg" />

View File

@ -240,6 +240,16 @@ Namespace My.Resources
End Get
End Property
'''<summary>
''' Sucht eine lokalisierte Ressource vom Typ DevExpress.Utils.Svg.SvgImage.
'''</summary>
Friend ReadOnly Property bo_sale() As DevExpress.Utils.Svg.SvgImage
Get
Dim obj As Object = ResourceManager.GetObject("bo_sale", resourceCulture)
Return CType(obj,DevExpress.Utils.Svg.SvgImage)
End Get
End Property
'''<summary>
''' Sucht eine lokalisierte Ressource vom Typ DevExpress.Utils.Svg.SvgImage.
'''</summary>

View File

@ -124,17 +124,14 @@
<data name="actions_send" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\actions_send.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
</data>
<data name="bo_country" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\bo_country.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
</data>
<data name="save" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\save.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
</data>
<data name="mailmergepreview" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\mailmergepreview.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
</data>
<data name="deletetablerows" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\deletetablerows.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
<data name="bo_country" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\bo_country.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
</data>
<data name="parameters" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\parameters.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
@ -151,6 +148,9 @@
<data name="rotatecounterclockwise" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\rotatecounterclockwise.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
</data>
<data name="actions_reload" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\actions_reload.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
</data>
<data name="bo_unknown" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\bo_unknown.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
</data>
@ -187,6 +187,9 @@
<data name="bo_unknown2" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\bo_unknown2.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
</data>
<data name="deletetablerows" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\deletetablerows.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
</data>
<data name="open3" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\open3.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
</data>
@ -247,8 +250,8 @@
<data name="singlepageview" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\singlepageview.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
</data>
<data name="actions_reload" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\actions_reload.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
<data name="logical" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\logical.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
</data>
<data name="bo_product" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\bo_product.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
@ -265,6 +268,9 @@
<data name="actions_send3" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\actions_send3.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
</data>
<data name="editquery" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\editquery.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
</data>
<data name="preview" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\preview.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
</data>
@ -304,16 +310,13 @@
<data name="export" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\export.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
</data>
<data name="logical" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\logical.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
</data>
<data name="new" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\new.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
</data>
<data name="actions_checkcircled2" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\actions_checkcircled2.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
</data>
<data name="editquery" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\editquery.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
<data name="bo_sale" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\bo_sale.svg;DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
</data>
</root>

View File

@ -1,15 +1,16 @@
DevExpress.XtraEditors.Repository.RepositoryItemDateEdit, DevExpress.XtraEditors.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
DevExpress.XtraEditors.LookUpEdit, DevExpress.XtraEditors.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
DevExpress.XtraReports.UI.XtraReport, DevExpress.XtraReports.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
DevExpress.XtraEditors.Repository.RepositoryItemProgressBar, DevExpress.XtraEditors.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
DevExpress.XtraEditors.Repository.RepositoryItemImageComboBox, DevExpress.XtraEditors.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
DevExpress.XtraBars.Ribbon.RibbonControl, DevExpress.XtraBars.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
DevExpress.XtraEditors.TextEdit, DevExpress.XtraEditors.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
DevExpress.XtraEditors.Repository.RepositoryItemComboBox, DevExpress.XtraEditors.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
DevExpress.XtraLayout.LayoutControl, DevExpress.XtraLayout.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
DevExpress.XtraRichEdit.RichEditControl, DevExpress.XtraRichEdit.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
DevExpress.XtraEditors.CheckEdit, DevExpress.XtraEditors.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
DevExpress.XtraEditors.ComboBoxEdit, DevExpress.XtraEditors.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
DevExpress.XtraEditors.GridLookUpEdit, DevExpress.XtraGrid.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
DevExpress.XtraEditors.DateEdit, DevExpress.XtraEditors.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
DevExpress.XtraGrid.GridControl, DevExpress.XtraGrid.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
DevExpress.XtraReports.UI.XtraReport, DevExpress.XtraReports.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
DevExpress.XtraEditors.ComboBoxEdit, DevExpress.XtraEditors.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
DevExpress.XtraEditors.SearchLookUpEdit, DevExpress.XtraGrid.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
DevExpress.XtraEditors.Repository.RepositoryItemImageComboBox, DevExpress.XtraEditors.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
DevExpress.XtraEditors.GridLookUpEdit, DevExpress.XtraGrid.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
DevExpress.XtraEditors.Repository.RepositoryItemComboBox, DevExpress.XtraEditors.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
DevExpress.XtraEditors.TextEdit, DevExpress.XtraEditors.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
DevExpress.XtraEditors.DateEdit, DevExpress.XtraEditors.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
DevExpress.XtraBars.Ribbon.RibbonControl, DevExpress.XtraBars.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
DevExpress.XtraEditors.LookUpEdit, DevExpress.XtraEditors.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
DevExpress.XtraEditors.Repository.RepositoryItemProgressBar, DevExpress.XtraEditors.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
DevExpress.XtraLayout.LayoutControl, DevExpress.XtraLayout.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a

View File

@ -0,0 +1,27 @@
<?xml version='1.0' encoding='UTF-8'?>
<svg x="0px" y="0px" viewBox="0 0 32 32" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" id="Layer_1" style="enable-background:new 0 0 32 32">
<style type="text/css">
.Blue{fill:#1177D7;}
.Yellow{fill:#FFB115;}
.Red{fill:#D11C1C;}
.Green{fill:#039C23;}
.Black{fill:#727272;}
.White{fill:#FFFFFF;}
.st0{opacity:0.5;}
.st1{opacity:0.75;}
.st2{display:none;}
.st3{display:inline;fill:#FFB115;}
.st4{display:inline;}
.st5{display:inline;opacity:0.75;}
.st6{display:inline;opacity:0.5;}
.st7{display:inline;fill:#039C23;}
.st8{display:inline;fill:#D11C1C;}
.st9{display:inline;fill:#1177D7;}
.st10{display:inline;fill:#FFFFFF;}
</style>
<g id="Sale">
<path d="M4,18V8H0V6h6v10h8.5c-0.5,0.6-0.9,1.3-1.3,2H4z M9,20c-1.7,0-3,1.3-3,3s1.3,3,3,3s3-1.3,3-3S10.7,20,9,20z" class="Black" />
<path d="M23,14c-5,0-9,4-9,9c0,5,4,9,9,9c5,0,9-4,9-9C32,18,28,14,23,14z M23,22c1.7,0,3,1.3,3,3 c0,1.3-0.8,2.4-2,2.8V29h-2v-1.2c-1.2-0.4-2-1.5-2-2.8h2c0,0.6,0.4,1,1,1c0.6,0,1-0.4,1-1s-0.4-1-1-1c-1.7,0-3-1.3-3-3 c0-1.3,0.8-2.4,2-2.8V17h2v1.2c1.2,0.4,2,1.5,2,2.8h-2c0-0.6-0.4-1-1-1c-0.6,0-1,0.4-1,1S22.4,22,23,22z" class="Green" />
<path d="M23,12c0.3,0,0.7,0,1,0.1V3c0-0.5-0.4-1-1-1H9C8.4,2,8,2.5,8,3v10c0,0.5,0.4,1,1,1h7.7 C18.5,12.7,20.6,12,23,12z" class="Yellow" />
</g>
</svg>

View File

@ -86,6 +86,7 @@ Partial Class frmImportMain
Me.WorkspaceManager1 = New DevExpress.Utils.WorkspaceManager(Me.components)
Me.BehaviorManager = New DevExpress.Utils.Behaviors.BehaviorManager(Me.components)
Me.SplashScreenManager = New DevExpress.XtraSplashScreen.SplashScreenManager(Me, GetType(Global.MultiTool.Form.frmWaitForm), True, True)
Me.btnCalculatePrices = New DevExpress.XtraBars.BarButtonItem()
CType(Me.SplitContainerMain, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.SplitContainerMain.Panel1, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SplitContainerMain.Panel1.SuspendLayout()
@ -220,9 +221,9 @@ Partial Class frmImportMain
'RibbonControl
'
Me.RibbonControl.ExpandCollapseItem.Id = 0
Me.RibbonControl.Items.AddRange(New DevExpress.XtraBars.BarItem() {Me.RibbonControl.ExpandCollapseItem, Me.RibbonControl.SearchEditItem, Me.txtFilesLoaded, Me.btnLoadFiles, Me.btnTransferFile, Me.btnOpenInputDirectory, Me.btnOpenOutputDirectory, Me.btnOpenSchemaDirectory, Me.btnReloadFile, Me.btnTransferAllFiles, Me.btnOpenReport, Me.btnShowXml, Me.btnOpenLogDirectory, Me.btnOpenConfigDirectory, Me.txtCurrentFile, Me.btnConfig, Me.btnRemoveRow, Me.btnTestTransferFile, Me.BarButtonItem1, Me.btnDebugExportReport, Me.btnEditRow})
Me.RibbonControl.Items.AddRange(New DevExpress.XtraBars.BarItem() {Me.RibbonControl.ExpandCollapseItem, Me.RibbonControl.SearchEditItem, Me.txtFilesLoaded, Me.btnLoadFiles, Me.btnTransferFile, Me.btnOpenInputDirectory, Me.btnOpenOutputDirectory, Me.btnOpenSchemaDirectory, Me.btnReloadFile, Me.btnTransferAllFiles, Me.btnOpenReport, Me.btnShowXml, Me.btnOpenLogDirectory, Me.btnOpenConfigDirectory, Me.txtCurrentFile, Me.btnConfig, Me.btnRemoveRow, Me.btnTestTransferFile, Me.BarButtonItem1, Me.btnDebugExportReport, Me.btnEditRow, Me.btnCalculatePrices})
resources.ApplyResources(Me.RibbonControl, "RibbonControl")
Me.RibbonControl.MaxItemId = 36
Me.RibbonControl.MaxItemId = 37
Me.RibbonControl.Name = "RibbonControl"
Me.RibbonControl.Pages.AddRange(New DevExpress.XtraBars.Ribbon.RibbonPage() {Me.RibbonPage1, Me.RibbonPage2})
Me.RibbonControl.RepositoryItems.AddRange(New DevExpress.XtraEditors.Repository.RepositoryItem() {Me.RepositoryItemComboBox1, Me.RepositoryItemProgressBar1})
@ -404,6 +405,7 @@ Partial Class frmImportMain
'
Me.RibbonPageGroup7.ItemLinks.Add(Me.btnEditRow)
Me.RibbonPageGroup7.ItemLinks.Add(Me.btnRemoveRow)
Me.RibbonPageGroup7.ItemLinks.Add(Me.btnCalculatePrices)
Me.RibbonPageGroup7.Name = "RibbonPageGroup7"
resources.ApplyResources(Me.RibbonPageGroup7, "RibbonPageGroup7")
'
@ -598,6 +600,13 @@ Partial Class frmImportMain
'
Me.SplashScreenManager.ClosingDelay = 500
'
'btnCalculatePrices
'
resources.ApplyResources(Me.btnCalculatePrices, "btnCalculatePrices")
Me.btnCalculatePrices.Id = 36
Me.btnCalculatePrices.ImageOptions.SvgImage = Global.MultiTool.Form.My.Resources.Resources.bo_sale
Me.btnCalculatePrices.Name = "btnCalculatePrices"
'
'frmImportMain
'
resources.ApplyResources(Me, "$this")
@ -721,4 +730,5 @@ Partial Class frmImportMain
Friend WithEvents gridBand1 As DevExpress.XtraGrid.Views.BandedGrid.GridBand
Friend WithEvents GridBand2 As DevExpress.XtraGrid.Views.BandedGrid.GridBand
Friend WithEvents btnEditRow As DevExpress.XtraBars.BarButtonItem
Friend WithEvents btnCalculatePrices As DevExpress.XtraBars.BarButtonItem
End Class

View File

@ -247,6 +247,9 @@
<data name="btnEditRow.Caption" xml:space="preserve">
<value>Zeile bearbeiten</value>
</data>
<data name="btnCalculatePrices.Caption" xml:space="preserve">
<value>Preiskalkulation ausführen</value>
</data>
<data name="RibbonControl.Location" type="System.Drawing.Point, System.Drawing">
<value>0, 0</value>
</data>
@ -1052,6 +1055,12 @@
<data name="&gt;&gt;SplashScreenManager.Type" xml:space="preserve">
<value>DevExpress.XtraSplashScreen.SplashScreenManager, DevExpress.XtraEditors.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
</data>
<data name="&gt;&gt;btnCalculatePrices.Name" xml:space="preserve">
<value>btnCalculatePrices</value>
</data>
<data name="&gt;&gt;btnCalculatePrices.Type" xml:space="preserve">
<value>DevExpress.XtraBars.BarButtonItem, DevExpress.XtraBars.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
</data>
<data name="&gt;&gt;$this.Name" xml:space="preserve">
<value>frmImportMain</value>
</data>

View File

@ -540,11 +540,11 @@ Public Class frmImportMain
For Each oRow In pDocument.Rows
' Grab grid for the current DocumentRow
Dim oGrid As GridControl = Grids.
Where(Function(g) g.Name = oRow.Name).
Where(Function(g) g.Name = oRow.TableName).
SingleOrDefault()
' Grab table for the current DocumentRow and create new row
Dim oDataTable As DataTable = oDatasources.Item(oRow.Name)
Dim oDataTable As DataTable = oDatasources.Item(oRow.TableName)
Dim oDataRow = oDataTable.NewRow()
' Assign the Guid of the DocumentRow

View File

@ -206,7 +206,7 @@ Namespace Documents
' Create a DocumentRow object for each Top Level Element
Dim oRow = New DocumentRow With {
.SortKey = oRowSortKey,
.Name = oTopLevelElement.Name.ToString,
.TableName = oTopLevelElement.Name.ToString,
.Fields = oFields
}
@ -243,19 +243,56 @@ Namespace Documents
Else
pDocument = ApplyDefinedItemFunctionsForImport(pDocument, oMandator, pTemplate)
pDocument = ApplyDynamicItemFunctionsForImport(pDocument, oMandator)
pDocument = ApplyPriceFunctions(pDocument, oMandator, pTemplate)
End If
pDocument.Mandator = oMandator
Return pDocument
End Function
Private Function ApplyDefinedItemFunctionsForImport(pDocument As Document, pMandator As Mandator, pTemplate As Template) As Document
If pMandator Is Nothing Then
Return pDocument
End If
''' <summary>
''' Apply price calculation to the documents products
'''
''' This needs to be strictly seperated from `ApplyDefinedItemFunctionsForImport`
''' because prices can only be calculated if GLN and EAN functions were already (successfully) processed
''' </summary>
Private Function ApplyPriceFunctions(pDocument As Document, pMandator As Mandator, pTemplate As Template) As Document
For Each oRow As DocumentRow In pDocument.Rows
Dim oTable = pTemplate.Tables.Where(Function(table) table.Name = oRow.Name).SingleOrDefault()
Dim oTable = pTemplate.Tables.Where(Function(table) table.Name = oRow.TableName).SingleOrDefault()
For Each oField In oRow.Fields
If oTable Is Nothing Then
Exit For
End If
Dim oColumn = oTable.Columns.Where(Function(c) c.Name = oField.Key).SingleOrDefault()
If oColumn Is Nothing Then
Continue For
End If
Dim oFunctionName = oColumn.Config?.Function?.Name
' TODO: Make more nice
Dim oParams = oColumn.Config?.Function.Params
Dim oParamList = oParams.Split("|").ToList()
Dim oParamsDict As New Dictionary(Of String, String)
For Each oParam In oParamList
Dim oParamSplit = oParam.Split("=")
oParamsDict.Add(oParamSplit(0), oParamSplit(1))
Next
If oFunctionName = "PRICE" Then
SetPrice(oRow, oField.Key, oParamsDict, pMandator, pTemplate)
End If
Next
Next
Return pDocument
End Function
Private Function ApplyDefinedItemFunctionsForImport(pDocument As Document, pMandator As Mandator, pTemplate As Template) As Document
For Each oRow As DocumentRow In pDocument.Rows
Dim oTable = pTemplate.Tables.Where(Function(table) table.Name = oRow.TableName).SingleOrDefault()
For Each oField In oRow.Fields
If oTable Is Nothing Then
@ -284,11 +321,11 @@ Namespace Documents
Return pDocument
End Function
''' <summary>
''' Execute Mappings defined in TBEDI_XML_MAPPING_CONFIG,
''' for example mapping Article Numbers to Winline Mandators
''' </summary>
Private Function ApplyDynamicItemFunctionsForImport(pDocument As Document, pMandator As Mandator) As Document
If pMandator Is Nothing Then
Return pDocument
End If
' We only want the mapping config for things in the xml file.
' that excludes things like setting the mandator.
Dim oFilteredMappingConfig = MappingConfig.Items.
@ -326,6 +363,23 @@ Namespace Documents
Return pDocument
End Function
Private Sub SetPrice(pRow As DocumentRow, pPriceField As String, oFieldMap As Dictionary(Of String, String), pMandator As Mandator, pTemplate As Template)
Dim oPriceItem As DocumentRow.FieldValue = pRow.Fields.GetOrDefault(pPriceField)
Dim oArticleNumberField As String = oFieldMap.GetOrDefault("Article", Nothing)
Dim oAccountNumberField As String = oFieldMap.GetOrDefault("Account", Nothing)
Dim oDocumentDateField As String = oFieldMap.GetOrDefault("DocumentDate", Nothing)
' TODO: Check for missing values
Dim oArticleNumber As String = pRow.Fields.Item(oArticleNumberField).Final
Dim oAccountNumber As String = pRow.Fields.Item(oAccountNumberField).Final
Dim oDocumentDate As Date = pRow.Fields.Item(oDocumentDateField).Final
Dim oQuantity As Integer = 1
Dim oArticlePrice As Double = Winline.TryGetArticlePrice(oArticleNumber, oAccountNumber, oQuantity, oDocumentDate, pMandator, pTemplate)
End Sub
Private Sub SetArticleByEAN(pRow As DocumentRow, pMandator As Mandator, pArticleField As String)
Dim oNumberItem As DocumentRow.FieldValue = pRow.Fields.GetOrDefault(pArticleField)
Dim oArticleNumber = Winline.TryGetArticleNumber(oNumberItem.Original, pMandator)

View File

@ -10,11 +10,16 @@
''' Counter to ensure consistency and order when writing XML
''' </summary>
Public Property SortKey As Integer
''' <summary>
''' Tabellen/Elementname aus XML
''' </summary>
Public Property Name As String
Public Property TableName As String
''' <summary>
''' List of Row Values
''' </summary>
''' <returns></returns>
Public Property Fields As Dictionary(Of String, FieldValue)
Public ReadOnly Property HasErrors As Boolean

View File

@ -63,11 +63,11 @@ Public Class ReportGenerator(Of TReport As IReport)
FillFieldValuesFromSQL(pDocument, oSQLConfig)
Dim oHeadRow = pDocument.Rows.
Where(Function(r) r.Name.EndsWith("T025")).
Where(Function(r) r.TableName.EndsWith("T025")).
Select(Function(r) r.Fields).
FirstOrDefault()
Dim oPositionRows = pDocument.Rows.
Where(Function(r) r.Name.EndsWith("T026")).
Where(Function(r) r.TableName.EndsWith("T026")).
ToList()
Dim oReportHead = oHeadMapper.Map(Of Dictionary(Of String, FieldValue), ReportHead)(oHeadRow)

View File

@ -188,7 +188,7 @@ Namespace Winline
pDocument.Rows.Sort()
For Each oRow In pDocument.Rows
w.WriteStartElement(oRow.Name)
w.WriteStartElement(oRow.TableName)
For Each oField As KeyValuePair(Of String, DocumentRow.FieldValue) In oRow.Fields
If oField.Value.Final = String.Empty Then

View File

@ -304,6 +304,45 @@ Namespace Winline
End Try
End Function
Public Function TryGetArticlePrice(pArticle As String, pAccountNumber As String, pQuantity As String, pDocumentDate As Date, pMandator As Mandator, pTemplate As Template) As Double
Try
Dim oYear As Integer = Config.GetWinLineYear()
Dim oSQL As String = $"
EXECUTE [PRCUST_GET_ACCOUNT_PRICE_CONDITION_VALUES]
'{pAccountNumber}',
'*',
'{pArticle}',
'{pQuantity}',
{pDocumentDate:yyyy-MM-dd},
{pDocumentDate:yyyy-MM-dd},
'{pMandator.Id}',
{oYear},
1008,
NULL,
'Multitool/{pTemplate.Name}',
'CalcPricing'
"
Dim oTable As DataTable = Database.GetDatatable(oSQL)
If oTable.Rows.Count = 0 Then
Logger.Debug("Price for article [{0}] and Account [{1}] was not found in Mandator: [{2}]", pArticle, pAccountNumber, pMandator.Id)
Return Nothing
End If
Dim oRow As DataRow = oTable.Rows.Item(0)
Dim oPrice As Double = oRow.Item("PRICE")
Return oPrice
Catch ex As Exception
Logger.Warn("Error while trying to get Price for Article [{0}] and Account [{1}]", pArticle, pAccountNumber)
Logger.Error(ex)
Return Nothing
End Try
End Function
Public Function TryGetArticleNumber(pEAN As String, pMandator As Mandator) As String
Try
Dim oYear As Integer = Config.GetWinLineYear()
@ -450,7 +489,7 @@ Namespace Winline
Public Function FindMatchingMandatorFromOrder(pData As Documents.Document) As Mandator
Dim oPositions = pData.Rows.
Where(Function(r) r.Name.ToUpper.EndsWith("T026")).
Where(Function(r) r.TableName.ToUpper.EndsWith("T026")).
ToList()
Dim oEANNumbers = oPositions.
Select(Function(p)