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.Reflection Imports DevExpress.ExpressApp.ConditionalAppearance Public Enum eVATAvowalType 'ÁFA bevallási mód eGeneral = 0 'Általános eFinancial = 1 'Pénzügyi End Enum ''", TargetItems:="*", Enabled:=False)> Public Class Customers Inherits Organization Private _CustomerNumber As String = "" 'Ügyfél azonosítója Private _VATNumber As String 'Adószám (belföldi) Private _VATNumberEU As String 'EU adószám Private _CustomersGLParameters As CustomersGLParameters 'Ügyfél főkönyvi kategária Private _CustomersNG As CustomersNG 'Ügyfél sorszám generátor Private _Pricing As Pricing 'Árképzés ha vevő az ügyfél Private _PricingIn As Pricing 'Árképzés ha vásárolunk tőle Private _CreditlineAmountHUF As Double 'Hitelkeret forintos összege Private _CreditlineAmountDEV As Double 'Hitelkeret devizás összege Private _CreditlineDay As Long 'Hitelkeret max késés nap. Private _IsAssetsHandling As Boolean 'Lesz e kinnlévőség kezelése Private _CRM_Leads As CRM_Leads Private _ImportedID As Long Private _LateChargesCountMode As LateChargesCountMode 'A késedelmes kamatszámítás módja Private _Citizen As String 'Állampolgársága Private _AssetsHandling_Note As String 'Kinnlévőség megjegyzés Private _PaymentOption As PaymentOption Private _ShipmentOption As ShipmentOption Private _QualityOption As QualityOption Private _FarmerCardNumber As String 'Őstermelői igazolvány száma Private _BusinessCardNumber As String 'Vállalkozói igazolvány száma Private _MVHRegistrationNumber As String 'MVH regisztrációs szám Private _CompanyRegistrationNumber As String 'Cégjegyzékszám Private _CompanyStatisticsNumber As String 'Cég statisztikai számjele Private _FamilyFarmNumber As String 'Családi gazdaság azonosító szám Private _MotherName As String 'Anyja neve Private _BirthAddress As Address 'Születési helye Private _BirthDate As Date 'Születési ideje Private _TAJNumber As String Private _LyonessID As String 'Lyoness ID azonosító Private _LyonessCardID As String 'Lyoness kártyaszám azonosító Private _ClassificationByProduct As ClassificationByProduct Private _ClassificationByMoney As ClassificationByMoney Private _ClassificationByPersonal As ClassificationByPersonal Private _SupplierMark As String 'Ha a partner beszállító, akkor egy rövid karaktersorozat Private _SupplierMarkInfo As String 'Beszállítói azonosító string Private _Checked As Boolean Private _CheckedDate As DateTime Private _CheckStatus As String Private _Contact_Decision As Contacts 'Döntéshozó, ügyvezető Private _Contact_Finance As Contacts 'Pénzüggyel kapcsolatos kapcsolattartó Private _EMail_Invoice As String 'e-mail cím, ahova PDF-ben elmegy a kiállított számla Private _HRPerson_SalesPerson As HRPerson 'A céghez tartozó HRPerson mint üzletkötő Private _MasterBusinessDirectory As BusinessDirectory Private _VATAvowalType As eVATAvowalType 'ÁFA bevallás módja Private _Oid_DH As String Private _Url_DH As String Private _CanUseMarketingInfo As Boolean 'Marketininfó Private _CanUseMarketingInfoThirdParts As Boolean 'Marketing info 3. félnek Private _ObjectCreated As Date Private _UserCreated As User Private _ObjectChanged As Date Private _UserChanged As User Private _QueueUpdated As Date Private _MarketPosition As Long 'Piaci besorolás Private _PriceColumn As Integer 'Ároszlop, melyik PriceColumnBruttoHUFXX ára van Private _GreenCardNumber As String 'Mezőgazdasági zöldkönyv száma Private _BiologicalControlContractNumber As String 'Növényvédelmi szerződés száma Private _NAV_queryTaxpayer As String Private _NAV_valid As Boolean Private _NAV_queryDate As DateTime Public Sub New(ByVal session As Session) MyBase.New(session) End Sub Protected Overrides Sub OnSaving() MyBase.OnSaving() If Session.IsNewObject(Me) Then If SecuritySystem.CurrentUser IsNot Nothing Then UserCreated = Session.GetObjectByKey(Of User)(Session.GetKeyValue(SecuritySystem.CurrentUser)) End If UserChanged = UserCreated ObjectCreated = GetSQLTime(Session) ObjectChanged = ObjectCreated QueueUpdated = Date.MinValue Else If SecuritySystem.CurrentUser IsNot Nothing Then UserChanged = Session.GetObjectByKey(Of User)(Session.GetKeyValue(SecuritySystem.CurrentUser)) ObjectChanged = GetSQLTime(Session) End If End If ' Az partner duplázódás elkerülése miatt megkeressük, hogy létezik-e ilyen partner a megadott adószámmal 'If Me.VATNumber <> "" Then ' Dim _Customers As Customers = Session.FindObject(Of Customers)(CriteriaOperator.Parse("VATNumber=?", Me.VATNumber)) ' If _Customers IsNot Nothing Then ' If _Customers.Oid <> Me.Oid Then ' '----TESZT MIATT----------------------------------------------- ' Throw New Exception("*A megadott adószámmal már létezik ügyfél!") ' End If ' End If 'End If 'Sorszám kiosztása If LTrim(RTrim(Me.CustomerNumber)) = "" Then If Me.CustomersNG IsNot Nothing Then If Session.IsNewObject(Me) = True Then Me.CustomerNumber = Me.CustomersNG.NumberGenerator.GetNewNumber(Me.CustomersNG.NumberGenerator) End If Else '--------- TESZT MIATT!! -------------------------------------- Throw New Exception("*Nincs beállítva a sorszámgenerátor paraméter!") End If End If If IsDeleted = False Then If Name = "" And FullName <> "" Then Name = FullName End If If FullName = "" And Name <> "" Then FullName = Name End If End If If Checked = True Then CheckedDate = GetSQLTime(Session) End If End Sub Public Overrides Sub AfterConstruction() MyBase.AfterConstruction() CustomersNG = Session.FindObject(Of CustomersNG)(CriteriaOperator.Parse("Oid=Oid")) Citizen = "Magyar" IsAssetsHandling = True Checked = False CanUseMarketingInfo = False CanUseMarketingInfoThirdParts = False Url_DH = Nothing CustomersGLParameters = Session.FindObject(Of CustomersGLParameters)(CriteriaOperator.Parse("DefaultforBusiness=True")) End Sub Property CustomerNumber As String Get Return _CustomerNumber End Get Set(ByVal value As String) SetPropertyValue("CustomerNumber", _CustomerNumber, value) End Set End Property Property VATNumber As String Get Return _VATNumber End Get Set(ByVal value As String) SetPropertyValue("VATNumber", _VATNumber, value) End Set End Property Property VATNumberEU As String Get Return _VATNumberEU End Get Set(ByVal value As String) SetPropertyValue("VATNumberEU", _VATNumberEU, value) End Set End Property Property CustomersGLParameters() As CustomersGLParameters Get Return _CustomersGLParameters End Get Set(ByVal value As CustomersGLParameters) SetPropertyValue("CustomersGLParameters", _CustomersGLParameters, value) End Set End Property Property CustomersNG As CustomersNG Get If _CustomersNG Is Nothing Then If (Not IsSaving) AndAlso (Not IsLoading) Then _CustomersNG = Session.FindObject(Of CustomersNG)(1, CriteriaOperator.Parse("Oid=Oid")) End If End If Return _CustomersNG End Get Set(ByVal value As CustomersNG) SetPropertyValue("CustomersNG", _CustomersNG, value) End Set End Property Property Pricing As Pricing Get Return _Pricing End Get Set(ByVal value As Pricing) SetPropertyValue("Pricing", _Pricing, value) End Set End Property Property PricingIn As Pricing Get Return _PricingIn End Get Set(ByVal value As Pricing) SetPropertyValue("PricingIn", _PricingIn, value) End Set End Property Property IsAssetsHandling As Boolean Get Return _IsAssetsHandling End Get Set(value As Boolean) SetPropertyValue("IsAssetsHandling", _IsAssetsHandling, value) End Set End Property Property CRM_Leads As CRM_Leads Get Return _CRM_Leads End Get Set(value As CRM_Leads) SetPropertyValue("CRM_Leads", _CRM_Leads, value) End Set End Property Property ImportedID As Long Get Return _ImportedID End Get Set(value As Long) SetPropertyValue("ImportedID", _ImportedID, value) End Set End Property Property CreditlineAmountHUF As Double Get Return _CreditlineAmountHUF End Get Set(value As Double) SetPropertyValue("CreditlineAmountHUF", _CreditlineAmountHUF, value) End Set End Property Property CreditlineAmountDEV As Double Get Return _CreditlineAmountDEV End Get Set(value As Double) SetPropertyValue("CreditlineAmountDEV", _CreditlineAmountDEV, value) End Set End Property Property CreditlineDay As Long Get Return _CreditlineDay End Get Set(value As Long) SetPropertyValue("CreditlineDay", _CreditlineDay, value) End Set End Property Property LateChargesCountMode As LateChargesCountMode Get Return _LateChargesCountMode End Get Set(value As LateChargesCountMode) SetPropertyValue("LateChargesCountMode", _LateChargesCountMode, value) End Set End Property Property Citizen As String Get Return _Citizen End Get Set(value As String) SetPropertyValue("Citizen", _Citizen, value) End Set End Property Property AssetsHandling_Note As String Get Return _AssetsHandling_Note End Get Set(value As String) SetPropertyValue("AssetsHandling_Note", _AssetsHandling_Note, value) End Set End Property Public Property PaymentOption() As PaymentOption Get Return _PaymentOption End Get Set(ByVal value As PaymentOption) SetPropertyValue("PaymentOption", _PaymentOption, value) End Set End Property Public Property ShipmentOption() As ShipmentOption Get Return _ShipmentOption End Get Set(ByVal value As ShipmentOption) SetPropertyValue("ShipmentOption", _ShipmentOption, value) End Set End Property Public Property QualityOption() As QualityOption Get Return _QualityOption End Get Set(ByVal value As QualityOption) SetPropertyValue("QualityOption", _QualityOption, value) End Set End Property Property ClassificationByProduct As ClassificationByProduct Get Return _ClassificationByProduct End Get Set(value As ClassificationByProduct) SetPropertyValue("ClassificationByProduct", _ClassificationByProduct, value) End Set End Property Property ClassificationByMoney As ClassificationByMoney Get Return _ClassificationByMoney End Get Set(value As ClassificationByMoney) SetPropertyValue("ClassificationByMoney", _ClassificationByMoney, value) End Set End Property Property ClassificationByPersonal As ClassificationByPersonal Get Return _ClassificationByPersonal End Get Set(value As ClassificationByPersonal) SetPropertyValue("ClassificationByPersonal", _ClassificationByPersonal, value) End Set End Property '// Őstermelőhöz Property FarmerCardNumber As String Get Return _FarmerCardNumber End Get Set(value As String) SetPropertyValue("FarmerCardNumber", _FarmerCardNumber, value) End Set End Property Property BusinessCardNumber As String Get Return _BusinessCardNumber End Get Set(value As String) SetPropertyValue("BusinessCardNumber", _BusinessCardNumber, value) End Set End Property Property MVHRegistrationNumber As String Get Return _MVHRegistrationNumber End Get Set(value As String) SetPropertyValue("MVHRegistrationNumber", _MVHRegistrationNumber, value) End Set End Property Property CompanyRegistrationNumber As String Get Return _CompanyRegistrationNumber End Get Set(value As String) SetPropertyValue("CompanyRegistrationNumber", _CompanyRegistrationNumber, value) End Set End Property Property CompanyStatisticsNumber As String Get Return _CompanyStatisticsNumber End Get Set(value As String) SetPropertyValue("CompanyStatisticsNumber", _CompanyStatisticsNumber, value) End Set End Property Property FamilyFarmNumber As String Get Return _FamilyFarmNumber End Get Set(value As String) SetPropertyValue("FamilyFarmNumber", _FamilyFarmNumber, value) End Set End Property Property MotherName As String Get Return _MotherName End Get Set(value As String) SetPropertyValue("MotherName", _MotherName, value) End Set End Property Property BirthAddress As Address Get Return _BirthAddress End Get Set(value As Address) SetPropertyValue("BirthAddress", _BirthAddress, value) End Set End Property Property BirthDate As Date Get Return _BirthDate End Get Set(value As Date) SetPropertyValue("BirthDate", _BirthDate, value) End Set End Property Property TAJNumber As String Get Return _TAJNumber End Get Set(value As String) SetPropertyValue("TAJNumber", _TAJNumber, value) End Set End Property '//--- Egyéb Property MarketPosition As Long Get Return _MarketPosition End Get Set(value As Long) SetPropertyValue("MarketPosition", _MarketPosition, value) End Set End Property Property SupplierMark As String Get Return _SupplierMark End Get Set(value As String) SetPropertyValue("SupplierMark", _SupplierMark, value) End Set End Property Property SupplierMarkInfo As String Get Return _SupplierMarkInfo End Get Set(value As String) SetPropertyValue("SupplierMarkInfo", _SupplierMarkInfo, value) End Set End Property Property Checked As Boolean Get Return _Checked End Get Set(value As Boolean) SetPropertyValue("Checked", _Checked, value) End Set End Property Property CheckStatus As String Get Return _CheckStatus End Get Set(value As String) SetPropertyValue("CheckStatus", _CheckStatus, value) End Set End Property Property CheckedDate As Date Get Return _CheckedDate End Get Set(value As Date) SetPropertyValue("CheckedDate", _CheckedDate, value) End Set End Property Property HRPerson_SalesPerson As HRPerson Get Return _HRPerson_SalesPerson End Get Set(value As HRPerson) SetPropertyValue("HRPerson_SalesPerson", _HRPerson_SalesPerson, value) End Set End Property Property MasterBusinessDirectory As BusinessDirectory Get Return _MasterBusinessDirectory End Get Set(value As BusinessDirectory) SetPropertyValue("MasterBusinessDirectory", _MasterBusinessDirectory, value) End Set End Property Property LyonessID As String Get Return _LyonessID End Get Set(value As String) SetPropertyValue("LyonessID", _LyonessID, value) End Set End Property Property LyonessCardID As String Get Return _LyonessCardID End Get Set(value As String) SetPropertyValue("LyonessCardID", _LyonessCardID, value) End Set End Property Property VATAvowalType As eVATAvowalType Get Return _VATAvowalType End Get Set(value As eVATAvowalType) SetPropertyValue("VATAvowalType", _VATAvowalType, value) End Set End Property Property Oid_DH As String Get Return _Oid_DH End Get Set(value As String) SetPropertyValue("Oid_DH", _Oid_DH, value) End Set End Property Property Url_DH As String Get Return _Url_DH End Get Set(value As String) SetPropertyValue("Url_DH", _Url_DH, value) End Set End Property Property CanUseMarketingInfo As Boolean Get Return _CanUseMarketingInfo End Get Set(value As Boolean) SetPropertyValue("CanUseMarketingInfo", _CanUseMarketingInfo, value) End Set End Property Property CanUseMarketingInfoThirdParts As Boolean Get Return _CanUseMarketingInfoThirdParts End Get Set(value As Boolean) SetPropertyValue("CanUseMarketingInfoThirdParts", _CanUseMarketingInfoThirdParts, value) End Set End Property Property GreenCardNumber As String Get Return _GreenCardNumber End Get Set(value As String) SetPropertyValue("GreenCardNumber", _GreenCardNumber, value) End Set End Property Property BiologicalControlContractNumber As String Get Return _BiologicalControlContractNumber End Get Set(value As String) SetPropertyValue("BiologicalControlContractNumber", _BiologicalControlContractNumber, value) End Set End Property ''' ''' NAV adószám ellenőrzés ''' ''' Property NAV_queryTaxpayer As String Get Return _NAV_queryTaxpayer End Get Set(value As String) SetPropertyValue("NAV_queryTaxpayer", _NAV_queryTaxpayer, value) End Set End Property ''' ''' NAV adószám rendben van ? ''' ''' Property NAV_valid As Boolean Get Return _NAV_valid End Get Set(value As Boolean) SetPropertyValue("NAV_valid", _NAV_valid, value) End Set End Property ''' ''' NAV adószámlekérdezés utolsó dátuma ''' ''' Property NAV_queryDate As DateTime Get Return _NAV_queryDate End Get Set(value As DateTime) SetPropertyValue("NAV_queryDate", _NAV_queryDate, value) End Set End Property Property ObjectCreated As Date Get Return _ObjectCreated End Get Set(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 Property ObjectChanged As Date Get Return _ObjectChanged End Get Set(value As Date) SetPropertyValue("ObjectChanged", _ObjectChanged, value) End Set End Property Property UserChanged As User Get Return _UserChanged End Get Set(value As User) SetPropertyValue("UserChanged", _UserChanged, value) End Set End Property Property QueueUpdated As Date Get Return _QueueUpdated End Get Set(value As Date) SetPropertyValue("QueueUpdated", _QueueUpdated, value) End Set End Property Property Contact_Decision As Contacts Get Return _Contact_Decision End Get Set(value As Contacts) SetPropertyValue("Contact_Decision", _Contact_Decision, value) End Set End Property Property Contact_Finance As Contacts Get Return _Contact_Finance End Get Set(value As Contacts) SetPropertyValue("Contact_Finance", _Contact_Finance, value) End Set End Property Property EMail_Invoice As String Get Return _EMail_Invoice End Get Set(value As String) SetPropertyValue("EMail_Invoice", _EMail_Invoice, value) End Set End Property 'Ároszlop Property PriceColumn As Integer Get Return _PriceColumn End Get Set(value As Integer) SetPropertyValue("PriceColumn", _PriceColumn, value) End Set End Property '-----ReadOnly--------------- Overloads ReadOnly Property IsDeleted As Boolean Get 'Dim _IsDeleted As Boolean = False 'For Each _PropertyInfo As PropertyInfo In Me.GetType.GetProperties ' If _PropertyInfo.PropertyType.Name = "GCRecord" Then ' _IsDeleted = _PropertyInfo.GetValue(Me, Nothing) ' End If 'Next 'Return _IsDeleted Return MyBase.IsDeleted End Get End Property ReadOnly Property CustomersFileAttachment As XPCollection(Of CustomersFileAttachment) Get Return GetCollection(Of CustomersFileAttachment)("CustomersFileAttachment") End Get End Property ReadOnly Property CRM_Opportunities As XPCollection(Of CRM_Opportunities) Get If Session.IsObjectsLoading = False And Session.IsObjectsSaving = False Then Return New XPCollection(Of CRM_Opportunities)(Session, CriteriaOperator.Parse("Customers.Oid=?", Me.Oid)) Else Return Nothing End If End Get End Property Public ReadOnly Property CustomerBankAccounts() As XPCollection(Of CustomerBankAccounts) Get Return GetCollection(Of CustomerBankAccounts)("CustomerBankAccounts") End Get End Property Public ReadOnly Property Contacts() As XPCollection(Of Contacts) Get Return GetCollection(Of Contacts)("Contacts") End Get End Property Public ReadOnly Property CustomersNGCollection As XPCollection(Of CustomersNGCollection) Get Return GetCollection(Of CustomersNGCollection)("CustomersNGCollection") End Get End Property Public ReadOnly Property CustomersAddress As XPCollection(Of CustomersAddress) Get Return GetCollection(Of CustomersAddress)("CustomersAddress") End Get End Property Public ReadOnly Property CustomersNGCollectionWorkSheetType As XPCollection(Of CustomersNGCollectionWorkSheetType) Get Return GetCollection(Of CustomersNGCollectionWorkSheetType)("CustomersNGCollectionWorkSheetType") End Get End Property ReadOnly Property ContractProductsCredit As XPCollection(Of ContractProductsCredit) Get Return New XPCollection(Of ContractProductsCredit)(Session, CriteriaOperator.Parse("Contract.Customers=?", Me)) End Get End Property ReadOnly Property CustomersCCustomers As XPCollection(Of CustomersCCustomers) Get Return New XPCollection(Of CustomersCCustomers)(Session, CriteriaOperator.Parse("Customers=?", Me)) End Get End Property ReadOnly Property Customers_BusinessDirectory As XPCollection(Of BusinessDirectory) Get Dim _BusinessDirectory_Collection As New XPCollection(Of BusinessDirectory)(Session, CriteriaOperator.Parse("1=2")) If MasterBusinessDirectory IsNot Nothing Then If MasterBusinessDirectory.Children.Count > 0 Then _BusinessDirectory_Collection.Add(MasterBusinessDirectory) RecursiveBusinessDirectory(_BusinessDirectory_Collection, MasterBusinessDirectory.NestedBusinessDirectory) Else _BusinessDirectory_Collection.Add(MasterBusinessDirectory) End If End If Return _BusinessDirectory_Collection End Get End Property ReadOnly Property OfferOutRows As XPCollection(Of OfferOutRows) Get Return New XPCollection(Of OfferOutRows)(Session, CriteriaOperator.Parse("OfferOutHeader.Customers=?", Me)) End Get End Property #Region "Other subs" Private Sub RecursiveBusinessDirectory(_BusinessDirectoryList As XPCollection(Of BusinessDirectory), _NestedBusinessDirectory As XPCollection(Of BusinessDirectory)) For Each _BusinessDirectory As BusinessDirectory In _NestedBusinessDirectory If _BusinessDirectory.Children.Count > 0 Then _BusinessDirectoryList.Add(_BusinessDirectory) RecursiveBusinessDirectory(_BusinessDirectoryList, _BusinessDirectory.NestedBusinessDirectory) Else _BusinessDirectoryList.Add(_BusinessDirectory) End If Next End Sub #End Region End Class