Module: Reorg / Cleanup
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
' GetWinLineStockedAmount(ProductNumber : String, IncludeSalesDocuments : Boolean)
|
||||
' ----------------------------------------------------------------------------
|
||||
' Lagerstand des Artikels prüfen
|
||||
'
|
||||
' Returns: NAME : TYP
|
||||
' ----------------------------------------------------------------------------
|
||||
' Copyright (c) 2021 by Digital Data GmbH
|
||||
'
|
||||
' Digital Data GmbH • Ludwig-Rinn-Strasse 16 • D-35452 Heuchelheim
|
||||
' Tel.: 0641/202360 • E-Mail: info-flow(at)digitaldata.works
|
||||
' ----------------------------------------------------------------------------
|
||||
' Creation Date / Author: 22.01.2021 / XX
|
||||
' Version Date / Editor: 13.12.2021 / MP
|
||||
' Version Number: 3.0.0.6
|
||||
|
||||
Function GetWinLineStockedAmount(ProductNumber, IncludeSalesDocuments)
|
||||
|
||||
SQL = ""
|
||||
SQL = SQL & "SELECT "
|
||||
SQL = SQL & " (SELECT C008 - C009 from [v021] (NOLOCK) where (c002 = '__ARTICLENUMBER__') " & SQLQuery_BasicWhere & ") - "
|
||||
|
||||
If IncludeSalesDocuments = True Or IncludeSalesDocuments = "True" Or IncludeSalesDocuments = 1 Then
|
||||
' Include Products from sales documents
|
||||
SQL = SQL & " ISNULL((SELECT SUM(C035) AS [MengeVerkauf] FROM [t014] (NOLOCK) where c000 = '__ARTICLENUMBER__' "& SQLQuery_BasicWhere &"), 0) "
|
||||
Else
|
||||
' Skip Products from sales documents
|
||||
SQL = SQL & " (SELECT 0) "
|
||||
End If
|
||||
|
||||
SQL = SQL & "AS c000"
|
||||
|
||||
SQL = Replace(SQL, "__ARTICLENUMBER__", ProductNumber)
|
||||
Set Result = CWLStart.CurrentCompany.Connection.Select(SQL)
|
||||
|
||||
GetWinLineStockedAmount = Result.Value("c000")
|
||||
End Function
|
||||
Reference in New Issue
Block a user