Improve Exported Constraint, Update call of price function

This commit is contained in:
Jonathan Jenne 2022-03-16 12:07:03 +01:00
parent 80e40fbc23
commit f60c299f3c

View File

@ -305,22 +305,27 @@ Namespace Winline
Public Async Function TryGetArticlePrice(pArticle As String, pAccountNumber As String, pQuantity As String, pDocumentDate As Date, pMandator As Mandator, pTemplate As Template) As Task(Of Double) Public Async Function TryGetArticlePrice(pArticle As String, pAccountNumber As String, pQuantity As String, pDocumentDate As Date, pMandator As Mandator, pTemplate As Template) As Task(Of Double)
Try Try
Dim oUserName = Environment.UserName
Dim oYear As Integer = Config.GetWinLineYear() Dim oYear As Integer = Config.GetWinLineYear()
Dim oDebug = Convert.ToInt32(LogConfig.Debug)
Dim oSQL As String = $" Dim oSQL As String = $"
EXECUTE [{pMandator.Database}].[dbo].[PRCUST_GET_ACCOUNT_PRICE_CONDITION_VALUES] EXEC [{pMandator.Database}].[dbo].[PRCUST_GET_ACCOUNT_PRICE_CONDITION_VALUES]
'{pAccountNumber}', @pAccountNr = '{pAccountNumber}',
'*', @pGroupNr = '*',
'{pArticle}', @pProductNr = '{pArticle}',
'{pQuantity}', @pProductQuantity = '*',
'{pDocumentDate:dd.MM.yyyy}', @pProductPriceDateFrom = '{pDocumentDate:dd.MM.yyyy}',
'{pDocumentDate:dd.MM.yyyy}', @pProductPriceDateTo = '{pDocumentDate:dd.MM.yyyy}',
'{pMandator.Id}', @pmesocomp = '{pMandator.Id}',
{oYear}, @pmesoyear = {oYear},
1008, @pGroupPropertyID = 1008,
NULL, @pTempTableSuffix = 'MT_USER_{oUserName}',
1, @pBatchID = NULL,
'Multitool/{pTemplate.Name}', @pPrintDebug = 0,
'CalcPricing' @pLog2DB = {oDebug},
@pComment = 'Multitool/{pTemplate.Name}',
@pResultType = 'CalcPricing'
" "
Dim oTable As DataTable = Await Database.GetDatatableAsync(oSQL) Dim oTable As DataTable = Await Database.GetDatatableAsync(oSQL)
@ -632,7 +637,11 @@ Namespace Winline
oDocNumberConstraint &= $"T.c044 <= '{pOptions.DocNumberTo}' AND " oDocNumberConstraint &= $"T.c044 <= '{pOptions.DocNumberTo}' AND "
End If End If
Dim oExportedConstraint = "(T.U010 = 0 OR T.U010 IS NULL) AND" ' Build the constraint so that the default view will show all documents that do not have an exported
' flag set to the current document type.
' Ex. Search for orders will not show exported flag = 2 by default
Dim oDocType As Integer = Math.Abs(Convert.ToInt32(pDocumentType))
Dim oExportedConstraint = $"(T.U010 IS NULL OR T.U010 <> {oDocType}) AND"
If pOptions.ShowExported Then If pOptions.ShowExported Then
oExportedConstraint = "" oExportedConstraint = ""
End If End If