Napi pénztári jelentés javítása

This commit is contained in:
2018-04-18 20:42:12 +02:00
parent c372a33399
commit 5b333614ae
@@ -13,11 +13,12 @@ Imports System.Configuration
Imports System.Linq
Imports System.Linq.Expressions
Imports DevExpress.ExpressApp.ConditionalAppearance
Imports DevExpress.Xpo.DB
<DefaultClassOptions()> _
<NavigationItem(False), CreatableItem(False)> _
<DeferredDeletion(False)> _
<Appearance("Hide DEV when HUF in ReturnHeade", AppearanceItemType.ViewItem, "LiquidAssets.CurrencyName.ShortName='HUF'", TargetItems:="BallanceFromDEV;BallanceToDEV", visibility:=DevExpress.ExpressApp.Editors.ViewItemVisibility.Hide)> _
<DefaultClassOptions()>
<NavigationItem(False), CreatableItem(False)>
<DeferredDeletion(False)>
<Appearance("Hide DEV when HUF in ReturnHeade", AppearanceItemType.ViewItem, "LiquidAssets.CurrencyName.ShortName='HUF'", TargetItems:="BallanceFromDEV;BallanceToDEV", Visibility:=DevExpress.ExpressApp.Editors.ViewItemVisibility.Hide)>
Public Class LiquidAssetsReturnHeader 'Pénzeszközök egyenlege
Inherits BaseObject
Private _CustomersFrom As CustomersFrom 'Saját cég
@@ -41,14 +42,14 @@ Public Class LiquidAssetsReturnHeader 'Pénzeszközök egyenlege
UserCreated = Session.GetObjectByKey(Of User)(Session.GetKeyValue(SecuritySystem.CurrentUser))
End If
End Sub
<VisibleInListView(False)> _
<Association("LiquidAssetsReturnHeader-LiquidAssetsReturnRows", GetType(LiquidAssetsReturnRows)), Aggregated()> _
<VisibleInListView(False)>
<Association("LiquidAssetsReturnHeader-LiquidAssetsReturnRows", GetType(LiquidAssetsReturnRows)), Aggregated()>
ReadOnly Property LiquidAssetsReturnRows As XPCollection(Of LiquidAssetsReturnRows)
Get
Return GetCollection(Of LiquidAssetsReturnRows)("LiquidAssetsReturnRows")
End Get
End Property
<VisibleInListView(False)> _
<VisibleInListView(False)>
ReadOnly Property LiquidAssetsReturnRowsGLRows As XPCollection(Of GLRows)
Get
Dim _GLRows As GLRows
@@ -62,15 +63,15 @@ Public Class LiquidAssetsReturnHeader 'Pénzeszközök egyenlege
Return _LiquidAssetsReturnRowsGLRows
End Get
End Property
<VisibleInListView(False)> _
<Association("LiquidAssetsReturnHeader-LiquidAssetsReturnDenomination", GetType(LiquidAssetsReturnDenomination)), Aggregated()> _
<VisibleInListView(False)>
<Association("LiquidAssetsReturnHeader-LiquidAssetsReturnDenomination", GetType(LiquidAssetsReturnDenomination)), Aggregated()>
ReadOnly Property LiquidAssetsReturnDenomination As XPCollection(Of LiquidAssetsReturnDenomination)
Get
Return GetCollection(Of LiquidAssetsReturnDenomination)("LiquidAssetsReturnDenomination")
End Get
End Property
<ImmediatePostData(True)> _
<ImmediatePostData(True)>
Property CustomersFrom As CustomersFrom
Get
Return _CustomersFrom
@@ -397,7 +398,7 @@ Public Class LiquidAssetsReturnHeader 'Pénzeszközök egyenlege
SetPropertyValue("BallanceToDEV", _BallanceToDEV, value)
End Set
End Property
<NonCloneable> _
<NonCloneable>
Property ObjectCreated As Date
Get
Return _ObjectCreated
@@ -406,7 +407,7 @@ Public Class LiquidAssetsReturnHeader 'Pénzeszközök egyenlege
SetPropertyValue("ObjectCreated", _ObjectCreated, value)
End Set
End Property
<NonCloneable> _
<NonCloneable>
Property UserCreated As User
Get
Return _UserCreated
@@ -415,7 +416,7 @@ Public Class LiquidAssetsReturnHeader 'Pénzeszközök egyenlege
SetPropertyValue("UserCreated", _UserCreated, value)
End Set
End Property
<Browsable(False)> _
<Browsable(False)>
Property GLClosingTime As GLClosingTime
Get
Return _GLClosingTime
@@ -432,25 +433,45 @@ Public Class LiquidAssetsReturnHeader 'Pénzeszközök egyenlege
BallanceFromDEV = 0
BallanceToHUF = 0
BallanceToDEV = 0
Dim _GLRows_Collection As New XPCollection(Of GLRows)(Session, CriteriaOperator.Parse("GetDate(GLHeader.DateExecution)<? and GLHeader.DocumentNumber<>'' and GLHeader.IsStorno=False", DateFrom.Date))
Dim query = From _GLRows In _GLRows_Collection _
Where _GLRows.GLHeader.DateExecution.Date < DateFrom.Date And _GLRows.LiquidAssets Is Me.LiquidAssets And
_GLRows.GLHeader.IsEditable = False And
String.IsNullOrEmpty(_GLRows.GLHeader.DocumentNumber) = False And
_GLRows.GLHeader IsNot Nothing
Group _GLRows By _GLRows.GLHeader.CustomersFrom, _
_GLRows.LiquidAssets Into g = Group _
Select New With {Key .CustomersFrom = CustomersFrom, _
Key .LiquidAssets = LiquidAssets, _
Key .InAmountHUF = g.Sum(Function(inv) inv.InAmountHUF), _
Key .OutAmountHUF = g.Sum(Function(inv) inv.OutAmountHUF), _
Key .InAmountDEV = g.Sum(Function(inv) inv.InAmountDEV), _
Key .OutAmountDEV = g.Sum(Function(inv) inv.OutAmountDEV)}
'Dim _GLRows_Collection As New XPCollection(Of GLRows)(Session, CriteriaOperator.Parse("GetDate(GLHeader.DateExecution)<? and GLHeader.DocumentNumber<>'' and GLHeader.IsStorno=False", DateFrom.Date))
'Dim query = From _GLRows In _GLRows_Collection _
' Where _GLRows.GLHeader.DateExecution.Date < DateFrom.Date And _GLRows.LiquidAssets Is Me.LiquidAssets And
' _GLRows.GLHeader.IsEditable = False And
' String.IsNullOrEmpty(_GLRows.GLHeader.DocumentNumber) = False And
' _GLRows.GLHeader IsNot Nothing
' Group _GLRows By _GLRows.GLHeader.CustomersFrom, _
' _GLRows.LiquidAssets Into g = Group _
' Select New With {Key .CustomersFrom = CustomersFrom, _
' Key .LiquidAssets = LiquidAssets, _
' Key .InAmountHUF = g.Sum(Function(inv) inv.InAmountHUF), _
' Key .OutAmountHUF = g.Sum(Function(inv) inv.OutAmountHUF), _
' Key .InAmountDEV = g.Sum(Function(inv) inv.InAmountDEV), _
' Key .OutAmountDEV = g.Sum(Function(inv) inv.OutAmountDEV)}
For Each item In query
BallanceFromHUF += item.InAmountHUF - item.OutAmountHUF
BallanceFromDEV += item.InAmountDEV - item.OutAmountDEV
'For Each item In query
' BallanceFromHUF += item.InAmountHUF - item.OutAmountHUF
' BallanceFromDEV += item.InAmountDEV - item.OutAmountDEV
'Next
Dim _SQL As String
Dim _SelectStatementResultRow As SelectStatementResultRow
Dim _SelectedData As DevExpress.Xpo.DB.SelectedData = Nothing
_SQL = " SELECT t2.CustomersFrom,t1.LiquidAssets,ROUND(SUM(t1.InAmountHUF-t1.OutAmountHUF),0),ROUND(SUM(t1.InAmountDEV-t1.OutAmountDEV),2)"
_SQL += " FROM GLRows t1 JOIN GLHeader t2 ON"
_SQL += " t1.GLHeader=t2.Oid AND t1.GCRecord IS NULL AND t2.GCRecord IS NULL"
_SQL += " WHERE DATE(t2.DateExecution)<'" & DateFrom.Date.ToString("yyyy-MM-dd") & "' AND t2.DocumentNumber !='' AND t2.IsStorno!=1 AND t1.LiquidAssets ='" & Me.LiquidAssets.Oid.ToString() & "'"
_SQL += " GROUP BY t2.CustomersFrom,t1.LiquidAssets"
_SelectedData = Session.ExecuteQuery(_SQL)
If _SelectedData.ResultSet.Length > 0 Then
For Each _SelectStatementResultRow In _SelectedData.ResultSet(0).Rows
BallanceFromHUF = _SelectStatementResultRow.Values(2)
BallanceFromDEV = _SelectStatementResultRow.Values(3)
Next
End If
Dim _LiquidAssetsReturnRows As LiquidAssetsReturnRows
Dim _ReturnAmountHUF As Double = 0
Dim _ReturnAmountDEV As Double = 0