220 lines
7.8 KiB
VB.net
220 lines
7.8 KiB
VB.net
Imports System
|
|
Imports System.ComponentModel
|
|
|
|
Imports DevExpress.Xpo
|
|
Imports DevExpress.Data.Filtering
|
|
|
|
Imports DevExpress.ExpressApp
|
|
Imports DevExpress.Persistent.Base
|
|
Imports DevExpress.Persistent.BaseImpl
|
|
Imports DevExpress.Persistent.Validation
|
|
Imports DevExpress.ExpressApp.ConditionalAppearance
|
|
|
|
<DefaultClassOptions()> _
|
|
<CreatableItem(False)> _
|
|
<NavigationItem("BusinessTransactions")> _
|
|
<Appearance("RecipeExecutionSimple - Disable DocumentNumber", AppearanceItemType.ViewItem, "1=1", TargetItems:="DocumentNumber", Enabled:=False)> _
|
|
<Appearance("RecipeExecutionSimple - Disable UserCreated", AppearanceItemType.ViewItem, "1=1", TargetItems:="UserCreated", Enabled:=False)> _
|
|
<Appearance("RecipeExecutionSimple - Disable ObjectCreated", AppearanceItemType.ViewItem, "1=1", TargetItems:="ObjectCreated", Enabled:=False)> _
|
|
Public Class RecipeExecutionSimple
|
|
Inherits BaseObject
|
|
Private _RecipeExecutionSimpleType As RecipeExecutionSimpleType
|
|
Private _CustomersFrom As CustomersFrom
|
|
Private _DocumentNumber As String
|
|
Private _ShortName As String
|
|
Private _Recipe As Recipe
|
|
Private _QTT As Double
|
|
Private _IsEditable As Boolean = True
|
|
Private _IsStorno As Boolean = False
|
|
Private _UserCreated As User
|
|
Private _ObjectCreated As Date
|
|
|
|
Public Sub New(ByVal session As Session)
|
|
MyBase.New(session)
|
|
End Sub
|
|
Public Overrides Sub AfterConstruction()
|
|
MyBase.AfterConstruction()
|
|
|
|
|
|
End Sub
|
|
Protected Overrides Sub OnSaving()
|
|
MyBase.OnSaving()
|
|
If Session.IsNewObject(Me) Then
|
|
ObjectCreated = GetSQLTime(Session)
|
|
UserCreated = Session.GetObjectByKey(Of User)(Session.GetKeyValue(SecuritySystem.CurrentUser))
|
|
End If
|
|
If String.IsNullOrEmpty(Me.DocumentNumber) Then
|
|
DocumentNumber = RecipeExecutionSimpleType.NumberGenerator.GetNewNumber(RecipeExecutionSimpleType.NumberGenerator)
|
|
End If
|
|
End Sub
|
|
Property RecipeExecutionSimpleType As RecipeExecutionSimpleType
|
|
Get
|
|
Return _RecipeExecutionSimpleType
|
|
End Get
|
|
Set(value As RecipeExecutionSimpleType)
|
|
SetPropertyValue("RecipeExecutionSimpleType", _RecipeExecutionSimpleType, value)
|
|
End Set
|
|
End Property
|
|
Property CustomersFrom As CustomersFrom
|
|
Get
|
|
Return _CustomersFrom
|
|
End Get
|
|
Set(value As CustomersFrom)
|
|
SetPropertyValue("CustomersFrom", _CustomersFrom, value)
|
|
End Set
|
|
End Property
|
|
Property DocumentNumber As String
|
|
Get
|
|
Return _DocumentNumber
|
|
End Get
|
|
Set(value As String)
|
|
SetPropertyValue("DocumentNumber", _DocumentNumber, value)
|
|
End Set
|
|
End Property
|
|
Property ShortName As String
|
|
Get
|
|
Return _ShortName
|
|
End Get
|
|
Set(value As String)
|
|
SetPropertyValue("ShortName", _ShortName, value)
|
|
End Set
|
|
End Property
|
|
<ImmediatePostData()> _
|
|
Property Recipe As Recipe
|
|
Get
|
|
Return _Recipe
|
|
End Get
|
|
Set(value As Recipe)
|
|
SetPropertyValue("Recipe", _Recipe, value)
|
|
If Not Session.IsObjectsLoading And Not Session.IsObjectsSaving Then
|
|
If value IsNot Nothing Then
|
|
ListPriceControls(value)
|
|
End If
|
|
End If
|
|
End Set
|
|
End Property
|
|
Property QTT As Double
|
|
Get
|
|
Return _QTT
|
|
End Get
|
|
Set(value As Double)
|
|
SetPropertyValue("QTT", _QTT, value)
|
|
End Set
|
|
End Property
|
|
Property IsEditable As Boolean
|
|
Get
|
|
Return _IsEditable
|
|
End Get
|
|
Set(value As Boolean)
|
|
SetPropertyValue("IsEditable", _IsEditable, value)
|
|
End Set
|
|
End Property
|
|
Property IsStorno As Boolean
|
|
Get
|
|
Return _IsStorno
|
|
End Get
|
|
Set(value As Boolean)
|
|
SetPropertyValue("IsStorno", _IsStorno, value)
|
|
End Set
|
|
End Property
|
|
<NonCloneable> _
|
|
Property UserCreated As User
|
|
Get
|
|
Return _UserCreated
|
|
End Get
|
|
Set(value As User)
|
|
SetPropertyValue("UserCreated", _UserCreated, value)
|
|
End Set
|
|
End Property
|
|
<NonCloneable> _
|
|
Property ObjectCreated As Date
|
|
Get
|
|
Return _ObjectCreated
|
|
End Get
|
|
Set(value As Date)
|
|
SetPropertyValue("ObjectCreated", _ObjectCreated, value)
|
|
End Set
|
|
End Property
|
|
|
|
Private Sub ListPriceControls(ByVal _Recipe As Recipe)
|
|
Dim _RecipeFrom As RecipeFrom
|
|
Dim _RecipeTo As RecipeTo
|
|
Dim _RecipeFrom_other As RecipeFromOther
|
|
Dim _RecipeTo_other As RecipeToOther
|
|
|
|
Dim _check_From_HUF As Double = 0
|
|
Dim _check_To_HUF As Double = 0
|
|
Dim _check_From_DEV As Double = 0
|
|
Dim _check_To_DEV As Double = 0
|
|
|
|
Dim _check_From_HUF_other As Double = 0
|
|
Dim _check_To_HUF_other As Double = 0
|
|
Dim _check_From_DEV_other As Double = 0
|
|
Dim _check_To_DEV_other As Double = 0
|
|
|
|
Dim _i As Integer = 0
|
|
|
|
Dim Products_from As Products
|
|
Dim Products_to As Products
|
|
'-------- Normál gyártás --------------
|
|
For Each _RecipeFrom In _Recipe.RecipeFrom
|
|
If _RecipeFrom IsNot Nothing Then
|
|
Products_from = TryCast(_RecipeFrom.Products, Products)
|
|
_i += 1
|
|
_check_From_HUF += _RecipeFrom.QTT * _RecipeFrom.ListPriceHUF
|
|
_check_From_DEV += _RecipeFrom.QTT * _RecipeFrom.ListPriceDEV
|
|
End If
|
|
Next
|
|
For Each _RecipeTo In _Recipe.RecipeTo
|
|
If _RecipeTo IsNot Nothing Then
|
|
Products_to = TryCast(_RecipeTo.Products, Products)
|
|
_check_To_HUF += _RecipeTo.QTT * _RecipeTo.ListPriceHUF
|
|
_check_To_DEV += _RecipeTo.QTT * _RecipeTo.ListPriceDEV
|
|
End If
|
|
Next
|
|
If Not _check_From_HUF < _check_To_HUF And Not _check_From_HUF = _check_To_HUF Then
|
|
MsgBox("Az összesített listaár 'HUF' értékek nem egyeznek!", MsgBoxStyle.OkOnly, "Figyelem, ellenõrzés!")
|
|
End If
|
|
If Not _check_From_DEV < _check_To_DEV And Not _check_From_DEV = _check_To_DEV Then
|
|
MsgBox("Az összesített listaár 'DEV' értékek nem egyeznek!", MsgBoxStyle.OkOnly, "Figyelem, ellenõrzés!")
|
|
End If
|
|
|
|
|
|
'-------- Egyéb gyártás --------------
|
|
|
|
For Each _RecipeFrom_other In _Recipe.RecipeFromOther
|
|
If _RecipeFrom_other IsNot Nothing Then
|
|
_check_From_HUF_other += _RecipeFrom_other.QTT * _RecipeFrom_other.ListPriceHUF
|
|
_check_From_DEV_other += _RecipeFrom_other.QTT * _RecipeFrom_other.ListPriceDEV
|
|
End If
|
|
Next
|
|
For Each _RecipeTo_other In _Recipe.RecipeToOther
|
|
If _RecipeTo_other IsNot Nothing Then
|
|
_check_To_HUF_other += _RecipeTo_other.QTT * _RecipeTo_other.ListPriceHUF
|
|
_check_To_DEV_other += _RecipeTo_other.QTT * _RecipeTo_other.ListPriceDEV
|
|
End If
|
|
Next
|
|
If Not _check_From_HUF_other < _check_To_HUF_other And Not _check_From_HUF_other = _check_To_HUF_other Then
|
|
MsgBox("Az 'Egyéb temékek' összesített listaár 'HUF' értékek nem egyeznek!", MsgBoxStyle.OkOnly, "Figyelem, ellenõrzés!")
|
|
End If
|
|
If Not _check_From_DEV_other < _check_To_DEV_other And Not _check_From_DEV_other = _check_To_DEV_other Then
|
|
MsgBox("Az 'Egyéb temékek' összesített listaár 'DEV' értékek nem egyeznek!", MsgBoxStyle.OkOnly, "Figyelem, ellenõrzés!")
|
|
End If
|
|
|
|
|
|
_check_From_HUF = 0
|
|
_check_To_HUF = 0
|
|
_check_From_DEV = 0
|
|
_check_To_DEV = 0
|
|
'------------------
|
|
_check_From_HUF_other = 0
|
|
_check_To_HUF_other = 0
|
|
_check_From_DEV_other = 0
|
|
_check_To_DEV_other = 0
|
|
|
|
End Sub
|
|
|
|
|
|
|
|
End Class
|