Files
Nuvolar/Nuvolar.Module/BusinessObjects/Financial/FinancialObjects/FinancialTransactions/Bank/GLBank.vb
T
2017-03-08 11:21:27 +01:00

577 lines
27 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.Persistent.Base.General
Imports System.Data.SqlClient
Imports System.Configuration
Imports System.Linq
Imports System.Linq.Expressions
Imports DevExpress.ExpressApp.ConditionalAppearance
Imports DevExpress.Xpo.DB
'<Appearance("Disable, all properties when IsEditable = False GLBank",
' AppearanceItemType:="ViewItem",
' TargetItems:="*",
' Criteria:="IsEditable=False",
' Enabled:=False,
' Context:="DetailView")> _
<DefaultClassOptions()>
<NavigationItem("FinancialTransactions")>
<DefaultProperty("DisplayName")>
<Appearance("Hide properties if Correction",
AppearanceItemType:="ViewItem",
TargetItems:="row_AmountDEV;row_CurrencyRate2;row_CurrencyRate;row_CurrencyName2;row_AmountDEV2",
Criteria:="row_TransactionType in (5,6)",
Visibility:=Editors.ViewItemVisibility.Hide)>
<Appearance("Hide row_AmountDEV in GLBank",
AppearanceItemType:="ViewItem",
TargetItems:="row_AmountDEV",
Criteria:="LiquidAssets_Main.CurrencyName.ShortName = 'HUF'",
Visibility:=Editors.ViewItemVisibility.Hide)>
<Appearance("Hide row_CurrencyRate in GLBank",
TargetItems:="row_CurrencyRate",
Criteria:="LiquidAssets_Main.CurrencyName.ShortName = 'HUF' and row_CurrencyName2.ShortName='HUF'",
Visibility:=Editors.ViewItemVisibility.Hide)>
<Appearance("Hide row_CurrencyRate2 in GLBank",
TargetItems:="row_CurrencyRate2",
Criteria:="LiquidAssets_Main.CurrencyName.ShortName = row_CurrencyName2.ShortName",
Visibility:=Editors.ViewItemVisibility.Hide)>
<Appearance("Hide row_CurrencyRate2 in GLBank and HUF",
TargetItems:="row_CurrencyRate2",
Criteria:="LiquidAssets_Main.CurrencyName.ShortName ='HUF' or row_CurrencyName2.ShortName='HUF'",
Visibility:=Editors.ViewItemVisibility.Hide)>
<Appearance("ChartOfAccounts-hide",
TargetItems:="row_ChartOfAccounts",
Criteria:="row_TransactionType in (0,1) OR IsEditable=False",
Visibility:=Editors.ViewItemVisibility.Hide)>
<Appearance("Normal transactions hide",
TargetItems:="row_CurrencyName2;row_CurrencyRate2",
Criteria:="row_TransactionType in (2,3,4) OR IsEditable=False",
Visibility:=Editors.ViewItemVisibility.Hide)>
<Appearance("Partnerconnection-hide",
TargetItems:="row_PCIGroup;row_PartnerType",
Criteria:="row_TransactionType in (2,3) OR IsEditable=False",
Visibility:=Editors.ViewItemVisibility.Hide)>
<Appearance("Hide GLCassa-LiquidAssets",
AppearanceItemType:="ViewItem",
TargetItems:="LiquidAssets_Main",
Criteria:="(IsNull(LiquidAssets_Main))=False",
Enabled:=False,
Context:="DetailView")>
<Appearance("Hide DEV info in HUF",
AppearanceItemType:="ViewItem",
TargetItems:="TotalInAmountDEV;TotalOutAmountDEV;BallanceDEV;CloseDEV",
Criteria:="CurrencyName.ShortName='HUF'",
Visibility:=Editors.ViewItemVisibility.Hide,
Context:="DetailView")>
<Appearance("Hide HUF info in DEV",
AppearanceItemType:="ViewItem",
TargetItems:="TotalInAmountHUF;TotalOutAmountHUF;BallanceHUF;CloseHUF",
Criteria:="CurrencyName.ShortName!='HUF'",
Visibility:=Editors.ViewItemVisibility.Hide,
Context:="DetailView")>
<Appearance("Disable GLBank.row_AmountHUF when DEV != HUF",
AppearanceItemType:="ViewItem",
TargetItems:="row_AmountHUF",
Criteria:="LiquidAssets_Main.CurrencyName.ShortName != 'HUF' and not (row_TransactionType in (5,6))",
Enabled:=False,
Context:="DetailView")>
<Appearance("Hide row_Amount2 when CurrencyName2=CurrencyName",
AppearanceItemType:="ViewItem",
Criteria:="row_CurrencyName2.ShortName=LiquidAssets_Main.CurrencyName.ShortName",
TargetItems:="row_CurrencyRate2;row_AmountDEV2",
Visibility:=Editors.ViewItemVisibility.Hide)>
<Appearance("Hide row_ info when IsEditable=False",
AppearanceItemType:="ViewItem",
Criteria:="IsEditable=False",
TargetItems:="row_PartnerType;row_TransactionType;row_ChartOfAccounts;" +
"row_PCIGroup;row_AmountDEV2;row_CurrencyRate;row_CurrencyRate2;row_CurrencyName2",
Visibility:=Editors.ViewItemVisibility.Hide)>
<Appearance("Hide aImportSavedBank when CurrencyName2=CurrencyName",
AppearanceItemType:="Action",
Criteria:="LiquidAssets_Main.CurrencyName.ShortName<>'HUF'",
TargetItems:="aImportSavedBank",
Visibility:=DevExpress.ExpressApp.Editors.ViewItemVisibility.Hide)>
<Appearance("Hide aImportPCIGroupBank when row_PartnerType=-1",
AppearanceItemType:="Action",
Criteria:="row_PartnerType=-1",
TargetItems:="aImportPCIGroupBank",
Visibility:=DevExpress.ExpressApp.Editors.ViewItemVisibility.Hide)>
<Appearance("Hide aGetCurrencyRateBank",
AppearanceItemType:="Action",
TargetItems:="aGetCurrencyRateBank",
Criteria:="CurrencyName.ShortName='HUF'",
Visibility:=DevExpress.ExpressApp.Editors.ViewItemVisibility.Hide)>
<RuleCriteria("RuleCriteria GLAccounts-row_ChartOfAccounts", "aToTable_GLBank_Contexts", "row_ChartOfAccounts.Children.Count=0", "Csak gyermek objektum választható ki!", SkipNullOrEmptyValues:=False)> _
Public Class GLBank
Inherits GLHeader
Private _PartnerType As ePartnerType
Private _TransactionType As eTransactionType
Private _ChartOfAccounts As ChartOfAccounts
Private _TotalInAmountHUF As Double = 0
Private _TotalOutAmountHUF As Double = 0
Private _TotalInAmountDEV As Double = 0
Private _TotalOutAmountDEV As Double = 0
Private _LiquidAssets As LiquidAssets
Private _BallanceHUF As Double
Private _BallanceDEV As Double
Private _PCIGroup As PCIGroup
Private _GLHeader_RateDiff As GLHeader 'Kapcsolódó árf. kül. elszámolási vegyes bizonylat
'-- A másodlagos
Private _row_CurrencyRate As Double
Private _row_AmountDEV2 As Double = 0
Private _row_CurrencyRate2 As Double = 0
Private _row_CurrencyName2 As CurrencyName
Private _BankImportHeaderSum As BankImportHeaderSum
Public Sub New(ByVal session As Session)
MyBase.New(session)
End Sub
Public Overrides Sub AfterConstruction()
MyBase.AfterConstruction()
If Session.IsNewObject(Me) Then
Me.GLDocumentType = eGLDocumentType.eGLBank
Me.DateExecution = Now
Me.row_PartnerType = ePartnerType.eNotSet
Me.row_TransactionType = eTransactionType.eNotSet
End If
End Sub
<NonPersistent()> _
<VisibleInListView(False)> _
<RuleValueComparison("GLBank-row_PartnerType", "aToTable_GLBank_Contexts", ValueComparisonType.NotEquals, ePartnerType.eNotSet, TargetCriteria:="row_TransactionType in (0,1)")> _
Property row_PartnerType() As ePartnerType
Get
Return _PartnerType
End Get
Set(ByVal value As ePartnerType)
SetPropertyValue("row_PartnerType", _PartnerType, value)
End Set
End Property
<NonPersistent()> _
<ImmediatePostData(True)> _
<VisibleInListView(False)> _
<RuleValueComparison("GLBank-row_TransactionType", "aToTable_GLBank_Contexts", ValueComparisonType.NotEquals, eTransactionType.eNotSet)> _
Property row_TransactionType() As eTransactionType
Get
Return _TransactionType
End Get
Set(ByVal value As eTransactionType)
SetPropertyValue("row_TransactionType", _TransactionType, value)
If Session.IsObjectsLoading = False And Session.IsObjectsSaving = False Then
If LiquidAssets_Main IsNot Nothing Then
Select Case row_TransactionType
Case eTransactionType.eNormalCredit, eTransactionType.eNormalDebit, eTransactionType.eNotSet, eTransactionType.eCorrectionCreditHUF, eTransactionType.eCorrectionDebitHUF
row_PartnerType = ePartnerType.eNotSet
row_CurrencyName2 = LiquidAssets_Main.CurrencyName
Case eTransactionType.ePartnerCredit
row_PartnerType = ePartnerType.eReceivables
Case eTransactionType.ePartnerDebit
row_PartnerType = ePartnerType.ePayabels
End Select
End If
End If
End Set
End Property
<NonPersistent()>
<ImmediatePostData(True), DataSourceCriteria("AccountYear=GetYear('@This.DateExecution')")>
<RuleRequiredField("GLBank-row_ChartOfAccounts", "aToTable_GLBank_Contexts", TargetCriteria:="row_TransactionType in (2,3,4)")>
<VisibleInListView(False)>
Property row_ChartOfAccounts() As ChartOfAccounts
Get
Return _ChartOfAccounts
End Get
Set(ByVal value As ChartOfAccounts)
SetPropertyValue("row_ChartOfAccounts", _ChartOfAccounts, value)
End Set
End Property
<NonPersistent()>
<ImmediatePostData(True), DataSourceCriteria("CustomersFrom='@This.CustomersFrom' and PartnerType='@This.row_PartnerType' and BallanceState=0 and isnull(CurrencyName_Account)=False ")>
<VisibleInListView(False)>
Property row_PCIGroup() As PCIGroup
Get
Return _PCIGroup
End Get
Set(ByVal value As PCIGroup)
SetPropertyValue("row_PCIGroup", _PCIGroup, value)
If Session.IsObjectsLoading = False And Session.IsObjectsSaving = False Then
If value IsNot Nothing Then
row_ConnectInfo = value.ConnectInfo
row_Customer = value.Customers
row_PartnerType = value.PartnerType
If value.CurrencyName_Account Is Nothing Then
If Me.CurrencyName.ShortName = "HUF" Then
Me.row_AmountHUF = Math.Abs(value.BallanceHUF)
row_CurrencyName2 = Session.FindObject(Of CurrencyName)(CriteriaOperator.Parse("ShortName='HUF'"))
Else
row_CurrencyName2 = Session.FindObject(Of CurrencyName)(CriteriaOperator.Parse("ShortName='HUF'"))
End If
Else
If value.CurrencyName_Account.ShortName = "HUF" Then
If Me.CurrencyName.ShortName = "HUF" Then
Me.row_AmountHUF = Math.Abs(value.BallanceHUF)
row_CurrencyName2 = Session.FindObject(Of CurrencyName)(CriteriaOperator.Parse("ShortName='HUF'"))
Else
row_CurrencyName2 = Session.FindObject(Of CurrencyName)(CriteriaOperator.Parse("ShortName='HUF'"))
End If
Else
If Me.CurrencyName.ShortName = value.CurrencyName_Account.ShortName Then
Me.row_AmountDEV = Math.Abs(value.BallanceDEV)
row_CurrencyName2 = Session.FindObject(Of CurrencyName)(CriteriaOperator.Parse("ShortName=?", value.CurrencyName_Account.ShortName))
Else
row_CurrencyName2 = Session.FindObject(Of CurrencyName)(CriteriaOperator.Parse("ShortName=?", value.CurrencyName_Account.ShortName))
End If
End If
End If
End If
End If
End Set
End Property
<ImmediatePostData(True), DataSourceCriteria("LiquidAssetsType=1 and CustomerFrom='@This.CustomersFrom'")>
<RuleRequiredField("GLBank-LiquidAssets_Cassa", "aFinal_GLBank_Context")> _
<RuleRequiredField("GLBank-LiquidAssets_Cassa2", "aFinalAndNew_GLBank_Context")> _
<VisibleInListView(False)> _
Property LiquidAssets_Main() As LiquidAssets
Get
Return _LiquidAssets
End Get
Set(ByVal value As LiquidAssets)
SetPropertyValue("LiquidAssets_Main", _LiquidAssets, value)
If Session.IsObjectsSaving = False And Session.IsObjectsLoading = False Then
row_LiquidAssets = value
row_CurrencyName2 = value.CurrencyName
If value IsNot Nothing Then
Me.CurrencyName = value.CurrencyName
Me.row_CurrencyName2 = CurrencyName
If Me.DateExecution > Now.AddYears(-1) Then
BallanceHUF = GetBallanceHUF(value, Me.DateExecution)
BallanceDEV = GetBallanceDEV(value, Me.DateExecution)
End If
End If
End If
End Set
End Property
<NonPersistent()> _
<ImmediatePostData(True)> _
<VisibleInListView(False)> _
<RuleRange("GLBank-row_CurrencyRate", "aToTable_GLBank_Contexts", 0.01, 999999, TargetCriteria:="LiquidAssets_Main.CurrencyName.ShortName != 'HUF' and not (row_TransactionType in (5,6))")> _
Property row_CurrencyRate As Double
Get
Return _row_CurrencyRate
End Get
Set(value As Double)
SetPropertyValue("row_CurrencyRate", _row_CurrencyRate, value)
If Session.IsObjectsLoading = False And Session.IsObjectsSaving = False Then
If row_CurrencyName2 Is Nothing Then row_CurrencyName2 = LiquidAssets_Main.CurrencyName
If LiquidAssets_Main.CurrencyName.ShortName = "HUF" And row_CurrencyName2.ShortName <> "HUF" Then
If row_CurrencyRate <> 0 Then row_AmountDEV2 = Math.Round(row_AmountHUF / row_CurrencyRate, 2, MidpointRounding.AwayFromZero)
End If
If LiquidAssets_Main.CurrencyName.ShortName <> "HUF" And row_CurrencyName2.ShortName = "HUF" Then
row_AmountHUF = row_AmountDEV * Math.Round(row_CurrencyRate, 2, MidpointRounding.AwayFromZero)
row_AmountDEV2 = row_AmountHUF
End If
If LiquidAssets_Main.CurrencyName.ShortName <> "HUF" And row_CurrencyName2.ShortName <> "HUF" Then
row_AmountHUF = row_AmountDEV * Math.Round(row_CurrencyRate, 2, MidpointRounding.AwayFromZero)
End If
End If
End Set
End Property
<NonPersistent()> _
<ImmediatePostData(True)> _
<VisibleInListView(False)> _
Property row_AmountDEV2 As Double
Get
Return _row_AmountDEV2
End Get
Set(value As Double)
SetPropertyValue("row_AmountDEV2", _row_AmountDEV2, value)
If Session.IsObjectsLoading = False And Session.IsObjectsSaving = False Then
If row_CurrencyName2 Is Nothing Then row_CurrencyName2 = LiquidAssets_Main.CurrencyName
If LiquidAssets_Main.CurrencyName.ShortName <> "HUF" And _
row_CurrencyName2.ShortName <> "HUF" And _
LiquidAssets_Main.CurrencyName.ShortName <> row_CurrencyName2.ShortName Then
If row_AmountDEV <> 0 Then
row_CurrencyRate2 = Math.Round(row_AmountDEV2 / row_AmountDEV, 4, MidpointRounding.AwayFromZero)
End If
End If
End If
End Set
End Property
<NonPersistent()> _
<ImmediatePostData(True)> _
<VisibleInListView(False)> _
<RuleRange("GLBank.CurrencyName.ToTable", "aToTable_GLBank_Contexts", 0.01, 999999999999999999, _
TargetCriteria:="LiquidAssets_Main.CurrencyName.ShortName != row_CurrencyName2.ShortName and " +
"LiquidAssets_Main.CurrencyName.ShortName !='HUF' and " +
"row_CurrencyName2.ShortName !='HUF'")> _
Property row_CurrencyRate2 As Double
Get
Return _row_CurrencyRate2
End Get
Set(ByVal value As Double)
SetPropertyValue("row_CurrencyRate2", _row_CurrencyRate2, value)
End Set
End Property
<NonPersistent()> _
<ImmediatePostData(True)> _
<VisibleInListView(False)> _
Property row_CurrencyName2 As CurrencyName
Get
Return _row_CurrencyName2
End Get
Set(value As CurrencyName)
SetPropertyValue("row_CurrencyName2", _row_CurrencyName2, value)
If Session.IsObjectsLoading = False And Session.IsObjectsSaving = False Then
row_AmountDEV2 = 0
row_CurrencyRate2 = 0
End If
End Set
End Property
Property TotalInAmountHUF As Double
Get
Return _TotalInAmountHUF
End Get
Set(ByVal value As Double)
SetPropertyValue("TotalInAmountHUF", _TotalInAmountHUF, value)
End Set
End Property
Property TotalOutAmountHUF As Double
Get
Return _TotalOutAmountHUF
End Get
Set(ByVal value As Double)
SetPropertyValue("TotalOutAmountHUF", _TotalOutAmountHUF, value)
End Set
End Property
Property TotalInAmountDEV As Double
Get
Return _TotalInAmountDEV
End Get
Set(ByVal value As Double)
SetPropertyValue("TotalInAmountDEV", _TotalInAmountDEV, value)
End Set
End Property
Property TotalOutAmountDEV As Double
Get
Return _TotalOutAmountDEV
End Get
Set(ByVal value As Double)
SetPropertyValue("TotalOutAmountDEV", _TotalOutAmountDEV, value)
End Set
End Property
Property BallanceHUF As Double
Get
Return _BallanceHUF
End Get
Set(ByVal value As Double)
SetPropertyValue("BallanceHUF", _BallanceHUF, value)
End Set
End Property
Property BallanceDEV As Double
Get
Return _BallanceDEV
End Get
Set(ByVal value As Double)
SetPropertyValue("BallanceDEV", _BallanceDEV, value)
End Set
End Property
Property BankImportHeaderSum As BankImportHeaderSum
Get
Return _BankImportHeaderSum
End Get
Set(value As BankImportHeaderSum)
SetPropertyValue("BankImportHeaderSum", _BankImportHeaderSum, value)
End Set
End Property
Property GLHeader_RateDiff As GLHeader
Get
Return _GLHeader_RateDiff
End Get
Set(value As GLHeader)
SetPropertyValue("GLHeader_RateDiff", _GLHeader_RateDiff, value)
End Set
End Property
Sub RecalculateTotal()
Dim _GLRows As GLRows
TotalInAmountHUF = 0
TotalOutAmountHUF = 0
TotalInAmountDEV = 0
TotalOutAmountDEV = 0
For Each _GLRows In Me.GLRows
Me.TotalInAmountHUF += _GLRows.InAmountHUF
Me.TotalOutAmountHUF += _GLRows.OutAmountHUF
Me.TotalInAmountDEV += _GLRows.InAmountDEV
Me.TotalOutAmountDEV += _GLRows.OutAmountDEV
Next
Me.Save()
End Sub
ReadOnly Property CloseHUF As Double
Get
Return BallanceHUF + TotalInAmountHUF - TotalOutAmountHUF
End Get
End Property
ReadOnly Property CloseDEV As Double
Get
Return BallanceDEV + TotalInAmountDEV - TotalOutAmountDEV
End Get
End Property
ReadOnly Property DisplayName As String
Get
If Me.LiquidAssets_Main IsNot Nothing Then
Return Me.LiquidAssets_Main.ShortName
Else
Return Nothing
End If
End Get
End Property
<RuleValueComparison("GLBank-row_AmountDEV", "aToTable_GLBank_Contexts", ValueComparisonType.GreaterThan, 0, TargetCriteria:="CurrencyName.ShortName != 'HUF' and not (row_TransactionType in (5,6))")> _
Overrides Property row_AmountDEV As Double
Get
Return MyBase.row_AmountDEV
End Get
Set(value As Double)
MyBase.row_AmountDEV = value
If Session.IsObjectsLoading = False And Session.IsObjectsSaving = False Then
If row_CurrencyName2 Is Nothing Then row_CurrencyName2 = LiquidAssets_Main.CurrencyName
If Me.row_CurrencyRate > 0 Then
Me.row_AmountHUF = value * Me.row_CurrencyRate
End If
If LiquidAssets_Main.CurrencyName.ShortName <> "HUF" Then
If LiquidAssets_Main.CurrencyName.ShortName = row_CurrencyName2.ShortName Then
Else
row_AmountDEV2 = row_AmountDEV * Math.Round(row_CurrencyRate2, 2, MidpointRounding.AwayFromZero)
End If
End If
End If
End Set
End Property
<RuleRequiredField("GLBank-row_Customers", "aToTable_GLBank_Contexts", TargetCriteria:="row_TransactionType in (0,1)")> _
<ImmediatePostData(True)> _
Overrides Property row_Customer As Customers
Get
Return MyBase.row_Customer
End Get
Set(value As Customers)
MyBase.row_Customer = value
End Set
End Property
Overrides Property row_Controlling As Controlling
Get
Return MyBase.row_Controlling
End Get
Set(value As Controlling)
MyBase.row_Controlling = value
If Session.IsObjectsSaving = False And Session.IsObjectsLoading = False Then
If value.ChartOfAccounts IsNot Nothing Then
row_ChartOfAccounts = value.GetChartOfAccounts(Me.DateExecution.Year, False)
End If
End If
End Set
End Property
Function GetBallanceHUF(ByVal _LiquidAssets As LiquidAssets, ByVal _ToDate As Date) As Double
Dim _SQL As String
Dim _SelectedData As SelectedData = Nothing
Dim _BallanceHUF As Double = 0
_SQL = " SELECT t1.LiquidAssets_Main AS LiquidAssets,"
_SQL += " SUM(t3.InAmountHUF)-SUM(t3.OutAmountHUF) As BallanceHUF,"
_SQL += " SUM(t3.InAmountDEV)-SUM(t3.OutAmountDEV) As BallanceDEV"
_SQL += " FROM GLBank t1 JOIN GLHeader t2 ON"
_SQL += " t1.Oid=t2.Oid JOIN GLRows t3 On"
_SQL += " t2.Oid=t3.GLHeader"
_SQL += " WHERE t2.GCRecord IS NULL AND t3.GCRecord IS NULL AND t1.LiquidAssets_Main=@Bank AND "
_SQL += " DATE(t2.DateExecution)<=@Date"
Dim _stringparam() As String = New String() {"@Bank", "@Date"}
Dim _objectparam() As Object = New Object() {_LiquidAssets.Oid, _ToDate.Date}
_SelectedData = Session.ExecuteQuery(_SQL, _stringparam, _objectparam)
For Each row As SelectStatementResultRow In _SelectedData.ResultSet(0).Rows
_BallanceHUF = row.Values(1)
Next row
Return _BallanceHUF
End Function
Function GetBallanceOpenHUF(ByVal _LiquidAssets As LiquidAssets, ByVal _ToDate As Date) As Double
Dim _SQL As String
Dim _SelectedData As SelectedData = Nothing
Dim _BallanceHUF As Double = 0
_SQL = " SELECT t1.LiquidAssets_Main AS LiquidAssets,"
_SQL += " SUM(t3.InAmountHUF)-SUM(t3.OutAmountHUF) As BallanceHUF,"
_SQL += " SUM(t3.InAmountDEV)-SUM(t3.OutAmountDEV) As BallanceDEV"
_SQL += " FROM GLBank t1 JOIN GLHeader t2 ON"
_SQL += " t1.Oid=t2.Oid JOIN GLRows t3 On"
_SQL += " t2.Oid=t3.GLHeader"
_SQL += " WHERE t2.GCRecord IS NULL AND t3.GCRecord IS NULL AND t1.LiquidAssets_Main=@Bank AND "
_SQL += " DATE(t2.DateExecution)<@Date"
Dim _stringparam() As String = New String() {"@Bank", "@Date"}
Dim _objectparam() As Object = New Object() {_LiquidAssets.Oid, _ToDate.Date}
_SelectedData = Session.ExecuteQuery(_SQL, _stringparam, _objectparam)
For Each row As SelectStatementResultRow In _SelectedData.ResultSet(0).Rows
_BallanceHUF = row.Values(1)
Next row
Return _BallanceHUF
End Function
Function GetBallanceDEV(ByVal _LiquidAssets As LiquidAssets, ByVal _ToDate As Date) As Double
Dim _SQL As String
Dim _SelectedData As SelectedData = Nothing
Dim _BallanceDEV As Double = 0
_SQL = " SELECT t1.LiquidAssets_Main AS LiquidAssets,"
_SQL += " SUM(t3.InAmountHUF)-SUM(t3.OutAmountHUF) As BallanceHUF,"
_SQL += " SUM(t3.InAmountDEV)-SUM(t3.OutAmountDEV) As BallanceDEV"
_SQL += " FROM GLBank t1 JOIN GLHeader t2 ON"
_SQL += " t1.Oid=t2.Oid JOIN GLRows t3 On"
_SQL += " t2.Oid=t3.GLHeader"
_SQL += " WHERE t2.GCRecord IS NULL AND t3.GCRecord IS NULL AND t1.LiquidAssets_Main=@Bank AND "
_SQL += " DATE(t2.DateExecution)<=@Date"
Dim _stringparam() As String = New String() {"@Bank", "@Date"}
Dim _objectparam() As Object = New Object() {_LiquidAssets.Oid, _ToDate.Date}
_SelectedData = Session.ExecuteQuery(_SQL, _stringparam, _objectparam)
For Each row As SelectStatementResultRow In _SelectedData.ResultSet(0).Rows
_BallanceDEV = row.Values(2)
Next row
Return _BallanceDEV
End Function
Function GetBallanceOpenDEV(ByVal _LiquidAssets As LiquidAssets, ByVal _ToDate As Date) As Double
Dim _SQL As String
Dim _SelectedData As SelectedData = Nothing
Dim _BallanceDEV As Double = 0
_SQL = " SELECT t1.LiquidAssets_Main AS LiquidAssets,"
_SQL += " SUM(t3.InAmountHUF)-SUM(t3.OutAmountHUF) As BallanceHUF,"
_SQL += " SUM(t3.InAmountDEV)-SUM(t3.OutAmountDEV) As BallanceDEV"
_SQL += " FROM GLBank t1 JOIN GLHeader t2 ON"
_SQL += " t1.Oid=t2.Oid JOIN GLRows t3 On"
_SQL += " t2.Oid=t3.GLHeader"
_SQL += " WHERE t2.GCRecord IS NULL AND t3.GCRecord IS NULL AND t1.LiquidAssets_Main=@Bank AND "
_SQL += " DATE(t2.DateExecution)<@Date"
Dim _stringparam() As String = New String() {"@Bank", "@Date"}
Dim _objectparam() As Object = New Object() {_LiquidAssets.Oid, _ToDate.Date}
_SelectedData = Session.ExecuteQuery(_SQL, _stringparam, _objectparam)
For Each row As SelectStatementResultRow In _SelectedData.ResultSet(0).Rows
_BallanceDEV = row.Values(2)
Next row
Return _BallanceDEV
End Function
End Class