diff --git a/MultiTool.Shared/Winline/WinlineData.vb b/MultiTool.Shared/Winline/WinlineData.vb index 2a48e71..b52c9d3 100644 --- a/MultiTool.Shared/Winline/WinlineData.vb +++ b/MultiTool.Shared/Winline/WinlineData.vb @@ -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) Try + Dim oUserName = Environment.UserName Dim oYear As Integer = Config.GetWinLineYear() + Dim oDebug = Convert.ToInt32(LogConfig.Debug) + Dim oSQL As String = $" - EXECUTE [{pMandator.Database}].[dbo].[PRCUST_GET_ACCOUNT_PRICE_CONDITION_VALUES] - '{pAccountNumber}', - '*', - '{pArticle}', - '{pQuantity}', - '{pDocumentDate:dd.MM.yyyy}', - '{pDocumentDate:dd.MM.yyyy}', - '{pMandator.Id}', - {oYear}, - 1008, - NULL, - 1, - 'Multitool/{pTemplate.Name}', - 'CalcPricing' + EXEC [{pMandator.Database}].[dbo].[PRCUST_GET_ACCOUNT_PRICE_CONDITION_VALUES] + @pAccountNr = '{pAccountNumber}', + @pGroupNr = '*', + @pProductNr = '{pArticle}', + @pProductQuantity = '*', + @pProductPriceDateFrom = '{pDocumentDate:dd.MM.yyyy}', + @pProductPriceDateTo = '{pDocumentDate:dd.MM.yyyy}', + @pmesocomp = '{pMandator.Id}', + @pmesoyear = {oYear}, + @pGroupPropertyID = 1008, + @pTempTableSuffix = 'MT_USER_{oUserName}', + @pBatchID = NULL, + @pPrintDebug = 0, + @pLog2DB = {oDebug}, + @pComment = 'Multitool/{pTemplate.Name}', + @pResultType = 'CalcPricing' " Dim oTable As DataTable = Await Database.GetDatatableAsync(oSQL) @@ -632,7 +637,11 @@ Namespace Winline oDocNumberConstraint &= $"T.c044 <= '{pOptions.DocNumberTo}' AND " 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 oExportedConstraint = "" End If