Files
Nuvolar/Nuvolar.Module/BusinessObjects/Business/BusinessTransactions/Invoice/Popup/InvoiceHoldPopup.vb
T
2017-03-08 11:21:27 +01:00

119 lines
5.0 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(), NonPersistent(), NavigationItem(False), CreatableItem(False)> _
<Appearance("Hide when CurrencyName is not HUF", AppearanceItemType:="ViewItem", criteria:="InvoiceHeader.CurrencyName.ShortName='HUF'", _
targetitems:="row_AmountDEV;", visibility:=Editors.ViewItemVisibility.Hide)> _
<Appearance("Hide when CurrencyName is HUF", AppearanceItemType:="ViewItem", criteria:="InvoiceHeader.CurrencyName.ShortName<>'HUF'", _
targetitems:="row_AmountHUF;", visibility:=Editors.ViewItemVisibility.Hide)> _
<Appearance("Hide when Finalized Action", AppearanceItemType:="Action", criteria:="InvoiceHeader.IsEditable=False and InvoiceHeader.IsProforma=False", _
targetitems:="aToTable_InvoiceHold;aToTableD_InvoiceHold;aBackToRowEdit_InvoiceHold;aUp_InvoiceHold;aDown_InvoiceHold", visibility:=Editors.ViewItemVisibility.Hide)> _
<Appearance("Hide when Finalized ViewItem", AppearanceItemType:="Action", criteria:="InvoiceHeader.IsEditable=False and InvoiceHeader.IsProforma=False", _
targetitems:="row_DatePayment;row_ShortName;row_AmountDEV;row_AmountHUF;row_Percent", visibility:=Editors.ViewItemVisibility.Hide)> _
Public Class InvoiceHoldPopup
Inherits BaseObject
Private _InvoiceHeader As InvoiceHeader
Private _row_DatePayment As Date
Private _row_ShortName As String
Private _row_AmountHUF As Double
Private _row_AmountDEV As Double
Private _row_Percent As Double
Public Sub New(ByVal session As Session)
MyBase.New(session)
' This constructor is used when an object is loaded from a persistent storage.
' Do not place any code here or place it only when the IsLoading property is false:
' if (!IsLoading){
' It is now OK to place your initialization code here.
' }
' or as an alternative, move your initialization code into the AfterConstruction method.
End Sub
Public Overrides Sub AfterConstruction()
MyBase.AfterConstruction()
' Place here your initialization code.
'row_Percent = 5
End Sub
Property InvoiceHeader As InvoiceHeader
Get
Return _InvoiceHeader
End Get
Set(value As InvoiceHeader)
SetPropertyValue("InvoiceHeader", _InvoiceHeader, value)
End Set
End Property
<NonPersistent()> _
<RuleRequiredField("InvoiceHoldPopup-row_DatePayment", "aToTable_InvoiceHold_Contexts")> _
Property row_DatePayment As Date
Get
Return _row_DatePayment
End Get
Set(value As Date)
SetPropertyValue("row_DatePayment", _row_DatePayment, value)
End Set
End Property
<NonPersistent()> _
Property row_ShortName As String
Get
Return _row_ShortName
End Get
Set(value As String)
SetPropertyValue("row_ShortName", _row_ShortName, value)
End Set
End Property
<NonPersistent()> _
<RuleValueComparison("InvoiceHoldPopup-row_AmountHUF", "aToTable_InvoiceHold_Contexts", ValueComparisonType.GreaterThan, "0", targetcriteria:="InvoiceHeader.CurrencyName.ShortName='HUF'")> _
Property row_AmountHUF As Double
Get
Return _row_AmountHUF
End Get
Set(value As Double)
SetPropertyValue("row_AmountHUF", _row_AmountHUF, value)
End Set
End Property
<NonPersistent()> _
<RuleValueComparison("InvoiceHoldPopup-row_AmountDEV", "aToTable_InvoiceHold_Contexts", ValueComparisonType.GreaterThan, "0", targetcriteria:="InvoiceHeader.CurrencyName.ShortName<>'HUF'")> _
Property row_AmountDEV As Double
Get
Return _row_AmountDEV
End Get
Set(value As Double)
SetPropertyValue("row_AmountDEV", _row_AmountDEV, value)
End Set
End Property
<NonPersistent()> _
<RuleRange("InvoiceHoldPopup", "aToTable_InvoiceHold_Contexts", "1", "99")> _
Property row_Percent As Double
Get
Return _row_Percent
End Get
Set(value As Double)
SetPropertyValue("row_Percent", _row_Percent, value)
If Session.IsObjectsLoading = False And Session.IsObjectsSaving = False Then
row_AmountHUF = Math.Round(InvoiceHeader.TotalBruttoHUF * (value / 100), 0, MidpointRounding.AwayFromZero)
row_AmountDEV = Math.Round(InvoiceHeader.TotalBruttoDEV * (value / 100), 2, MidpointRounding.AwayFromZero)
End If
End Set
End Property
<VisibleInListView(False), VisibleInLookupListView(False)> _
ReadOnly Property InvoiceHold As XPCollection(Of InvoiceHold)
Get
Return New XPCollection(Of InvoiceHold)(Session, CriteriaOperator.Parse("InvoiceHeader=?", Me.InvoiceHeader))
End Get
End Property
End Class