Fix DocumentTypes for Exports, Prepare Price calculation, load template parameters
This commit is contained in:
@@ -10,7 +10,6 @@ Namespace Winline
|
||||
Public Class WinlineData
|
||||
Inherits BaseClass
|
||||
|
||||
Private ReadOnly Property Database As MSSQLServer
|
||||
Private ReadOnly Property Config As GeneralConfig
|
||||
Private ReadOnly Property MandatorConfig As MandatorConfig
|
||||
Private ReadOnly Property MappingConfig As MappingConfig
|
||||
@@ -24,23 +23,23 @@ Namespace Winline
|
||||
Public Years As List(Of Integer)
|
||||
|
||||
Public Sub New(pLogConfig As LogConfig, pDatabase As MSSQLServer, pConfig As GeneralConfig, pMappingConfig As MappingConfig, pMandatorConfig As MandatorConfig)
|
||||
MyBase.New(pLogConfig)
|
||||
MyBase.New(pLogConfig, pDatabase)
|
||||
Patterns = New Patterns(pLogConfig, pConfig)
|
||||
Database = pDatabase
|
||||
Config = pConfig
|
||||
MandatorConfig = pMandatorConfig
|
||||
MappingConfig = pMappingConfig
|
||||
End Sub
|
||||
|
||||
Public Enum DocumentType
|
||||
OutgoingOffer = 1
|
||||
OutgoingOrder = 2
|
||||
OutgoingDeliveryNote = 3
|
||||
OutgoingInvoice = 4
|
||||
IncomingOffer = -1
|
||||
IncomingOrder = -2
|
||||
IncomingDeliveryNote = -3
|
||||
IncomingInvoice = -4
|
||||
Undefined
|
||||
OutgoingOffer
|
||||
OutgoingOrder
|
||||
OutgoingDeliveryNote
|
||||
OutgoingInvoice
|
||||
IncomingOffer
|
||||
IncomingOrder
|
||||
IncomingDeliveryNote
|
||||
IncomingInvoice
|
||||
End Enum
|
||||
|
||||
Public Class GetDocumentArgs
|
||||
@@ -308,17 +307,18 @@ Namespace Winline
|
||||
Try
|
||||
Dim oYear As Integer = Config.GetWinLineYear()
|
||||
Dim oSQL As String = $"
|
||||
EXECUTE [PRCUST_GET_ACCOUNT_PRICE_CONDITION_VALUES]
|
||||
EXECUTE [{pMandator.Database}].[dbo].[PRCUST_GET_ACCOUNT_PRICE_CONDITION_VALUES]
|
||||
'{pAccountNumber}',
|
||||
'*',
|
||||
'{pArticle}',
|
||||
'{pQuantity}',
|
||||
{pDocumentDate:yyyy-MM-dd},
|
||||
{pDocumentDate:yyyy-MM-dd},
|
||||
'{pDocumentDate:dd.MM.yyyy}',
|
||||
'{pDocumentDate:dd.MM.yyyy}',
|
||||
'{pMandator.Id}',
|
||||
{oYear},
|
||||
1008,
|
||||
NULL,
|
||||
1,
|
||||
'Multitool/{pTemplate.Name}',
|
||||
'CalcPricing'
|
||||
"
|
||||
@@ -567,14 +567,39 @@ Namespace Winline
|
||||
Return Nothing
|
||||
End Function
|
||||
|
||||
Public Function GetDocuments(pMandator As Mandator, pTemplate As Template, pDocumentType As Integer, pOptions As GetDocumentArgs) As List(Of ExportDocument)
|
||||
Public Function GetDocuments(pMandator As Mandator, pTemplate As Template, pDocumentType As DocumentType, pOptions As GetDocumentArgs) As List(Of ExportDocument)
|
||||
Try
|
||||
Dim oYear As Integer = Config.GetWinLineYear()
|
||||
|
||||
Dim oTypeConstraint = ""
|
||||
If pDocumentType <> 0 Then
|
||||
oTypeConstraint = $"T.c139 = {pDocumentType} AND "
|
||||
End If
|
||||
Dim oTypeConstraint
|
||||
Select Case pDocumentType
|
||||
Case DocumentType.OutgoingOffer
|
||||
oTypeConstraint = $"T.c137 = 1 AND c139 = 1 AND "
|
||||
|
||||
Case DocumentType.OutgoingOffer
|
||||
oTypeConstraint = $"T.c137 = 1 AND c139 = 2 AND "
|
||||
|
||||
Case DocumentType.OutgoingDeliveryNote
|
||||
oTypeConstraint = $"T.c137 = 1 AND (c139 = 3 OR c139 = -3) AND "
|
||||
|
||||
Case DocumentType.OutgoingInvoice
|
||||
oTypeConstraint = $"T.c137 = 1 AND c139 = 4 AND "
|
||||
|
||||
Case DocumentType.IncomingOffer
|
||||
oTypeConstraint = $"T.c137 = 2 AND c139 = 1 AND "
|
||||
|
||||
Case DocumentType.IncomingOrder
|
||||
oTypeConstraint = $"T.c137 = 2 AND c139 = 2 AND "
|
||||
|
||||
Case DocumentType.IncomingDeliveryNote
|
||||
oTypeConstraint = $"T.c137 = 2 AND c139 = 3 AND "
|
||||
|
||||
Case DocumentType.IncomingInvoice
|
||||
oTypeConstraint = $"T.c137 = 2 AND c139 = 4 AND "
|
||||
|
||||
Case Else
|
||||
oTypeConstraint = ""
|
||||
End Select
|
||||
|
||||
Dim oAccountConstraint = ""
|
||||
If pOptions.Account IsNot Nothing Then
|
||||
|
||||
Reference in New Issue
Block a user