68 lines
3.0 KiB
VB.net
68 lines
3.0 KiB
VB.net
Imports System
|
|
Imports System.ComponentModel
|
|
Imports System.Collections.Generic
|
|
Imports System.Diagnostics
|
|
Imports System.Text
|
|
|
|
Imports DevExpress.ExpressApp
|
|
Imports DevExpress.ExpressApp.Actions
|
|
Imports DevExpress.Persistent.Base
|
|
Imports DevExpress.Data.Filtering
|
|
Imports DevExpress.Xpo
|
|
Imports DevExpress.ExpressApp.SystemModule
|
|
Imports System.Linq
|
|
Imports System.IO
|
|
Imports DevExpress.ExpressApp.Editors
|
|
Imports DevExpress.Persistent.BaseImpl
|
|
|
|
Public Module ViewAttachments
|
|
Public Sub ViewAttachments(_ObjectSpace As Xpo.XPObjectSpace, _Frame As DevExpress.ExpressApp.Frame, _
|
|
_CustomersFrom As CustomersFrom, _Customers As Customers, _
|
|
_DocumentNumber As String, Optional _DocumentNumberProforma As String = "", _
|
|
Optional _GLMixed As GLMixed = Nothing)
|
|
|
|
Dim _RegistryHeader As RegistryHeader = _ObjectSpace.FindObject(Of RegistryHeader) _
|
|
(CriteriaOperator.Parse("CustomersFrom=? and Customers=? and DocumentNumber=?", _CustomersFrom, _Customers, _DocumentNumber))
|
|
|
|
Dim _InvoiceHeader As InvoiceHeader = _ObjectSpace.FindObject(Of InvoiceHeader) _
|
|
(CriteriaOperator.Parse("CustomersFrom=? and Customers=? and DocumentNumber=?", _CustomersFrom, _Customers, _DocumentNumber))
|
|
|
|
If _InvoiceHeader Is Nothing Then
|
|
_InvoiceHeader = _ObjectSpace.FindObject(Of InvoiceHeader)(CriteriaOperator.Parse("CustomersFrom=? and Customers=? and DocumentNumberProforma=?", _CustomersFrom, _Customers, _DocumentNumberProforma))
|
|
End If
|
|
|
|
If _RegistryHeader IsNot Nothing Then
|
|
|
|
Dim _FilePath As String = Path.Combine(Path.GetTempPath(), _RegistryHeader.DocumentFile.FileName)
|
|
Dim _Stream As Stream = New FileStream(_FilePath, FileMode.Create)
|
|
_RegistryHeader.DocumentFile.SaveToStream(_Stream)
|
|
_Stream.Close()
|
|
Process.Start(_FilePath)
|
|
ElseIf _InvoiceHeader IsNot Nothing Then
|
|
Dim _ReportData As ReportData
|
|
Dim _ReportData_DEV As ReportData
|
|
Dim _ReportData_DEV_EU As ReportData
|
|
Dim _CurrencyName As CurrencyName
|
|
_CurrencyName = _InvoiceHeader.CurrencyName
|
|
If _InvoiceHeader IsNot Nothing Then
|
|
|
|
Dim _XAFPrintHelper_I As New XAFPrintHelper(_ObjectSpace, _Frame, _InvoiceHeader.InvoiceType.ReportDataV2, CriteriaOperator.Parse("InvoiceHeader.Oid=?", _InvoiceHeader.Oid))
|
|
_XAFPrintHelper_I.ShowPreviewV2()
|
|
|
|
End If
|
|
End If
|
|
If _GLMixed IsNot Nothing Then
|
|
If _GLMixed.DocumentFile IsNot Nothing Then
|
|
ProcessDocument(_GLMixed.DocumentFile)
|
|
End If
|
|
End If
|
|
End Sub
|
|
Private Sub ProcessDocument(_DocumentFile As FileData)
|
|
Dim _FilePath As String = Path.Combine(Path.GetTempPath(), _DocumentFile.FileName)
|
|
Dim _Stream As Stream = New FileStream(_FilePath, FileMode.Create)
|
|
_DocumentFile.SaveToStream(_Stream)
|
|
_Stream.Close()
|
|
Process.Start(_FilePath)
|
|
End Sub
|
|
End Module
|