Reconfigure for GIT

This commit is contained in:
2017-03-26 20:00:03 +02:00
commit 00637826ab
8056 changed files with 535977 additions and 0 deletions
@@ -0,0 +1,32 @@
Partial Class OfferInHeaderVC
<System.Diagnostics.DebuggerNonUserCode()> _
Public Sub New(ByVal Container As System.ComponentModel.IContainer)
MyClass.New()
'Required for Windows.Forms Class Composition Designer support
Container.Add(Me)
End Sub
'Component overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Component Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Component Designer
'It can be modified using the Component Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
components = New System.ComponentModel.Container()
End Sub
End Class
@@ -0,0 +1,101 @@
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.SystemModule
Imports System.IO
Imports FarPoint.Win.Spread
Imports DevExpress.Persistent.BaseImpl
Imports DevExpress.ExpressApp.Reports
Imports DevExpress.Data.Filtering
Imports DevExpress.ExpressApp.Editors
Public Class OfferInHeaderVC
Inherits DevExpress.ExpressApp.ViewController
Private _FpSpread As FpSpread
Public Sub New()
MyBase.New()
'This call is required by the Component Designer.
InitializeComponent()
RegisterActions(components)
End Sub
Protected Overrides Sub OnActivated()
MyBase.OnActivated()
If View.Id = "OfferInHeader_DetailView" Then
AddHandler Frame.GetController(Of ModificationsController)().SaveAction.Executing, AddressOf SaveAction_Executing
AddHandler Frame.GetController(Of ModificationsController)().SaveAndCloseAction.Executing, AddressOf SaveAction_Executing
AddHandler Frame.GetController(Of ModificationsController)().SaveAndNewAction.Executing, AddressOf SaveAction_Executing
End If
End Sub
Protected Overrides Sub OnDeactivated()
MyBase.OnDeactivated()
If View.Id = "OffersInHeader_DetailView" Then
RemoveHandler Frame.GetController(Of ModificationsController)().SaveAction.Executing, AddressOf SaveAction_Executing
RemoveHandler Frame.GetController(Of ModificationsController)().SaveAndCloseAction.Executing, AddressOf SaveAction_Executing
RemoveHandler Frame.GetController(Of ModificationsController)().SaveAndNewAction.Executing, AddressOf SaveAction_Executing
End If
End Sub
Private Sub ExcelControlViewItem_ControlCreated(ByVal sender As Object, ByVal e As EventArgs)
Dim itemControl As Object = (CType(sender, ViewItem)).Control
_FpSpread = TryCast(itemControl, ExcelUserControl).FpSpreadControl
Dim _FileName As String = Path.GetTempPath & "Out.xls"
Dim _StreamFile As New FileStream(_FileName, FileMode.Create)
Dim _OfferInHeader As OfferInHeader = TryCast(View.SelectedObjects(0), OfferInHeader)
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
If _ocur.Session.IsNewObject(_OfferInHeader) = False Then
If _OfferInHeader IsNot Nothing Then
If _OfferInHeader.ExcelFile IsNot Nothing Then
_OfferInHeader.ExcelFile.SaveToStream(_StreamFile)
_StreamFile.Close()
_FpSpread.OpenExcel(_FileName)
End If
End If
End If
End Sub
Protected Overrides Sub OnViewControlsCreated()
MyBase.OnViewControlsCreated()
If View.Id = "OfferInHeader_DetailView" Then
Dim _DetailView As DetailView = TryCast(View, DetailView)
Dim _ExcelControlViewItem As ViewItem
If _DetailView IsNot Nothing Then
If _DetailView.GetItems(Of ExcelPropertyEditor).Count > 0 Then
_ExcelControlViewItem = _DetailView.GetItems(Of ExcelPropertyEditor)(0)
If _ExcelControlViewItem IsNot Nothing Then
AddHandler _ExcelControlViewItem.ControlCreated, AddressOf ExcelControlViewItem_ControlCreated
End If
End If
End If
End If
End Sub
Sub SaveAction_Executing(sender As Object, e As System.ComponentModel.CancelEventArgs)
Dim _FileName As String = Path.GetTempPath & "In.xls"
Dim _StreamFile As New FileStream(_FileName, FileMode.Create)
Dim _OfferInHeader As OfferInHeader = TryCast(View.SelectedObjects(0), OfferInHeader)
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
If _OfferInHeader IsNot Nothing Then
If _FpSpread IsNot Nothing Then
_FpSpread.SaveExcel(_StreamFile)
_StreamFile.Close()
Dim _StreamFile2 As New FileStream(_FileName, FileMode.Open)
_OfferInHeader.ExcelFile = New FileData(_ocur.Session)
_OfferInHeader.ExcelFile.LoadFromStream("Excel worksheet", _StreamFile2)
_OfferInHeader.Save()
_StreamFile2.Close()
End If
End If
End Sub
End Class
@@ -0,0 +1,32 @@
Partial Class OfferInRowsVC
<System.Diagnostics.DebuggerNonUserCode()> _
Public Sub New(ByVal Container As System.ComponentModel.IContainer)
MyClass.New()
'Required for Windows.Forms Class Composition Designer support
Container.Add(Me)
End Sub
'Component overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Component Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Component Designer
'It can be modified using the Component Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
components = New System.ComponentModel.Container()
End Sub
End Class
@@ -0,0 +1,60 @@
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.Win.Editors
Public Class OfferInRowsVC
Inherits DevExpress.ExpressApp.ViewController(Of ListView)
Private _GridListEditor As GridListEditor
Public Sub New()
MyBase.New()
'This call is required by the Component Designer.
InitializeComponent()
RegisterActions(components)
End Sub
Protected Overrides Sub OnViewControlsCreated()
MyBase.OnViewControlsCreated()
'If View.Id = "OfferInHeader_OfferInRows_ListView" Then
' Dim _ListView As ListView = CType(View, ListView)
' Dim _PropertyCollectionSource As PropertyCollectionSource = CType(_ListView.CollectionSource, PropertyCollectionSource)
' Dim _OfferInHeader As OfferInHeader = CType(_PropertyCollectionSource.MasterObject, OfferInHeader)
' If _OfferInHeader.IsEditable = True Then
' _GridListEditor = TryCast(View.Editor, GridListEditor)
' If _GridListEditor IsNot Nothing Then
' _GridListEditor.AllowEdit = True
' For i As Integer = 0 To _GridListEditor.Columns.Count - 1
' If _OfferInHeader.CurrencyName.ShortName = "HUF" Then
' If _GridListEditor.GridView.Columns(i).FieldName <> "QTT" And _
' _GridListEditor.GridView.Columns(i).FieldName <> "FinalPriceHUF" Then
' _GridListEditor.GridView.Columns(i).OptionsColumn.ReadOnly = True
' _GridListEditor.GridView.Columns(i).OptionsColumn.AllowEdit = False
' _GridListEditor.GridView.Columns(i).OptionsColumn.TabStop = False
' End If
' Else
' If _GridListEditor.GridView.Columns(i).FieldName <> "QTT" And _
' _GridListEditor.GridView.Columns(i).FieldName <> "FinalPriceDEV" Then
' _GridListEditor.GridView.Columns(i).OptionsColumn.ReadOnly = True
' _GridListEditor.GridView.Columns(i).OptionsColumn.AllowEdit = False
' _GridListEditor.GridView.Columns(i).OptionsColumn.TabStop = False
' End If
' End If
' Next i
' End If
' End If
'End If
End Sub
End Class
@@ -0,0 +1,32 @@
Partial Class OfferOutHeaderVC
<System.Diagnostics.DebuggerNonUserCode()> _
Public Sub New(ByVal Container As System.ComponentModel.IContainer)
MyClass.New()
'Required for Windows.Forms Class Composition Designer support
Container.Add(Me)
End Sub
'Component overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Component Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Component Designer
'It can be modified using the Component Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
End Sub
End Class
@@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
</root>
@@ -0,0 +1,99 @@
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.SystemModule
Imports System.IO
Imports FarPoint.Win.Spread
Imports DevExpress.Persistent.BaseImpl
Imports DevExpress.ExpressApp.Reports
Imports DevExpress.Data.Filtering
Imports DevExpress.ExpressApp.Editors
Public Class OfferOutHeaderVC
Inherits DevExpress.ExpressApp.ViewController
Private _FpSpread As FpSpread
Public Sub New()
MyBase.New()
'This call is required by the Component Designer.
InitializeComponent()
RegisterActions(components)
End Sub
Protected Overrides Sub OnActivated()
MyBase.OnActivated()
If View.Id = "OfferOutHeader_DetailView" Then
AddHandler Frame.GetController(Of ModificationsController)().SaveAction.Executing, AddressOf SaveAction_Executing
AddHandler Frame.GetController(Of ModificationsController)().SaveAndCloseAction.Executing, AddressOf SaveAction_Executing
AddHandler Frame.GetController(Of ModificationsController)().SaveAndNewAction.Executing, AddressOf SaveAction_Executing
End If
End Sub
Protected Overrides Sub OnDeactivated()
MyBase.OnDeactivated()
If View.Id = "OffersOutHeader_DetailView" Then
RemoveHandler Frame.GetController(Of ModificationsController)().SaveAction.Executing, AddressOf SaveAction_Executing
RemoveHandler Frame.GetController(Of ModificationsController)().SaveAndCloseAction.Executing, AddressOf SaveAction_Executing
RemoveHandler Frame.GetController(Of ModificationsController)().SaveAndNewAction.Executing, AddressOf SaveAction_Executing
End If
End Sub
Private Sub ExcelControlViewItem_ControlCreated(ByVal sender As Object, ByVal e As EventArgs)
Dim itemControl As Object = (CType(sender, ViewItem)).Control
_FpSpread = TryCast(itemControl, ExcelUserControl).FpSpreadControl
Dim _FileName As String = Path.GetTempPath & "Out.xls"
Dim _StreamFile As New FileStream(_FileName, FileMode.Create)
Dim _OfferOutHeader As OfferOutHeader = TryCast(View.SelectedObjects(0), OfferOutHeader)
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
If _ocur.Session.IsNewObject(_OfferOutHeader) = False Then
If _OfferOutHeader IsNot Nothing Then
If _OfferOutHeader.ExcelFile IsNot Nothing Then
_OfferOutHeader.ExcelFile.SaveToStream(_StreamFile)
_StreamFile.Close()
_FpSpread.OpenExcel(_FileName)
End If
End If
End If
End Sub
Protected Overrides Sub OnViewControlsCreated()
MyBase.OnViewControlsCreated()
If View.Id = "OfferOutHeader_DetailView" Then
Dim _DetailView As DetailView = TryCast(View, DetailView)
Dim _ExcelControlViewItem As ViewItem
If _DetailView IsNot Nothing Then
If _DetailView.GetItems(Of ExcelPropertyEditor).Count > 0 Then
_ExcelControlViewItem = _DetailView.GetItems(Of ExcelPropertyEditor)(0)
If _ExcelControlViewItem IsNot Nothing Then
AddHandler _ExcelControlViewItem.ControlCreated, AddressOf ExcelControlViewItem_ControlCreated
End If
End If
End If
End If
End Sub
Sub SaveAction_Executing(sender As Object, e As System.ComponentModel.CancelEventArgs)
Dim _FileName As String = Path.GetTempPath & "In.xls"
Dim _StreamFile As New FileStream(_FileName, FileMode.Create)
Dim _OfferOutHeader As OfferOutHeader = TryCast(View.SelectedObjects(0), OfferOutHeader)
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
If _OfferOutHeader IsNot Nothing Then
If _FpSpread IsNot Nothing Then
_FpSpread.SaveExcel(_StreamFile)
_StreamFile.Close()
Dim _StreamFile2 As New FileStream(_FileName, FileMode.Open)
_OfferOutHeader.ExcelFile = New FileData(_ocur.Session)
_OfferOutHeader.ExcelFile.LoadFromStream("Excel worksheet", _StreamFile2)
_OfferOutHeader.Save()
_StreamFile2.Close()
End If
End If
End Sub
End Class
@@ -0,0 +1,32 @@
Partial Class OfferOutRowsVC
<System.Diagnostics.DebuggerNonUserCode()> _
Public Sub New(ByVal Container As System.ComponentModel.IContainer)
MyClass.New()
'Required for Windows.Forms Class Composition Designer support
Container.Add(Me)
End Sub
'Component overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Component Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Component Designer
'It can be modified using the Component Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
components = New System.ComponentModel.Container()
End Sub
End Class
@@ -0,0 +1,71 @@
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.Win.Editors
Public Class OfferOutRowsVC
Inherits DevExpress.ExpressApp.ViewController(Of ListView)
Private _GridListEditor As GridListEditor
Public Sub New()
MyBase.New()
'This call is required by the Component Designer.
InitializeComponent()
RegisterActions(components)
End Sub
Protected Overrides Sub OnViewControlsCreated()
MyBase.OnViewControlsCreated()
'If View.Id = "OfferOutHeader_OfferOutRows_ListView" Then
' Dim _ListView As ListView = CType(View, ListView)
' Dim _PropertyCollectionSource As PropertyCollectionSource = CType(_ListView.CollectionSource, PropertyCollectionSource)
' Dim _OfferOutHeader As OfferOutHeader = CType(_PropertyCollectionSource.MasterObject, OfferOutHeader)
' If _OfferOutHeader.IsEditable = True Then
' _GridListEditor = TryCast(View.Editor, GridListEditor)
' If _GridListEditor IsNot Nothing Then
' _GridListEditor.AllowEdit = True
' For i As Integer = 0 To _GridListEditor.Columns.Count - 1
' If _OfferOutHeader.CurrencyName.ShortName = "HUF" Then
' If _GridListEditor.GridView.Columns(i).FieldName <> "QTT" And _
' _GridListEditor.GridView.Columns(i).FieldName <> "Description" And _
' _GridListEditor.GridView.Columns(i).FieldName <> "RowGroup1" And _
' _GridListEditor.GridView.Columns(i).FieldName <> "RowGroup2" And _
' _GridListEditor.GridView.Columns(i).FieldName <> "DescriptionPrivate" And _
' _GridListEditor.GridView.Columns(i).FieldName <> "FinalPriceHUF" Then
' _GridListEditor.GridView.Columns(i).OptionsColumn.ReadOnly = True
' _GridListEditor.GridView.Columns(i).OptionsColumn.AllowEdit = False
' _GridListEditor.GridView.Columns(i).OptionsColumn.TabStop = False
' '_GridListEditor.GridView.Columns(i).FieldName <> " DiscountPercent" And _
' End If
' Else
' If _GridListEditor.GridView.Columns(i).FieldName <> "QTT" And _
' _GridListEditor.GridView.Columns(i).FieldName <> "Description" And _
' _GridListEditor.GridView.Columns(i).FieldName <> "RowGroup1" And _
' _GridListEditor.GridView.Columns(i).FieldName <> "RowGroup2" And _
' _GridListEditor.GridView.Columns(i).FieldName <> "DescriptionPrivate" And _
' _GridListEditor.GridView.Columns(i).FieldName <> "FinalPriceDEV" Then
' _GridListEditor.GridView.Columns(i).OptionsColumn.ReadOnly = True
' _GridListEditor.GridView.Columns(i).OptionsColumn.AllowEdit = False
' _GridListEditor.GridView.Columns(i).OptionsColumn.TabStop = False
' End If
' End If
' Next i
' End If
' End If
'End If
End Sub
End Class
@@ -0,0 +1,74 @@
Partial Class OfferOutVC
<System.Diagnostics.DebuggerNonUserCode()> _
Public Sub New(ByVal Container As System.ComponentModel.IContainer)
MyClass.New()
'Required for Windows.Forms Class Composition Designer support
Container.Add(Me)
End Sub
'Component overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Component Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Component Designer
'It can be modified using the Component Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container()
Me.aInsertGridToRTFCurrentPos_OfferOut = New DevExpress.ExpressApp.Actions.SimpleAction(Me.components)
Me.aRestoreDocumentTemplate_OfferOut = New DevExpress.ExpressApp.Actions.SimpleAction(Me.components)
Me.aReplaceValueDocumentTemplate_OfferOut = New DevExpress.ExpressApp.Actions.SimpleAction(Me.components)
'
'aGeneratePDFandSendDefaultMailClient
'
'
'aInsertGridToRTFCurrentPos_OfferOut
'
Me.aInsertGridToRTFCurrentPos_OfferOut.Caption = "Insert grid Current position"
Me.aInsertGridToRTFCurrentPos_OfferOut.Category = ""
Me.aInsertGridToRTFCurrentPos_OfferOut.ConfirmationMessage = Nothing
Me.aInsertGridToRTFCurrentPos_OfferOut.Id = "aInsertGridToRTFCurrentPos_OfferOut"
Me.aInsertGridToRTFCurrentPos_OfferOut.ImageName = "paste"
Me.aInsertGridToRTFCurrentPos_OfferOut.TargetViewId = "OfferOutHeader_DetailView"
Me.aInsertGridToRTFCurrentPos_OfferOut.ToolTip = Nothing
'
'aRestoreDocumentTemplate_OfferOut
'
Me.aRestoreDocumentTemplate_OfferOut.Caption = "aRestoreDocumentTemplate_OfferOut"
Me.aRestoreDocumentTemplate_OfferOut.Category = "aRestoreDocumentTemplate_OfferOut"
Me.aRestoreDocumentTemplate_OfferOut.ConfirmationMessage = Nothing
Me.aRestoreDocumentTemplate_OfferOut.Id = "aRestoreDocumentTemplate_OfferOut"
Me.aRestoreDocumentTemplate_OfferOut.TargetObjectType = GetType(SISBusiness.[Module].OfferOutHeader)
Me.aRestoreDocumentTemplate_OfferOut.TargetViewType = DevExpress.ExpressApp.ViewType.DetailView
Me.aRestoreDocumentTemplate_OfferOut.ToolTip = Nothing
Me.aRestoreDocumentTemplate_OfferOut.TypeOfView = GetType(DevExpress.ExpressApp.DetailView)
'
'aReplaceValueDocumentTemplate_OfferOut
'
Me.aReplaceValueDocumentTemplate_OfferOut.Caption = "aReplaceValueDocumentTemplate_OfferOut"
Me.aReplaceValueDocumentTemplate_OfferOut.Category = "aReplaceValueDocumentTemplate_OfferOut"
Me.aReplaceValueDocumentTemplate_OfferOut.ConfirmationMessage = Nothing
Me.aReplaceValueDocumentTemplate_OfferOut.Id = "aReplaceValueDocumentTemplate_OfferOut"
Me.aReplaceValueDocumentTemplate_OfferOut.TargetObjectType = GetType(SISBusiness.[Module].OfferOutHeader)
Me.aReplaceValueDocumentTemplate_OfferOut.TargetViewType = DevExpress.ExpressApp.ViewType.DetailView
Me.aReplaceValueDocumentTemplate_OfferOut.ToolTip = Nothing
Me.aReplaceValueDocumentTemplate_OfferOut.TypeOfView = GetType(DevExpress.ExpressApp.DetailView)
End Sub
Friend WithEvents aInsertGridToRTFCurrentPos_OfferOut As DevExpress.ExpressApp.Actions.SimpleAction
Friend WithEvents aRestoreDocumentTemplate_OfferOut As DevExpress.ExpressApp.Actions.SimpleAction
Friend WithEvents aReplaceValueDocumentTemplate_OfferOut As DevExpress.ExpressApp.Actions.SimpleAction
End Class
@@ -0,0 +1,135 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="aGeneratePDFandSendDefaultMailClient.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>277, 56</value>
</metadata>
<metadata name="aInsertGridToRTFCurrentPos_OfferOut.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>548, 56</value>
</metadata>
<metadata name="aRestoreDocumentTemplate_OfferOut.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 56</value>
</metadata>
<metadata name="aReplaceValueDocumentTemplate_OfferOut.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>536, 17</value>
</metadata>
<metadata name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
</root>
@@ -0,0 +1,474 @@
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.Win.Editors
Imports DevExpress.ExpressApp.Editors
Imports DevExpress.XtraGrid.Views.Grid
Imports DevExpress.XtraBars
Imports DevExpress.Persistent.BaseImpl
Imports DevExpress.ExpressApp.Reports
Imports System.IO
Imports DevExpress.XtraPrinting
Imports DevExpress.XtraReports.UI
Imports Microsoft.Office.Interop
Imports System.Runtime.InteropServices
Public Class OfferOutVC
Inherits SISBusiness.Module.OffersOutVC
Dim _RichEditControl As RichEditControl
Dim _GridListEditor As GridListEditor
Dim _Grid As GridView
Dim _OfferOutHeader As OfferOutHeader
Public Sub New()
MyBase.New()
InitializeComponent()
RegisterActions(components)
End Sub
Protected Overrides Sub OnActivated()
MyBase.OnActivated()
Frame.GetController(Of OfferOutVC).aReplaceValueDocumentTemplate_OfferOut.Active.SetItemValue("", False)
If View.Id = "OfferOutHeader_OfferOutRows_ListView" Then
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.ListViewProcessCurrentObjectController)().Active.SetItemValue("", False)
Frame.GetController(Of DevExpress.ExpressApp.Win.SystemModule.OpenObjectController)().Active.SetItemValue("", False)
End If
If View.Id Like "OrderInHeaderFromOfferOutRowsHeader_OrderInHeaderFromOfferOutRowsRows_ListView" Then
Frame.GetController(Of DevExpress.ExpressApp.Win.SystemModule.OpenObjectController)().Active.SetItemValue("", False)
End If
If View.Id = "OfferOutHeader_DetailView" Then
_OfferOutHeader = TryCast(View.SelectedObjects(0), OfferOutHeader)
End If
If View.Id = "OffersOutParameters_DetailView" Then
End If
End Sub
Protected Overrides Sub OnDeactivated()
MyBase.OnDeactivated()
If View.Id = "OfferOutHeader_OfferOutRows_ListView" Then
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.ListViewProcessCurrentObjectController)().Active.SetItemValue("", True)
Frame.GetController(Of DevExpress.ExpressApp.Win.SystemModule.OpenObjectController)().Active.SetItemValue("", True)
End If
If View.Id Like "OrderInHeaderFromOfferOutRowsHeader_OrderInHeaderFromOfferOutRowsRows_ListView" Then
Frame.GetController(Of DevExpress.ExpressApp.Win.SystemModule.OpenObjectController)().Active.SetItemValue("", True)
End If
End Sub
Protected Overrides Sub OnViewControlsCreated()
MyBase.OnViewControlsCreated()
If View.Id = "OfferOutHeader_DetailView" Then
Dim _DetailView As DetailView = TryCast(View, DetailView)
Dim _RichEditContolViewItem As ViewItem = _DetailView.FindItem("DocumentBody")
If _RichEditContolViewItem IsNot Nothing Then
AddHandler _RichEditContolViewItem.ControlCreated, AddressOf RichEditContolViewItem_ControlCreated
End If
End If
If View.Id = "OfferOutParameters_DetailView" Then
Dim _DetailView As DetailView = TryCast(View, DetailView)
Dim _RichEditContolViewItem As ViewItem = _DetailView.FindItem("DocumentBody")
If _RichEditContolViewItem IsNot Nothing Then
AddHandler _RichEditContolViewItem.ControlCreated, AddressOf RichEditContolViewItem_ControlCreated
End If
End If
If View.Id Like "OrderInHeaderFromOfferOutRowsHeader_OrderInHeaderFromOfferOutRowsRows_ListView" Then
Dim _ListView As DevExpress.ExpressApp.ListView = CType(View, DevExpress.ExpressApp.ListView)
_GridListEditor = TryCast(_ListView.Editor, GridListEditor)
_Grid = TryCast(_GridListEditor.GridView, GridView)
AddHandler _Grid.GridControl.HandleCreated, AddressOf Grid_HandleCreated
End If
End Sub
Private Sub CreatePDFAndSendToDefaultMailClient()
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
Dim _OfferOutHeader As OfferOutHeader = TryCast(View.SelectedObjects(0), OfferOutHeader)
Dim _ReportData As ReportData = Nothing
Dim _OutlookApp As New Microsoft.Office.Interop.Outlook.Application()
Dim _OutlookNameSpace As Microsoft.Office.Interop.Outlook.NameSpace
Dim _mail As Outlook.MailItem = Nothing
Dim _mailRecipients As Outlook.Recipients = Nothing
Dim _mailRecipient As Outlook.Recipient = Nothing
Dim _mailAttachments As Outlook.Attachments = Nothing
Dim _mailAttachment As Outlook.Attachment = Nothing
_OutlookNameSpace = _OutlookApp.GetNamespace("MAPI")
_OutlookNameSpace.Logon(, , False, True)
If _OfferOutHeader IsNot Nothing Then
If Frame.GetController(Of OffersOutPrintVC).aOfferOutPrintChoice.SelectedItem IsNot Nothing Then
If _OfferOutHeader.IsEditable = True Then
_OfferOutHeader.RecalculateOfferOut(_OfferOutHeader, _ocur)
_ocur.CommitChanges()
End If
If Frame.GetController(Of OffersOutPrintVC).aOfferOutPrintChoice.SelectedItem.Data = "0" Then
_ReportData = _OfferOutHeader.OfferOutParameters.ReportData
End If
If Frame.GetController(Of OffersOutPrintVC).aOfferOutPrintChoice.SelectedItem.Data = "1" Then
_ReportData = _OfferOutHeader.OfferOutParameters.ReportData1
End If
Else
Throw New Exception("*Nincs nyomtatvány típus kiválasztva!")
End If
If _ReportData IsNot Nothing Then
Dim _XafReport As XafReport = _ReportData.LoadReport(_ocur)
Dim _FilterString As String = "[OfferOutHeader.Oid]='" & _OfferOutHeader.Oid.ToString & "'"
_XafReport.FilterString = _FilterString
Dim _FileName As String = Path.GetTempPath & CorrectFileName(_OfferOutHeader.DocumentNumber) & ".pdf"
Dim _StreamFile As New FileStream(_FileName, FileMode.Create)
_XafReport.ExportToPdf(_StreamFile)
_StreamFile.Close()
Try
_mail = _OutlookApp.CreateItem(Outlook.OlItemType.olMailItem)
_mail.Subject = "ÁRAJÁNLAT"
_mailAttachments = _mail.Attachments
_mailAttachment = _mailAttachments.Add(_FileName)
_mailRecipients = _mail.Recipients
_mailRecipient = _mailRecipients.Add(_OfferOutHeader.Contact.Email)
_mailRecipient.Resolve()
If (_mailRecipient.Resolved) Then
'_mail.Send()
_mail.Display(True)
Else
System.Windows.Forms.MessageBox.Show(
"There is no such record in your address book.")
End If
Catch ex As Exception
System.Windows.Forms.MessageBox.Show(ex.Message,
"An exception is occured in the code of add-in.")
Finally
If Not IsNothing(_mailRecipient) Then Marshal.ReleaseComObject(_mailRecipient)
If Not IsNothing(_mailRecipients) Then Marshal.ReleaseComObject(_mailRecipients)
If Not IsNothing(_mail) Then Marshal.ReleaseComObject(_mail)
End Try
End If
End If
End Sub
Private Sub RichEditContolViewItem_ControlCreated(sender As Object, e As EventArgs)
Dim _ItemControl As Object = TryCast(sender, ViewItem).Control
Dim _RichEditUserControl As RichEditUserControl = TryCast(_ItemControl, RichEditUserControl)
Dim _BarItem As BarItemLink
_RichEditControl = TryCast(_ItemControl, RichEditUserControl).RichEditControl
_RichEditControl.BeginUpdate()
Dim _OfferOutHeader_IList As IList(Of OfferOutRTF) = New List(Of OfferOutRTF)
Dim _OfferOutRTF As New OfferOutRTF
If _OfferOutHeader IsNot Nothing Then
_OfferOutRTF.Sajátcég_Adószám = _OfferOutHeader.CustomersFrom.VATNumber
_OfferOutRTF.Sajátcég_Adószám_EU = _OfferOutHeader.CustomersFrom.VATNumberEU
If _OfferOutHeader.CustomersFrom.Address1 IsNot Nothing Then
_OfferOutRTF.Sajátcég_Irányítószám = _OfferOutHeader.CustomersFrom.Address1.ZipPostal
_OfferOutRTF.Sajátcég_Ország = _OfferOutHeader.CustomersFrom.Address1.Country.Name
_OfferOutRTF.Sajátcég_Utca = _OfferOutHeader.CustomersFrom.Address1.Street
_OfferOutRTF.Sajátcég_Város = _OfferOutHeader.CustomersFrom.Address1.City
Else
_OfferOutRTF.Sajátcég_Irányítószám = "Nincs beállítva"
_OfferOutRTF.Sajátcég_Ország = "Nincs beállítva"
_OfferOutRTF.Sajátcég_Utca = "Nincs beállítva"
_OfferOutRTF.Sajátcég_Város = "Nincs beállítva"
End If
_OfferOutRTF.Sajátcég_Teljesnév = _OfferOutHeader.CustomersFrom.FullName
_OfferOutRTF.Partner_Adószám = _OfferOutHeader.Customers.VATNumber
_OfferOutRTF.Partner_Adószám_EU = _OfferOutHeader.Customers.VATNumberEU
If _OfferOutHeader.Customers.Address1 IsNot Nothing Then
_OfferOutRTF.Partner_Irányítószám = _OfferOutHeader.Customers.Address1.ZipPostal
_OfferOutRTF.Partner_Ország = _OfferOutHeader.Customers.Address1.Country.Name
_OfferOutRTF.Partner_Utca = _OfferOutHeader.Customers.Address1.Street
_OfferOutRTF.Partner_Város = _OfferOutHeader.Customers.Address1.City
Else
_OfferOutRTF.Partner_Irányítószám = "Nincs beállítva"
_OfferOutRTF.Partner_Ország = "Nincs beállítva"
_OfferOutRTF.Partner_Utca = "Nincs beállítva"
_OfferOutRTF.Partner_Város = "Nincs beállítva"
End If
_OfferOutRTF.Partner_Teljesnév = _OfferOutHeader.Customers.FullName
If _OfferOutHeader.Contact IsNot Nothing Then
_OfferOutRTF.Kapcsolat_Teljesnév = _OfferOutHeader.Contact.FullName
If _OfferOutHeader.Contact.PhoneNumbers.Count > 0 Then
_OfferOutRTF.Kapcsolat_Mobil = _OfferOutHeader.Contact.PhoneNumbers(0).Number
End If
_OfferOutRTF.Kapcsolat_Email = _OfferOutHeader.Contact.Email
End If
_OfferOutRTF.Ajánlat_Dokumentum_Sorszám = _OfferOutHeader.DocumentNumber
End If
_OfferOutHeader_IList.Add(_OfferOutRTF)
_RichEditControl.Options.MailMerge.DataSource = _OfferOutHeader_IList
_RichEditControl.Update()
_RichEditControl.UpdateCommandUI()
_RichEditControl.EndUpdate()
_RichEditControl.BeginUpdate()
For Each _BarItem In _RichEditUserControl.MailingInsertItemLink.ItemLinks
Select Case _BarItem.Item.Caption
Case ""
End Select
_BarItem.Item.Caption = "Lófasz !"
Next
_RichEditControl.EndUpdate()
'AddHandler _RichEditUserControl.RichEditControl.Options.MailMerge.
End Sub
Private Sub Grid_HandleCreated(sender As Object, e As System.EventArgs)
RemoveHandler _Grid.GridControl.HandleCreated, AddressOf Grid_HandleCreated
_GridListEditor.Grid.BeginInvoke(New Windows.Forms.MethodInvoker(AddressOf SelectAll))
End Sub
Private Sub SelectAll()
_Grid.SelectAll()
End Sub
Private Sub aInsertGridToRTFCurrentPos_OfferOut_Execute(sender As System.Object, e As DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs) Handles aInsertGridToRTFCurrentPos_OfferOut.Execute
Dim _DetailView As DetailView = CType(View, DetailView)
Dim _OfferOutHeader As OfferOutHeader = TryCast(e.SelectedObjects(0), OfferOutHeader)
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
If _OfferOutHeader.DocumentBody Is Nothing Then
_OfferOutHeader.DocumentBody = "{\rtf1\deff0{\fonttbl{\f0 Times New Roman;}}" & _
"{\colortbl\red0\green0\blue0 ;\red0\green0\blue255 ;}{\*\listoverridetable}{\stylesheet {\ql\cf0 Normal;}" & _
"{\*\cs1\cf0 Default Paragraph Font;}{\*\cs2\sbasedon1\cf0 Line Number;}{\*\cs3\ul\cf1 Hyperlink;}}\sectd\pard\plain" & _
"\ql\f1\par\pard\plain\ql\f1\par\pard\plain\ql\f1\par\pard\plain\ql" & _
"\f2\fs18\cf0\par\pard\plain\ql\f1\par}"
End If
_RichEditControl.BeginUpdate()
_RichEditControl.Document.InsertText(_RichEditControl.Document.CaretPosition, "orderrows")
_RichEditControl.EndUpdate()
'Dim _RTFMergeFieldCleaner As New RTFMergeFieldCleaner
'_OfferOutHeader.DocumentBody = _RTFMergeFieldCleaner.CleanDocument(_RichEditControl.Document.RtfText)
Dim _a As String = _RichEditControl.Document.RtfText
_OfferOutHeader.DocumentBody = _a
'=========================== ColorTable =======================================
Dim _actColorNum As Int32 = 0
Dim _OrigColorTable As String
Dim _ColorTable As String = (_OfferOutHeader.DocumentBody.Remove(0, (InStr(_OfferOutHeader.DocumentBody, "{\colortbl")) + "{\colortbl".Length - 1))
_ColorTable = _ColorTable.Remove(InStr(_ColorTable, "}") - 1) '--Act Color table
Dim _ColorArray As String() = _ColorTable.Split(New [Char]() {";"c})
Dim _CTable As New StringBuilder()
_CTable.Append("{\colortbl")
For _ik As Int32 = 0 To _ColorArray.Length - 2
_CTable.Append(_ColorArray(_ik) & ";")
Next
_CTable.Append("\red240\green240\blue240 ;}")
_OrigColorTable = "{\colortbl" & _ColorTable & "}"
_OfferOutHeader.DocumentBody = _OfferOutHeader.DocumentBody.Replace(_OrigColorTable, _CTable.ToString())
'=================================================================================
Dim _ListPropertyEditor As ListPropertyEditor = TryCast(View, DetailView).FindItem("OfferOutRows")
Dim _ListView As DevExpress.ExpressApp.ListView = CType(_ListPropertyEditor.ListView, DevExpress.ExpressApp.ListView)
If _ListView IsNot Nothing Then
Dim _GridListEditor As GridListEditor = TryCast(_ListView.Editor, GridListEditor)
Dim _Grid As GridView = TryCast(_GridListEditor.GridView, GridView)
If _Grid IsNot Nothing Then
_OfferOutHeader.DocumentBody = RTFTableCreator(_Grid, "orderrows", _OfferOutHeader.DocumentBody, _RGB:="241,241,241")
End If
End If
'=================================================================================
End Sub
Function RTFTableCreator(_Grid As GridView, _Tag As String, _DocumentBody As String, Optional _FontSize As String = "6", _
Optional _FontType As String = "Tahoma", Optional _RGB As String = "240,240,240") As String
Dim _DocumentBody_NEW As String
Dim _HeaderFillColor As Int32 ' -- Current table header fill color index in colot table
If _RGB <> "240,240,240" Then
Dim _Parameters As String() = ColorTablereplacement(_DocumentBody, _RGB)
_HeaderFillColor = Convert.ToInt32(_Parameters(0))
_DocumentBody = _Parameters(1)
Else
_HeaderFillColor = 2
End If
If _Grid.DataRowCount > 0 Then
Dim _FontSizeNUM As Int32 = (Convert.ToInt32(_FontSize) * 2) ' -- Font size in half-points (the default is 16). => Size 8!!!
Dim _RTFtext As New StringBuilder
Dim _RowNumFull As Integer = _Grid.RowCount
Dim _RowNum As Integer = _Grid.DataRowCount
Dim _ColumnsNum As Integer = _Grid.Columns.Count
Dim irowIndex As Int32 = 0
Dim _LastCellIndex As Int32 = 0
'--Header to RTF format--
'=================================================================================
_RTFtext.Append("\pard\plain\ql\par\trowd\irow" & irowIndex & "\irowband" & irowIndex & "\trbrdrt\brdrs\brdrw10\trbrdrl\brdrs\brdrw10" & _
"\trbrdrb\brdrs\brdrw10\trbrdrr\brdrs\brdrw10\trleft-108\trautofit1\trpaddfl3\trpaddl108\trpaddfr3\trpaddr108")
For _ik As Integer = 0 To _Grid.Columns.View.VisibleColumns.Count - 1
_RTFtext.Append("\clvertalt\clcbpat2\clbrdrt\brdrs\brdrw10\clbrdrl\brdrs\brdrw10\clbrdrb\brdrs\brdrw10\clbrdrr\brdrs\brdrw10" &
"\cltxlrtb\clftsWidth3\clwWidth3302\clpadfr3\clpadr108\clpadft3\clpadt108\cellx" & _ik)
If _LastCellIndex < _ik Then
_LastCellIndex = _ik
End If
Next
For _ik As Integer = 0 To _Grid.Columns.View.VisibleColumns.Count - 1
_RTFtext.Append("\pard\plain\ql\intbl{\b\fs" & _FontSizeNUM & "\cf0 " & _Grid.Columns.View.VisibleColumns(_ik).Caption & "}\b\cell")
Next
_RTFtext.Append("\trowd\irow" & irowIndex & "\irowband" & irowIndex & "\trbrdrt\brdrs\brdrw10\trbrdrl\brdrs\brdrw10" & _
"\trbrdrb\brdrs\brdrw10\trbrdrr\brdrs\brdrw10\trleft-108\trautofit1\trpaddfl3\trpaddl108\trpaddfr3\trpaddr108")
For _ik As Integer = 0 To _Grid.Columns.View.VisibleColumns.Count - 1
_RTFtext.Append("\clvertalt\clcbpat" & _HeaderFillColor & "\clbrdrt\brdrs\brdrw10\clbrdrl\brdrs\brdrw10\clbrdrb\brdrs\brdrw10\clbrdrr\brdrs\brdrw10" &
"\cltxlrtb\clftsWidth3\clwWidth3302\clpadfr3\clpadr108\clpadft3\clpadt108\cellx" & _ik)
Next
irowIndex += 1
'' --Data to RTF format--
'=================================================================================
For _ik As Int16 = 0 To _RowNumFull - 2
If _Grid.IsGroupRow(_Grid.Columns.View.GetVisibleRowHandle(_ik)) = True Then
_RTFtext.Append("\row")
_RTFtext.Append("\pard\plain\ql\intbl{\fs" & _FontSizeNUM & "\cf0 " & (_Grid.GetGroupRowDisplayText(_Grid.Columns.View.GetVisibleRowHandle(_ik)).ToString) & "}\cell")
_RTFtext.Append("\trowd\irow" & irowIndex & "\irowband" & irowIndex & "\trbrdrt\brdrs\brdrw10\trbrdrl\brdrs\brdrw10\trbrdrb\brdrs\brdrw10\trbrdrr\brdrs\brdrw10" & _
"\trleft-108\trftsWidth1\trautofit1\trpaddfl3\trpaddl108\trpaddfr3\trpaddr108\tblindtype3\tblind0")
_RTFtext.Append("\clvertalt\clbrdrt\brdrs\brdrw10\clbrdrl\brdrs\brdrw10\clbrdrb\brdrs\brdrw10\clbrdrr\brdrs\brdrw10\cltxlrtb\clftsWidth3\clwWidth9619" & _
"\clpadfr3\clpadr108\clpadft3\clpadt108\cellx" & _LastCellIndex)
irowIndex += 1
Else
_RTFtext.Append("\row")
For _jk As Integer = 0 To _Grid.Columns.View.VisibleColumns.Count - 1
If _Grid.Columns.View.VisibleColumns(_jk).ColumnType.FullName <> "System.Double" And _Grid.Columns.View.VisibleColumns(_jk).ColumnType.FullName <> "System.Boolean" Then
_RTFtext.Append("\pard\plain\ql\intbl{\fs" & _FontSizeNUM & "\cf0 " & (_Grid.GetRowCellDisplayText(_Grid.Columns.View.GetVisibleRowHandle(_ik), _Grid.Columns.View.VisibleColumns(_jk))) & "}\cell")
ElseIf _Grid.Columns.View.VisibleColumns(_jk).ColumnType.FullName = "System.Boolean" Then
If _Grid.GetRowCellValue(_Grid.Columns.View.GetVisibleRowHandle(_ik), _Grid.Columns.View.VisibleColumns(_jk)) = True Then
_RTFtext.Append("\pard\plain\ql\intbl{\fs" & _FontSizeNUM & "\cf0 " & "Van" & "}\cell")
Else
_RTFtext.Append("\pard\plain\ql\intbl{\fs" & _FontSizeNUM & "\cf0 " & "Nincs" & "}\cell")
End If
Else
_RTFtext.Append("\pard\plain\ql\intbl{\fs" & _FontSizeNUM & "\cf0\qr " & LTrim(RTrim(Format(_Grid.Columns.View.GetRowCellValue(_Grid.Columns.View.GetVisibleRowHandle(_ik), _Grid.Columns.View.VisibleColumns(_jk)), "#,##0.00"))) & "}\qr\cell")
End If
Next
_RTFtext.Append("\trowd\irow" & irowIndex & "\irowband" & irowIndex & "\trbrdrt\brdrs\brdrw10\trbrdrl\brdrs\brdrw10\trbrdrb\brdrs\brdrw10\trbrdrr\brdrs\brdrw10" & _
"\trleft-108\trautofit1\trpaddfl3\trpaddl108\trpaddfr3\trpaddr108")
For _jk As Integer = 0 To _Grid.Columns.View.VisibleColumns.Count - 1
_RTFtext.Append("\clvertalt\clbrdrt\brdrs\brdrw10\clbrdrl\brdrs\brdrw10\clbrdrb\brdrs\brdrw10\clbrdrr\brdrs\brdrw10\cltxlrtb\clftsWidth3\clwWidth3302" & _
"\clpadfr3\clpadr108\clpadft3\clpadt108\cellx" & _jk)
Next
irowIndex += 1
End If
Next
'--Last row --
'=================================================================================
If _Grid.IsGroupRow(_Grid.Columns.View.GetVisibleRowHandle(_RowNumFull - 1)) = True Then
_RTFtext.Append("\row")
_RTFtext.Append("\pard\plain\ql\intbl{\fs" & _FontSizeNUM & "\cf0 " & (_Grid.GetGroupRowDisplayText(_Grid.Columns.View.GetVisibleRowHandle(_RowNumFull - 1)).ToString) & "}\cell")
_RTFtext.Append("\trowd\irow" & irowIndex & "\irowband" & irowIndex & "\trbrdrt\brdrs\brdrw10\trbrdrl\brdrs\brdrw10\trbrdrb\brdrs\brdrw10\trbrdrr\brdrs\brdrw10" & _
"\trleft-108\trftsWidth1\trautofit1\trpaddfl3\trpaddl108\trpaddfr3\trpaddr108\tblindtype3\tblind0")
_RTFtext.Append("\clvertalt\clbrdrt\brdrs\brdrw10\clbrdrl\brdrs\brdrw10\clbrdrb\brdrs\brdrw10\clbrdrr\brdrs\brdrw10\cltxlrtb\clftsWidth3\clwWidth9619" & _
"\clpadfr3\clpadr108\clpadft3\clpadt108\cellx" & _LastCellIndex)
Else
_RTFtext.Append("\row")
For _jk As Integer = 0 To _Grid.Columns.View.VisibleColumns.Count - 1
If _Grid.Columns.View.VisibleColumns(_jk).ColumnType.FullName <> "System.Double" And _Grid.Columns.View.VisibleColumns(_jk).ColumnType.FullName <> "System.Boolean" Then
_RTFtext.Append("\pard\plain\ql\intbl{\fs" & _FontSizeNUM & "\cf0 " & (_Grid.Columns.View.GetRowCellDisplayText(_RowNum - 1, _Grid.Columns.View.VisibleColumns(_jk))) & "}\cell")
ElseIf _Grid.Columns.View.VisibleColumns(_jk).ColumnType.FullName = "System.Boolean" Then
If _Grid.IsGroupRow(_Grid.Columns.View.GetVisibleRowHandle(_RowNum - 1)) = True Then
_RTFtext.Append("\pard\plain\ql\intbl{\fs" & _FontSizeNUM & "\cf0 " & "Van" & "}\cell")
Else
_RTFtext.Append("\pard\plain\ql\intbl{\fs" & _FontSizeNUM & "\cf0 " & "Nincs" & "}\cell")
End If
Else
_RTFtext.Append("\pard\plain\ql\intbl{\fs" & _FontSizeNUM & "\cf0\qr " & LTrim(RTrim(Format(_Grid.Columns.View.GetRowCellValue(_Grid.Columns.View.GetVisibleRowHandle(_RowNumFull - 1), _Grid.Columns.View.VisibleColumns(_jk)), "#,##0.00"))) & "}\qr\cell")
End If
Next
_RTFtext.Append("\trowd\irow" & irowIndex & "\irowband" & irowIndex & "\lastrow\trbrdrt\brdrs\brdrw10\trbrdrl\brdrs\brdrw10\trbrdrb\brdrs\brdrw10\trbrdrr\brdrs\brdrw10" & _
"\trleft-108\trautofit1\trpaddfl3\trpaddl108\trpaddfr3\trpaddr108")
''---
For _jk As Integer = 0 To _Grid.Columns.View.VisibleColumns.Count - 1
_RTFtext.Append("\clvertalt\clbrdrt\brdrs\brdrw10\clbrdrl\brdrs\brdrw10\clbrdrb\brdrs\brdrw10\clbrdrr\brdrs\brdrw10\cltxlrtb\clftsWidth3\clwWidth3302" & _
"\clpadfr3\clpadr108\clpadft3\clpadt108\cellx" & _jk)
Next
End If
_RTFtext.Append("\row\pard\plain\ql")
_DocumentBody_NEW = _DocumentBody.Replace(_Tag, _RTFtext.ToString())
If _DocumentBody_NEW.Contains("\fonttbl{\f0 Times New Roman;") Then
_DocumentBody_NEW = _DocumentBody_NEW.Replace("\fonttbl{\f0 Times New Roman;", "\fonttbl{\f0 " & _FontType & ";") 'Font table remake
End If
Else
_DocumentBody_NEW = _DocumentBody.Replace(_Tag, " ")
End If
Return _DocumentBody_NEW
End Function
Function ColorTablereplacement(_DocumentBody As String, _RGB As String) As String()
Dim _Parameters(1) As String
Dim _RGBArray As String() = _RGB.Split(New [Char]() {","c})
Dim _actColorNum As Int32 = -1
Dim _ColorTable As String = (_DocumentBody.Remove(0, (InStr(_DocumentBody, "{\colortbl")) + "{\colortbl".Length - 1))
_ColorTable = _ColorTable.Remove(InStr(_ColorTable, "}") - 1) '--Act Color table
Dim _ColorArray As String() = _ColorTable.Split(New [Char]() {";"c})
For _ik As Int32 = 0 To _ColorArray.Length - 1
If _ColorArray(_ik) = "\red" & _RGBArray(0) & "\green" & _RGBArray(1) & "\blue" & _RGBArray(2) & " " Then
_actColorNum = _ik
End If
Next
If _actColorNum = -1 Then
Dim _CTable As New StringBuilder()
_CTable.Append("{\colortbl")
For _ik As Int32 = 0 To _ColorArray.Length - 2
_CTable.Append(_ColorArray(_ik) & ";")
Next
_CTable.Append("\red" & _RGBArray(0) & "\green" & _RGBArray(1) & "\blue" & _RGBArray(2) & " ;}")
Dim _OrigColorTable As String = "{\colortbl" & _ColorTable & "}"
_DocumentBody = _DocumentBody.Replace(_OrigColorTable, _CTable.ToString())
_Parameters(0) = _ColorArray.Length - 1
_Parameters(1) = _DocumentBody
Else
_Parameters(0) = _actColorNum
_Parameters(1) = _DocumentBody
End If
Return _Parameters
End Function
Private Sub aRestoreDocumentTemplate_OfferOut_Execute(sender As System.Object, e As DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs) Handles aRestoreDocumentTemplate_OfferOut.Execute
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
Dim _OfferOutHeader As OfferOutHeader = TryCast(View.SelectedObjects(0), OfferOutHeader)
_OfferOutHeader.DocumentBody = _OfferOutHeader.OfferOutParameters.DocumentBody
End Sub
Private Sub aGeneratePDFandSendDefaultMailClient_Execute(sender As Object, e As SimpleActionExecuteEventArgs) Handles aGeneratePDFandSendDefaultMailClient.Execute
Me.CreatePDFAndSendToDefaultMailClient()
End Sub
End Class
@@ -0,0 +1,59 @@
Partial Class OffersOutPrintVC
<System.Diagnostics.DebuggerNonUserCode()> _
Public Sub New(ByVal Container As System.ComponentModel.IContainer)
MyClass.New()
'Required for Windows.Forms Class Composition Designer support
Container.Add(Me)
End Sub
'Component overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Component Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Component Designer
'It can be modified using the Component Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container()
Me.aOfferOutSendMailDeatil = New DevExpress.ExpressApp.Actions.SimpleAction(Me.components)
'
'aOfferOutPrintChoice
'
Me.aOfferOutPrintChoice.Caption = "Print documentWIN"
'
'aOffersOutPrintPDF
'
'
'aOffersOutPrintPDF2
'
'
'aOfferOutSendMailDeatil
'
Me.aOfferOutSendMailDeatil.Caption = "Send offer out header via outlook"
Me.aOfferOutSendMailDeatil.Category = ""
Me.aOfferOutSendMailDeatil.ConfirmationMessage = Nothing
Me.aOfferOutSendMailDeatil.Id = "aOfferOutSendMailDeatil"
Me.aOfferOutSendMailDeatil.ImageName = "mail2"
Me.aOfferOutSendMailDeatil.Shortcut = Nothing
Me.aOfferOutSendMailDeatil.Tag = Nothing
Me.aOfferOutSendMailDeatil.TargetObjectsCriteria = Nothing
Me.aOfferOutSendMailDeatil.TargetViewId = ""
Me.aOfferOutSendMailDeatil.ToolTip = Nothing
Me.aOfferOutSendMailDeatil.TypeOfView = Nothing
End Sub
Friend WithEvents aOfferOutSendMailDeatil As DevExpress.ExpressApp.Actions.SimpleAction
End Class
@@ -0,0 +1,138 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="aOffersOutPrint.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>866, 17</value>
</metadata>
<metadata name="aOfferOutPrintChoice.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>697, 17</value>
</metadata>
<metadata name="aOffersOutPrintPDF.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>539, 17</value>
</metadata>
<metadata name="aOffersOutPrintPDF2.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>374, 17</value>
</metadata>
<metadata name="aOfferOutSendMailDeatil.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>186, 17</value>
</metadata>
<metadata name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
</root>
@@ -0,0 +1,209 @@
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.XtraReports.UI
Imports DevExpress.XtraReports.Parameters
Imports DevExpress.ExpressApp.Reports
Imports DevExpress.Persistent.BaseImpl
Imports System.IO
Imports DevExpress.ExpressApp.Editors
Imports Gnostice.PDFOne
Imports DevExpress.ExpressApp.Utils
Public Class OffersOutPrintVC
Inherits SISBusiness.Module.OffersOutPrintVC
Private _ReportServiceController As ReportServiceController
Private _RichEditControl As RichEditControl
Public Sub New()
MyBase.New()
InitializeComponent()
RegisterActions(components)
End Sub
Protected Overrides Sub OnActivated()
MyBase.OnActivated()
Frame.GetController(Of OffersOutPrintVC).aOfferOutSendMailDeatil.Active.SetItemValue("", False)
If View.Id = "OfferOutHeader_DetailView" Then
Frame.GetController(Of OffersOutPrintVC).aOfferOutSendMailDeatil.Active.SetItemValue("", True)
End If
If View.Id = "CRM_Opportunities_OfferOutHeader_ListView" Then
Frame.GetController(Of OffersOutPrintVC).aOfferOutSendMailDeatil.Active.SetItemValue("", True)
End If
End Sub
Protected Overrides Sub OnDeactivated()
MyBase.OnDeactivated()
If View.Id = "OfferOutHeader_DetailView" Then
Frame.GetController(Of OffersOutPrintVC).aOfferOutSendMailDeatil.Active.SetItemValue("", False)
End If
If View.Id = "CRM_Opportunities_OfferOutHeader_ListView" Then
Frame.GetController(Of OffersOutPrintVC).aOfferOutSendMailDeatil.Active.SetItemValue("", True)
End If
End Sub
Protected Overrides Sub OnViewControlsCreated()
MyBase.OnViewControlsCreated()
If View.Id = "OfferOutHeader_DetailView" Then
Dim _DetailView As DetailView = TryCast(View, DetailView)
Dim _RichEditContolViewItem As ViewItem = _DetailView.FindItem("DocumentBody")
If _RichEditContolViewItem IsNot Nothing Then
AddHandler _RichEditContolViewItem.ControlCreated, AddressOf RichEditContolViewItem_ControlCreated
End If
End If
End Sub
Private Sub RichEditContolViewItem_ControlCreated(sender As Object, e As EventArgs)
Dim _ItemControl As Object = TryCast(sender, ViewItem).Control
Dim _RichEditUserControl As RichEditUserControl = TryCast(_ItemControl, RichEditUserControl)
_RichEditControl = TryCast(_ItemControl, RichEditUserControl).RichEditControl
End Sub
Private Sub aOfferOutSendMailDeatil_Execute(sender As System.Object, e As DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs) Handles aOfferOutSendMailDeatil.Execute
Try
Dim _ObjectSpace As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
If View.SelectedObjects.Count = 0 Then Throw New Exception("*Nincs kiválasztva egyetlen ajánlat sem!")
Dim _OfferOutHeader As OfferOutHeader = TryCast(View.SelectedObjects(0), OfferOutHeader)
If _OfferOutHeader.IsEditable = False Then
Dim _ReportData As ReportData
If Frame.GetController(Of OffersOutPrintVC).aOfferOutPrintChoice.SelectedItem Is Nothing Then
Throw New Exception("*Nincs nyomtatvány típus kiválasztva!")
End If
Select Case Frame.GetController(Of OffersOutPrintVC).aOfferOutPrintChoice.SelectedItem.Data
Case "0" : _ReportData = _OfferOutHeader.OfferOutParameters.ReportData
Case "1" : _ReportData = _OfferOutHeader.OfferOutParameters.ReportData1
Case Else : Throw New Exception("*Nincs nyomtatvány típus kiválasztva!")
Exit Sub
End Select
If _ReportData IsNot Nothing Then
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
Dim _FileName As String = Path.GetTempPath & CorrectFileName(_OfferOutHeader.DocumentNumber & ".pdf")
Dim _XafReport As XafReport = _ReportData.LoadReport(_ocur)
Dim _FF As String = "[OfferOutHeader.Oid]='" & _OfferOutHeader.Oid.ToString & "'"
_XafReport.FilterString = _FF
Dim _StreamFile As New FileStream(_FileName, FileMode.Create)
_XafReport.ExportToPdf(_StreamFile)
_StreamFile.Close()
Dim _OutlookEMail As OutlookEMail = _ocur.CreateObject(Of OutlookEMail)()
Dim _OutlookEMailAttachments As OutlookEMailAttachments = _ocur.CreateObject(Of OutlookEMailAttachments)()
Dim _DocumentFileData As DocumentFileData = _ocur.CreateObject(Of DocumentFileData)()
_StreamFile = New FileStream(_FileName, FileMode.Open)
If _OfferOutHeader.CRM_Opportunities IsNot Nothing Then
_OutlookEMail.CRM_Leads = _OfferOutHeader.CRM_Opportunities.CRM_Leads
_OutlookEMail.CRM_Opportunities = _OfferOutHeader.CRM_Opportunities
End If
_OutlookEMail.Recipients = _OfferOutHeader.Contact.Email
If _OutlookEMail.Recipients = "" Then
_OutlookEMail.Recipients = "A kapcsolattartónak nincs e-mail címe."
End If
_OutlookEMail.Subject = "Árajánlat"
Dim _s As String = _OfferOutHeader.DocumentNumber & ".pdf"
_DocumentFileData.File = New FileData(_ocur.Session)
_DocumentFileData.File.LoadFromStream(_s, _StreamFile) '_FileData
_DocumentFileData.File.FileName = CorrectFileName(_OfferOutHeader.DocumentNumber & ".pdf")
_OutlookEMailAttachments.DocumentFileData = _DocumentFileData
_OutlookEMail.OutlookEMailAttachments.Add(_OutlookEMailAttachments)
_StreamFile.Close()
If System.IO.File.Exists(_FileName) Then
System.IO.File.Delete(_FileName)
End If
e.ShowViewParameters.CreatedView = Application.CreateDetailView(_ocur, "OutlookEMail_DetailView", False, _OutlookEMail)
View.Refresh()
Else
'____________________________ TESZT MIATT ________________________________________
Throw New UserFriendlyException("Üres a ReportData1 property!")
End If
Else
'____________________________ TESZT MIATT ________________________________________
Throw New UserFriendlyException("Csak végleges kimenő árajánlatot lehet e-mailben pdf-ként elküldeni.")
End If
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.OkOnly)
End Try
End Sub
Private Sub aOffersOutPrintPDF2_Execute(sender As System.Object, e As DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs) Handles aOffersOutPrintPDF2.Execute
Try
If Frame.GetController(Of OffersOutPrintVC).aOfferOutPrintChoice.SelectedItem Is Nothing Then Throw New Exception("*Nincs nyomtatvány típus kiválasztva!")
If _RichEditControl Is Nothing Then Throw New Exception("*A PDF elkészítéséhez aktiválni kell a ""Dokumentum"" fület a részletes nézetben!")
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
Dim _OfferOutHeader As OfferOutHeader = TryCast(View.SelectedObjects(0), OfferOutHeader)
If _OfferOutHeader.IsEditable = True Then
_OfferOutHeader.RecalculateOfferOut(_OfferOutHeader, _ocur)
_ocur.CommitChanges()
End If
Dim _FileName As String = CorrectFileName(_OfferOutHeader.DocumentNumber) & ".pdf"
Dim _FileName_Report As String = Path.GetTempPath & "Report.pdf"
Dim _FileName_RTF As String = Path.GetTempPath & "RTF.pdf"
Dim _FileName_Full As String = Path.GetTempPath & _FileName
Dim _ReportData As ReportData
Dim _StreamFile As FileStream
Dim DOCReport As New PDFDocument("2962-F2F8-23B1-5FD8-F4A3-55DB-7D94-28E9")
Dim DOCRTF As New PDFDocument("2962-F2F8-23B1-5FD8-F4A3-55DB-7D94-28E9")
Dim mergeDOC As New PDFDocument("2962-F2F8-23B1-5FD8-F4A3-55DB-7D94-28E9")
Select Case Frame.GetController(Of OffersOutPrintVC).aOfferOutPrintChoice.SelectedItem.Data
Case "0" : _ReportData = _OfferOutHeader.OfferOutParameters.ReportData
Case "1" : _ReportData = _OfferOutHeader.OfferOutParameters.ReportData1
Case Else : Throw New Exception("*Nincs nyomtatvány típus kiválasztva!")
Exit Sub
End Select
If _ReportData IsNot Nothing Then
Dim _XafReport As XafReport = _ReportData.LoadReport(_ocur)
Dim _FF As String = "[OfferOutHeader.Oid]='" & _OfferOutHeader.Oid.ToString & "'"
_StreamFile = New FileStream(_FileName_Report, FileMode.Create)
_XafReport.FilterString = _FF
_XafReport.ExportToPdf(_StreamFile)
_StreamFile.Close()
DOCReport.Load(_FileName_Report)
End If
If _RichEditControl IsNot Nothing Then
_StreamFile = New FileStream(_FileName_RTF, FileMode.Create)
_RichEditControl.ExportToPdf(_StreamFile)
_StreamFile.Close()
DOCRTF.Load(_FileName_RTF)
End If
'// Két PDF összefűzése
mergeDOC.Merge(DOCRTF)
mergeDOC.Merge(DOCReport)
mergeDOC.Save(_FileName_Full)
mergeDOC.Close()
_StreamFile = New FileStream(_FileName_Full, FileMode.Open)
Dim _FileData As New FileData(_ocur.Session)
_FileData.LoadFromStream(_FileName_Full, _StreamFile)
_OfferOutHeader.PDF_Original = _FileData
_StreamFile.Close()
_ocur.CommitChanges()
Process.Start(_FileName_Full)
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.OkOnly + MsgBoxStyle.Critical, String.Format(CaptionHelper.GetLocalizedText("Exceptions\SISBusinessExceptions", "MsgBoxCheckItAgain")))
End Try
End Sub
End Class