WIP Price Calculation
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user