60 lines
2.9 KiB
VB.net
60 lines
2.9 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 System.Linq
|
|
Imports SISBusiness.Module.Dennis.Linq
|
|
|
|
<DefaultClassOptions()> _
|
|
<NavigationItem(False), CreatableItem(False)> _
|
|
Public Class ContractProductLINQ
|
|
Inherits BaseObject
|
|
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.
|
|
End Sub
|
|
<CustomQueryProperties("DisplayableProperties", "ProductNumber;ShortName;Unit;QTT_Free")> _
|
|
Public Shared Function ContractProductsRowsGroup(ByVal s As Session) As IQueryable
|
|
Dim _ContractProductsRowsGroup As New XPQuery(Of ContractProductRows)(s)
|
|
Dim query = _
|
|
From e In _ContractProductsRowsGroup _
|
|
Where e.ContractProductHeader.ContractTemplate.PartnerType = ePartnerType.ePayabels _
|
|
Group e By e.Products.Oid, e.Products.ProductNumber, e.Products.ShortName, UnitShortName = e.Products.Units.ShortName Into gg = Group _
|
|
Select New With {Key .ProductNumber = ProductNumber, _
|
|
Key .ShortName = ShortName, _
|
|
Key .Unit = UnitShortName, _
|
|
Key .QTT_Free = gg.Sum(Function(inv) inv.QTT) - gg.Sum(Function(inv) inv.QTT_Out)}
|
|
Return query
|
|
End Function
|
|
<CustomQueryProperties("DisplayableProperties", "FullName;ProductNumber;ShortName;Unit;QTT_Free")> _
|
|
Public Shared Function ContractProductsRowsCustomersGroup(ByVal s As Session) As IQueryable
|
|
Dim _ContractProductsRowsGroup As New XPQuery(Of ContractProductRows)(s)
|
|
Dim query = _
|
|
From e In _ContractProductsRowsGroup _
|
|
Where e.ContractProductHeader.ContractTemplate.PartnerType = ePartnerType.ePayabels _
|
|
Group e By e.ContractProductHeader.Customers.FullName, e.Products.ProductNumber, e.Products.ShortName, UnitShortName = e.Products.Units.ShortName Into gg = Group _
|
|
Select New With {Key .FullName = FullName, _
|
|
Key .ProductNumber = ProductNumber, _
|
|
Key .ShortName = ShortName, _
|
|
Key .Unit = UnitShortName, _
|
|
Key .QTT_Free = gg.Sum(Function(inv) inv.QTT) - gg.Sum(Function(inv) inv.QTT_Out)}
|
|
Return query
|
|
End Function
|
|
End Class
|