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 DevExpress.ExpressApp.ConditionalAppearance ' _ _ _ _ NotSet OR OfferInState <> ClosedLost THEN Save (IN)", DefaultContexts.Save, "OfferLOSTReason != 0 OR OfferInState !=2", "", SkipNullOrEmptyValues:=False)> _ 2 (IN)", AppearanceItemType.ViewItem, "OfferInState <> 2", TargetItems:="OfferLOSTReason", visibility:=Editors.ViewItemVisibility.Hide)> _ 7 (IN)", AppearanceItemType.ViewItem, "OfferLOSTReason <> 7", TargetItems:="OfferLOSTReasonDescription", visibility:=Editors.ViewItemVisibility.Hide)> _ _ _ _ _ _ _ _ _ _ 'HUF'", TargetItems:="row_FinalPriceHUF", visibility:=Editors.ViewItemVisibility.Hide)> _ _ _ _ Public Class OfferInHeader Inherits BaseObject Private _OfferInParameters As OfferInParameters 'Árajánlat paramétere, ami a sorszámot és egyéb tul. meghat. Private _OfferInState As eOfferInState 'Ajánlat státusz, hol tart jelenleg Private _OfferLOSTReason As eOfferInLOSTReason 'Ha nem fogadjuk el, miért ? Private _OfferLOSTReasonDescription As String ' Ha nem fogadjuk el és eOther akkor szövegesen beírni ! Private _DocumentNumber As String 'Árajánlat száma (generálódik) Private _CustomersFrom As CustomersFrom 'Saját cég Private _Customers As Customers 'Partner, akitől az árajánlatot kapjuk szól (ez nem kötelező, de a contactból ismerje fel !) Private _Contact As Contacts 'Kapcsolat, akitől az árajánlatot kapjuk (ez a fő !!! kötelező) Private _DateCreated As Date 'Kiállítás dátuma Private _DateExecution As Date 'Teljesítés dátuma Private _DatePayment As Date 'Fiz. hat Private _DateDue As Date 'Érvényesség dátuma Private _DateAcknowledgement As Date 'Rendelés visszaigazolás dátuma Private _Description As String 'Leírás (fejlécen) Private _PaymentOption As PaymentOption 'Fizetési opció Private _ShipmentOption As ShipmentOption 'Szállítási opció Private _QualityOption As QualityOption 'Minőségi opció Private _CurrencyName As CurrencyName 'Deviza Private _ObjectCreated As Date 'Maga az objektum mikor készült el Private _UserCreated As User 'Ki készítette Private _IsEditable As Boolean = True 'Szerkeszthető vagy végleges ajánlat Private _IsStorno As Boolean = True 'Stornírozott ajánlat 'Excel, Word dokumentum Private _DocumentBody As String 'RichText dokumentum test Private _ExcelProperty As String 'Excel !!! Private _ExcelFile As FileData '--- Sorok rögzítéséhez nonpersistent propertyk Private _row_RowType As eRowType 'Sor tipus Private _row_Products As Products Private _row_Installation As Installation Private _row_ShortName As String 'Megnevezés Private _row_Description As String 'Leírás Private _row_QTT As Double 'Mennyiség Private _row_Units As Units 'Mennyiségi egység Private _row_VAT As VAT 'ÁFA kód Private _row_FinalPriceHUF As Double 'Termék listaára HUF Private _row_FinalPriceDEV As Double 'Termék listaára DEV Private _row_RowGroup1 As String 'Csoportosító sor1 Private _row_RowGroup2 As String 'Csoportosító sor2 Private _CRM_Opportunities As CRM_Opportunities Public Sub New(ByVal session As Session) MyBase.New(session) End Sub Protected Overrides Sub OnSaving() If Session.IsNewObject(Me) Then ObjectCreated = GetSQLTime(Session) UserCreated = Session.GetObjectByKey(Of User)(Session.GetKeyValue(SecuritySystem.CurrentUser)) If OfferInParameters Is Nothing Then Else ObjectCreated = Now If DocumentNumber = "" Then DocumentNumber = OfferInParameters.NumberGenerator.GetNewNumber(OfferInParameters.NumberGenerator) End If End If End If MyBase.Save() End Sub Public Overrides Sub AfterConstruction() MyBase.AfterConstruction() Me.IsEditable = True Me.IsStorno = False CurrencyName = Session.FindObject(Of CurrencyName)(CriteriaOperator.Parse("ShortName=?", "HUF")) Me.row_VAT = Session.FindObject(Of VAT)(CriteriaOperator.Parse("DefaultForBusinnes='True'")) Me.row_Units = Session.FindObject(Of Units)(CriteriaOperator.Parse("DefaultForBusinnes='True'")) End Sub Property OfferInParameters As OfferInParameters Get Return _OfferInParameters End Get Set(ByVal value As OfferInParameters) SetPropertyValue("OfferInParameters", _OfferInParameters, value) End Set End Property Property OfferInState As eOfferInState Get Return _OfferInState End Get Set(ByVal value As eOfferInState) SetPropertyValue("OfferInState", _OfferInState, value) If Session.IsObjectsLoading = False And Session.IsObjectsSaving = False Then Select Case OfferInState Case eOfferInState.eClosedWON OfferLOSTReason = eOfferInLOSTReason.eNotSet Case eOfferInState.eInProgress OfferLOSTReason = eOfferInLOSTReason.eNotSet Case eOfferInState.eInThinkingOf OfferLOSTReason = eOfferInLOSTReason.eNotSet End Select End If End Set End Property Property OfferLOSTReason As eOfferInLOSTReason Get Return _OfferLOSTReason End Get Set(ByVal value As eOfferInLOSTReason) SetPropertyValue("OfferLOSTReason", _OfferLOSTReason, value) If Session.IsObjectsLoading = False And Session.IsObjectsSaving = False Then Select Case OfferLOSTReason Case eOfferInLOSTReason.eNotSet OfferLOSTReasonDescription = "" Case eOfferInLOSTReason.eTooExpensive OfferLOSTReasonDescription = "" Case eOfferInLOSTReason.eTooLate OfferLOSTReasonDescription = "" Case eOfferInLOSTReason.eChooseConcurrency OfferLOSTReasonDescription = "" Case eOfferInLOSTReason.eQualityProblem OfferLOSTReasonDescription = "" Case eOfferInLOSTReason.eNoAnswer OfferLOSTReasonDescription = "" Case eOfferInLOSTReason.eWINOther OfferLOSTReasonDescription = "" End Select End If End Set End Property Property OfferLOSTReasonDescription As String Get Return _OfferLOSTReasonDescription End Get Set(ByVal value As String) SetPropertyValue("OfferLOSTReasonDescription", _OfferLOSTReasonDescription, value) End Set End Property Property DocumentNumber As String Get Return _DocumentNumber End Get Set(ByVal value As String) SetPropertyValue("DocumentNumber", _DocumentNumber, value) End Set End Property Property CustomersFrom As CustomersFrom Get Return _CustomersFrom End Get Set(ByVal value As CustomersFrom) SetPropertyValue("CustomersFrom", _CustomersFrom, value) End Set End Property Property Customers As Customers Get Return _Customers End Get Set(ByVal value As Customers) SetPropertyValue("Customers", _Customers, value) End Set End Property Property Contact As Contacts Get Return _Contact End Get Set(ByVal value As Contacts) SetPropertyValue("Contact", _Contact, value) If Session.IsObjectsLoading = False And Session.IsObjectsSaving = False And value IsNot Nothing Then Me.Customers = value.Customers End If End Set End Property Property DateCreated As Date Get Return _DateCreated End Get Set(ByVal value As Date) SetPropertyValue("DateCreated", _DateCreated, value) End Set End Property Property DateExecution As Date Get Return _DateExecution End Get Set(ByVal value As Date) SetPropertyValue("DateExecution", _DateExecution, value) End Set End Property Property DatePayment As Date Get Return _DatePayment End Get Set(ByVal value As Date) SetPropertyValue("DatePayment", _DatePayment, value) End Set End Property _ Property DateDue As Date Get Return _DateDue End Get Set(ByVal value As Date) SetPropertyValue("DateDue", _DateDue, value) End Set End Property Property DateAcknowledgement As Date Get Return _DateAcknowledgement End Get Set(value As Date) SetPropertyValue("DateAcknowledgement", _DateAcknowledgement, value) End Set End Property Property Description As String Get Return _Description End Get Set(ByVal value As String) SetPropertyValue("Description", _Description, value) End Set End Property _ Property PaymentOption As PaymentOption Get Return _PaymentOption End Get Set(ByVal value As PaymentOption) SetPropertyValue("PaymentOption", _PaymentOption, value) End Set End Property _ Property ShipmentOption As ShipmentOption Get Return _ShipmentOption End Get Set(ByVal value As ShipmentOption) SetPropertyValue("ShipmentOption", _ShipmentOption, value) End Set End Property _ Property QualityOption As QualityOption Get Return _QualityOption End Get Set(ByVal value As QualityOption) SetPropertyValue("QualityOption", _QualityOption, value) End Set End Property _ Property CurrencyName As CurrencyName Get Return _CurrencyName End Get Set(ByVal value As CurrencyName) SetPropertyValue("CurrencyName", _CurrencyName, value) End Set End Property _ Property IsEditable As Boolean Get Return _IsEditable End Get Set(ByVal value As Boolean) SetPropertyValue("IsEditable", _IsEditable, value) End Set End Property _ Property IsStorno As Boolean Get Return _IsStorno End Get Set(ByVal value As Boolean) SetPropertyValue("IsStorno", _IsStorno, value) End Set End Property _ Property ObjectCreated As Date Get Return _ObjectCreated End Get Set(ByVal value As Date) SetPropertyValue("ObjectCreated", _ObjectCreated, value) End Set End Property _ Property UserCreated As User Get Return _UserCreated End Get Set(value As User) SetPropertyValue("UserCreated", _UserCreated, value) End Set End Property _ _ Public ReadOnly Property OfferInRows() As XPCollection(Of OfferInRows) Get Return GetCollection(Of OfferInRows)("OfferInRows") End Get End Property _ _ Public ReadOnly Property OfferInheaderFileAttachment As XPCollection(Of OfferInheaderFileAttachment) Get Return GetCollection(Of OfferInheaderFileAttachment)("OfferInheaderFileAttachment") End Get End Property ' --- Excel, Word dokumentum _ Property DocumentBody() As String Get Return _DocumentBody End Get Set(ByVal value As String) SetPropertyValue("DocumentBody", _DocumentBody, value) End Set End Property _ Property ExcelProperty As String Get Return _ExcelProperty End Get Set(value As String) SetPropertyValue("ExcelProperty", _ExcelProperty, value) End Set End Property _ Public Property ExcelFile As FileData Get Return _ExcelFile End Get Set(ByVal value As FileData) SetPropertyValue("ExcelFile", _ExcelFile, value) End Set End Property '--- Sorok rögzítéséhez nonpersistent propertyk _ _ _ Property row_RowType As eRowType Get Return _row_RowType End Get Set(value As eRowType) SetPropertyValue("row_RowType", _row_RowType, value) End Set End Property _ _ Property row_Products As Products Get Return _row_Products End Get Set(value As Products) SetPropertyValue("row_Products", _row_Products, value) End Set End Property _ _ Property row_Installation As Installation Get Return _row_Installation End Get Set(value As Installation) SetPropertyValue("row_Installation", _row_Installation, value) End Set End Property _ _ Property row_ShortName As String Get Return _row_ShortName End Get Set(value As String) SetPropertyValue("row_ShortName", _row_ShortName, value) End Set End Property _ _ Property row_Description As String Get Return _row_Description End Get Set(value As String) SetPropertyValue("row_Description", _row_Description, value) End Set End Property _ _ Property row_QTT As Double Get Return _row_QTT End Get Set(value As Double) SetPropertyValue("row_QTT", _row_QTT, value) End Set End Property _ _ Property row_Units As Units Get Return _row_Units End Get Set(value As Units) SetPropertyValue("row_Units", _row_Units, value) End Set End Property _ _ Property row_VAT As VAT Get Return _row_VAT End Get Set(value As VAT) SetPropertyValue("row_VAT", _row_VAT, value) End Set End Property _ _ Property row_FinalPriceHUF As Double Get Return _row_FinalPriceHUF End Get Set(value As Double) SetPropertyValue("row_FinalPriceHUF", _row_FinalPriceHUF, value) End Set End Property _ _ Property row_FinalPriceDEV As Double Get Return _row_FinalPriceDEV End Get Set(value As Double) SetPropertyValue("row_FinalPriceDEV", _row_FinalPriceDEV, value) End Set End Property _ _ Property row_RowGroup1 As String Get Return _row_RowGroup1 End Get Set(value As String) SetPropertyValue("row_RowGroup1", _row_RowGroup1, value) End Set End Property _ _ Property row_RowGroup2 As String Get Return _row_RowGroup2 End Get Set(value As String) SetPropertyValue("row_RowGroup2", _row_RowGroup2, value) End Set End Property '--- CRM ügy _ Property CRM_Opportunities As CRM_Opportunities Get Return _CRM_Opportunities End Get Set(value As CRM_Opportunities) SetPropertyValue("CRM_Opportunities", _CRM_Opportunities, value) If Session.IsObjectsSaving = False And Session.IsObjectsLoading = False And Me.CRM_Opportunities IsNot Nothing And Session.IsNewObject(Me) = True Then Me.CustomersFrom = Me.CRM_Opportunities.CustomersFrom End If End Set End Property End Class