ONLINE INVOICE VOL 3

This commit is contained in:
2018-07-26 09:16:10 +02:00
parent 6ce0c4c9eb
commit e9e50058c5
16 changed files with 316 additions and 48 deletions
@@ -11,14 +11,14 @@ Imports DevExpress.Persistent.Validation
Imports DevExpress.ExpressApp.ConditionalAppearance
'CreditNoteRows
<DefaultClassOptions()> _
<NavigationItem(False)> _
<CreatableItem(False)> _
<Appearance("InvoiceCreditNoteHeader - Disable UserCreated all time", AppearanceItemType.ViewItem, "1=1", TargetItems:="UserCreated", Enabled:=False)> _
<Appearance("InvoiceCreditNoteHeader - Disable ObjectCreated all time", AppearanceItemType.ViewItem, "1=1", TargetItems:="ObjectCreated", Enabled:=False)> _
<Appearance("InvoiceCreditNoteHeader - Disable CustomersFrom when not empty", AppearanceItemType.ViewItem, "IsNull(CustomersFrom)=False", TargetItems:="CustomersFrom", Enabled:=False)> _
<Appearance("InvoiceCreditNoteHeader - Disable Customers when not empty", AppearanceItemType.ViewItem, "IsNull(Customers)=False", TargetItems:="Customers", Enabled:=False)> _
<Appearance("InvoiceCreditNoteHeader - Hide Item2 when IsNewObject", AppearanceItemType.LayoutItem, "IsNull(ObjectCreated) Or IsNull(UserCreated)", TargetItems:="Item2", visibility:=Editors.ViewItemVisibility.Hide)> _
<DefaultClassOptions()>
<NavigationItem(False)>
<CreatableItem(False)>
<Appearance("InvoiceCreditNoteHeader - Disable UserCreated all time", AppearanceItemType.ViewItem, "1=1", TargetItems:="UserCreated", Enabled:=False)>
<Appearance("InvoiceCreditNoteHeader - Disable ObjectCreated all time", AppearanceItemType.ViewItem, "1=1", TargetItems:="ObjectCreated", Enabled:=False)>
<Appearance("InvoiceCreditNoteHeader - Disable CustomersFrom when not empty", AppearanceItemType.ViewItem, "IsNull(CustomersFrom)=False", TargetItems:="CustomersFrom", Enabled:=False)>
<Appearance("InvoiceCreditNoteHeader - Disable Customers when not empty", AppearanceItemType.ViewItem, "IsNull(Customers)=False", TargetItems:="Customers", Enabled:=False)>
<Appearance("InvoiceCreditNoteHeader - Hide Item2 when IsNewObject", AppearanceItemType.LayoutItem, "IsNull(ObjectCreated) Or IsNull(UserCreated)", TargetItems:="Item2", Visibility:=Editors.ViewItemVisibility.Hide)>
Public Class InvoiceCreditNoteHeader
Inherits BaseObject
@@ -32,13 +32,16 @@ Public Class InvoiceCreditNoteHeader
Private _PaymentOption As PaymentOption
Private _DatePayment As Date
Private _Description As String
Private _CurrencyRate As Double
Private _CurrencyName As CurrencyName
Public Sub New(ByVal session As Session)
MyBase.New(session)
End Sub
Public Overrides Sub AfterConstruction()
MyBase.AfterConstruction()
DateExecution = GetSQLTime(Session)
'DateExecution = GetSQLTime(Session)
CurrencyRate = 1
End Sub
Protected Overrides Sub OnSaving()
MyBase.OnSaving()
@@ -48,7 +51,7 @@ Public Class InvoiceCreditNoteHeader
End If
End Sub
<RuleRequiredField("InvoiceCreditNoteHeader - CustomersFrom", DefaultContexts.Save)> _
<RuleRequiredField("InvoiceCreditNoteHeader - CustomersFrom", DefaultContexts.Save)>
Property CustomersFrom As CustomersFrom
Get
Return _CustomersFrom
@@ -57,7 +60,7 @@ Public Class InvoiceCreditNoteHeader
SetPropertyValue("CustomersFrom", _CustomersFrom, value)
End Set
End Property
<RuleRequiredField("InvoiceCreditNoteHeader - Customers", DefaultContexts.Save)> _
<RuleRequiredField("InvoiceCreditNoteHeader - Customers", DefaultContexts.Save)>
Property Customers As Customers
Get
Return _Customers
@@ -94,6 +97,22 @@ Public Class InvoiceCreditNoteHeader
End Get
Set(value As Date)
SetPropertyValue("DateExecution", _DateExecution, value)
If Session.IsObjectsLoading = False AndAlso Session.IsObjectsSaving = False Then
'// MNB árfolyam lekérése
Dim _CurrencyRate_Collection As XPCollection(Of CurrencyRate) = New XPCollection(Of CurrencyRate)(Session, CriteriaOperator.Parse("CurrencyName=? and IsMNB=True and GetDate(DateValid)<=?", CurrencyName, DateExecution.Date))
_CurrencyRate_Collection.Sorting.Add(New SortProperty("DateValid", DB.SortingDirection.Descending))
If _CurrencyRate_Collection.Count > 0 Then
For Each _CurrencyRateX In _CurrencyRate_Collection
If _CurrencyRateX.DateValid.Date = _DateExecution.Date Then
CurrencyRate = _CurrencyRateX.RateAverage
Exit For
End If
Exit For
Next
Else
Throw New Exception("*Nincs beállítva sem a pénzeszköz árfolyama sem az MNB árfolyama !")
End If
End If
End Set
End Property
Property ObjectCreated As Date
@@ -112,7 +131,7 @@ Public Class InvoiceCreditNoteHeader
SetPropertyValue("UserCreated", _UserCreated, value)
End Set
End Property
<RuleRequiredField("InvoiceCreditNoteHeader - PaymentOption", DefaultContexts.Save)> _
<RuleRequiredField("InvoiceCreditNoteHeader - PaymentOption", DefaultContexts.Save)>
Property PaymentOption As PaymentOption
Get
Return _PaymentOption
@@ -131,7 +150,7 @@ Public Class InvoiceCreditNoteHeader
SetPropertyValue("DatePayment", _DatePayment, value)
End Set
End Property
<Size(-1)> _
<Size(-1)>
Property Description As String
Get
Return _Description
@@ -140,10 +159,33 @@ Public Class InvoiceCreditNoteHeader
SetPropertyValue("Description", _Description, value)
End Set
End Property
''' <summary>
''' Árfolyam, amivel számolja !!!
''' </summary>
''' <returns></returns>
Property CurrencyRate As Double
Get
Return _CurrencyRate
End Get
Set(value As Double)
SetPropertyValue("CurrencyRate", _CurrencyRate, value)
End Set
End Property
''' <summary>
''' DEVIZA
''' </summary>
''' <returns></returns>
Property CurrencyName As CurrencyName
Get
Return _CurrencyName
End Get
Set(value As CurrencyName)
SetPropertyValue("CurrencyName", _CurrencyName, value)
End Set
End Property
'--==ReadOnly==--
<VisibleInListView(False)> _
<Association("InvoiceCreditNoteHeader-InvoiceCreditNoteRows", GetType(InvoiceCreditNoteRows))> _
<VisibleInListView(False)>
<Association("InvoiceCreditNoteHeader-InvoiceCreditNoteRows", GetType(InvoiceCreditNoteRows))>
ReadOnly Property InvoiceCreditNoteRows As XPCollection(Of InvoiceCreditNoteRows)
Get
Return GetCollection(Of InvoiceCreditNoteRows)("InvoiceCreditNoteRows")
@@ -120,6 +120,11 @@ Public Class InvoiceCreditNote_VC
End If
End Sub
''' <summary>
''' Jóváíró számla véglegesítése ÁRFOLYAM !!!
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
Private Sub aInvoiceCreditNoteHeader_Finalize_Execute(sender As Object, e As SimpleActionExecuteEventArgs) Handles aInvoiceCreditNoteHeader_Finalize.Execute
Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace
Dim _uow_lock As New UnitOfWork(_onew.Session.DataLayer)
@@ -177,7 +182,7 @@ Public Class InvoiceCreditNote_VC
.DatePayment = _InvoiceCreditNoteHeader.DatePayment
.PaymentOption = _InvoiceCreditNoteHeader.PaymentOption
.ShipmentOption = _OrderInParameters.ShipmentOption
.CurrencyName = _OrderInParameters.CurrencyName
.CurrencyName = _OrderInParameters.CurrencyName
If .PaymentOption.PayMode <> ePayMode.InCash Then
.BankInformation = _OrderInParameters.BankInformation
End If
@@ -213,7 +218,7 @@ Public Class InvoiceCreditNote_VC
_InvoiceHeader_Credited_Collection.Add(_InvoiceHeader_Credited)
'Számlasorok beszúrása
Dim _InvoiceCreditNoteRows_Collection As New XPCollection(Of InvoiceCreditNoteRows)(_ocur.Session, CriteriaOperator.Parse("InvoiceCreditNoteHeader=? AND FromInvoiceRows.OrderInRows.OrderInHeader.OrderInParameters=?", _
Dim _InvoiceCreditNoteRows_Collection As New XPCollection(Of InvoiceCreditNoteRows)(_ocur.Session, CriteriaOperator.Parse("InvoiceCreditNoteHeader=? AND FromInvoiceRows.OrderInRows.OrderInHeader.OrderInParameters=?",
_InvoiceCreditNoteHeader, _OrderInParameters))
If _InvoiceCreditNoteRows_Collection.Count > 0 Then
@@ -227,7 +232,15 @@ Public Class InvoiceCreditNote_VC
.DiscountPriceDEV = 0
.DiscountPriceHUF = 0
.ListPriceDEV = _InvoiceCreditNoteRows.PriceDEV
.ListPriceHUF = _InvoiceCreditNoteRows.PriceHUF
If _InvoiceCreditNoteHeader.CurrencyName.ShortName <> "HUF" Then
'A teljesítési naphoz kapcsolódó DEVIZAÁRFOLYAMMAL újraszámolás
.ListPriceHUF = Math.Round(.ListPriceDEV * _InvoiceCreditNoteHeader.CurrencyRate, 0, MidpointRounding.AwayFromZero)
Else
.ListPriceHUF = _InvoiceCreditNoteRows.PriceHUF
End If
.QTT = _InvoiceCreditNoteRows.QTT * (-1)
.QualityOption = _InvoiceCreditNoteRows.FromInvoiceRows.QualityOption
.ShortName = _InvoiceCreditNoteRows.FromInvoiceRows.ShortName
@@ -272,7 +285,7 @@ Public Class InvoiceCreditNote_VC
.WeightMode = _InvoiceCreditNoteRows.FromInvoiceRows.DeliveryNoteOutRows.StorageOutRowsInRows.StorageInRows.WeightMode
End If
Dim _StorageComputed As StorageComputed = _ocur.FindObject(Of StorageComputed)(CriteriaOperator.Parse("Products=? and Storage=?", _
Dim _StorageComputed As StorageComputed = _ocur.FindObject(Of StorageComputed)(CriteriaOperator.Parse("Products=? and Storage=?",
.Products, _StorageInHeader.Storage))
If _StorageComputed Is Nothing Then
@@ -381,10 +394,10 @@ Public Class InvoiceCreditNote_VC
.Saved_CustomersFrom_VATNumber = _InvoiceHeader.CustomersFrom.VATNumber.ToString
.Saved_CustomersFrom_VATNumberEU = _InvoiceHeader.CustomersFrom.VATNumberEU.ToString
.Saved_CustomersFrom_Bank_ShortName = _InvoiceHeader.BankInformation.FullBankAccount.ToString
.Saved_CustomersFrom_Bank_IBAN = _InvoiceHeader.BankInformation.IBAN.ToString
.Saved_CustomersFrom_Bank_SWIFT = _InvoiceHeader.BankInformation.SWIFT.ToString
.Saved_CustomersFrom_Bank_AccountNumber = _InvoiceHeader.BankInformation.AccountNumber.ToString
.Saved_CustomersFrom_Bank_ShortName = _InvoiceHeader.Saved_CustomersFrom_Bank_ShortName
.Saved_CustomersFrom_Bank_IBAN = _InvoiceHeader.Saved_CustomersFrom_Bank_IBAN
.Saved_CustomersFrom_Bank_SWIFT = _InvoiceHeader.Saved_CustomersFrom_Bank_SWIFT
.Saved_CustomersFrom_Bank_AccountNumber = _InvoiceHeader.Saved_CustomersFrom_Bank_AccountNumber
End With
CheckError: