81 lines
3.4 KiB
VB.net
81 lines
3.4 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.ExpressApp.Web.SystemModule
|
|
Imports System.IO
|
|
Imports DevExpress.Data.Filtering
|
|
Imports DevExpress.Web.Internal
|
|
|
|
Imports System.Web
|
|
Imports System.Net
|
|
|
|
Imports DevExpress.ExpressApp.Web
|
|
|
|
Public Class PCIGroupVC
|
|
Inherits DevExpress.ExpressApp.ViewController
|
|
|
|
Public Sub New()
|
|
MyBase.New()
|
|
|
|
'This call is required by the Component Designer.
|
|
InitializeComponent()
|
|
RegisterActions(components)
|
|
Me.TargetObjectType = GetType(SISBusiness.Module.PCIGroup)
|
|
End Sub
|
|
Protected Overrides Sub OnActivated()
|
|
MyBase.OnActivated()
|
|
Frame.GetController(Of ListViewController).EditAction.Active.SetItemValue("", False)
|
|
Frame.GetController(Of PCIGroupVC).aViewBill.Active.SetItemValue("", False)
|
|
If View.Id = "PCIGroup_ListView_Support" Then
|
|
Frame.GetController(Of PCIGroupVC).aViewBill.Active.SetItemValue("", True)
|
|
End If
|
|
If View.Id = "PCIGroup_ListView_Subcontractor" Then
|
|
Frame.GetController(Of PCIGroupVC).aViewBill.Active.SetItemValue("", True)
|
|
End If
|
|
End Sub
|
|
Protected Overrides Sub OnDeactivated()
|
|
MyBase.OnDeactivated()
|
|
Frame.GetController(Of ListViewController).EditAction.Active.SetItemValue("", True)
|
|
End Sub
|
|
Private Sub aViewBill_Execute_1(sender As System.Object, e As DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs) Handles aViewBill.Execute
|
|
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
|
|
Dim _PCIGroup As PCIGroup = TryCast(View.SelectedObjects(0), PCIGroup)
|
|
|
|
If _PCIGroup IsNot Nothing Then
|
|
If _PCIGroup.PartnerType = ePartnerType.eReceivables Then
|
|
Dim _InvoiceHeader As InvoiceHeader = _ocur.FindObject(Of InvoiceHeader)(CriteriaOperator.Parse("CustomersFrom.Oid=? and Customers.Oid=? and DocumentNumber=?", _PCIGroup.CustomersFrom.Oid, _PCIGroup.Customers.Oid, _PCIGroup.DocumentNumber))
|
|
If _InvoiceHeader IsNot Nothing Then
|
|
|
|
If _InvoiceHeader.PDF_Copy IsNot Nothing Then
|
|
Dim _FileStream As New MemoryStream
|
|
_InvoiceHeader.PDF_Copy.SaveToStream(_FileStream)
|
|
|
|
WebApplication.Redirect("GetAttachments.ashx?id=" & _InvoiceHeader.PDF_Copy.Oid.ToString)
|
|
|
|
End If
|
|
|
|
End If
|
|
|
|
|
|
ElseIf _PCIGroup.PartnerType = ePartnerType.ePayabels Then
|
|
Dim _RegistryHeader As RegistryHeader = _ocur.FindObject(Of RegistryHeader)(CriteriaOperator.Parse("CustomersFrom.Oid=? and Customers.Oid=? and DocumentNumber=?", _PCIGroup.CustomersFrom.Oid, _PCIGroup.Customers.Oid, _PCIGroup.DocumentNumber))
|
|
If _RegistryHeader IsNot Nothing Then
|
|
If _RegistryHeader.DocumentFile IsNot Nothing Then
|
|
Dim _FileStream As New MemoryStream
|
|
_RegistryHeader.DocumentFile.SaveToStream(_FileStream)
|
|
|
|
WebApplication.Redirect("GetAttachments.ashx?id=" & _RegistryHeader.DocumentFile.Oid.ToString)
|
|
|
|
End If
|
|
End If
|
|
End If
|
|
End If
|
|
End Sub
|
|
End Class
|