404 lines
27 KiB
VB.net
404 lines
27 KiB
VB.net
Imports System
|
|
Imports System.ComponentModel
|
|
Imports System.Collections.Generic
|
|
Imports System.Diagnostics
|
|
Imports System.Text
|
|
|
|
Imports DevExpress.ExpressApp
|
|
Imports DevExpress.ExpressApp.Actions
|
|
Imports DevExpress.Persistent.Base
|
|
|
|
Imports DevExpress.ExpressApp.SystemModule
|
|
Imports System.IO
|
|
Imports DevExpress.Persistent.BaseImpl
|
|
Imports DevExpress.Data.Filtering
|
|
Imports DevExpress.ExpressApp.Win.Editors
|
|
Imports DevExpress.Xpo
|
|
Imports DevExpress.ExpressApp.Win.SystemModule
|
|
Imports DevExpress.ExpressApp.Editors
|
|
Imports Microsoft.VisualBasic.FileIO
|
|
Imports System.Threading
|
|
|
|
Public Class VivaldiVC
|
|
Inherits DevExpress.ExpressApp.ViewController
|
|
Dim _WaitFormClass As New WaitFormClass
|
|
|
|
Private _GridListEditor As GridListEditor
|
|
Public Sub New()
|
|
MyBase.New()
|
|
InitializeComponent()
|
|
RegisterActions(components)
|
|
End Sub
|
|
Protected Overrides Sub OnActivated()
|
|
MyBase.OnActivated()
|
|
_WaitFormClass = New WaitFormClass
|
|
|
|
If View.Id = "Vivaldi_InvoiceNameParameters_ListView" Then
|
|
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.ListViewProcessCurrentObjectController)()?.Active.SetItemValue("", False)
|
|
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.LinkUnlinkController)()?.Active.SetItemValue("", False)
|
|
Frame.GetController(Of DevExpress.ExpressApp.CloneObject.CloneObjectViewController)()?.Active.SetItemValue("", False)
|
|
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.NewObjectViewController)()?.Active.SetItemValue("", False)
|
|
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.ListViewProcessCurrentObjectController)()?.Active.SetItemValue("", False)
|
|
Frame.GetController(Of DevExpress.ExpressApp.Win.SystemModule.OpenObjectController)()?.Active.SetItemValue("", False)
|
|
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.ExportController)()?.Active.SetItemValue("", False)
|
|
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.RecordsNavigationController)()?.Active.SetItemValue("", False)
|
|
Frame.GetController(Of PrintingController)()?.Active.SetItemValue("", False)
|
|
End If
|
|
If View.Id = "Vivaldi_CustomerNameParameters_ListView" Then
|
|
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.ListViewProcessCurrentObjectController)()?.Active.SetItemValue("", False)
|
|
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.LinkUnlinkController)()?.Active.SetItemValue("", False)
|
|
Frame.GetController(Of DevExpress.ExpressApp.CloneObject.CloneObjectViewController)()?.Active.SetItemValue("", False)
|
|
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.NewObjectViewController)()?.Active.SetItemValue("", False)
|
|
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.ListViewProcessCurrentObjectController)()?.Active.SetItemValue("", False)
|
|
Frame.GetController(Of DevExpress.ExpressApp.Win.SystemModule.OpenObjectController)()?.Active.SetItemValue("", False)
|
|
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.ExportController)()?.Active.SetItemValue("", False)
|
|
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.RecordsNavigationController)()?.Active.SetItemValue("", False)
|
|
Frame.GetController(Of PrintingController)()?.Active.SetItemValue("", False)
|
|
End If
|
|
If View.Id = "Vivaldi_GLAccounts_ListView" Then
|
|
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.ListViewProcessCurrentObjectController)()?.Active.SetItemValue("", False)
|
|
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.LinkUnlinkController)()?.Active.SetItemValue("", False)
|
|
Frame.GetController(Of DevExpress.ExpressApp.CloneObject.CloneObjectViewController)()?.Active.SetItemValue("", False)
|
|
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.NewObjectViewController)()?.Active.SetItemValue("", False)
|
|
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.ListViewProcessCurrentObjectController)()?.Active.SetItemValue("", False)
|
|
Frame.GetController(Of DevExpress.ExpressApp.Win.SystemModule.OpenObjectController)()?.Active.SetItemValue("", False)
|
|
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.ExportController)()?.Active.SetItemValue("", False)
|
|
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.RecordsNavigationController)()?.Active.SetItemValue("", False)
|
|
Frame.GetController(Of PrintingController)()?.Active.SetItemValue("", False)
|
|
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.DeleteObjectsViewController)()?.Active.SetItemValue("", False)
|
|
End If
|
|
If View.Id = "GLHeader_GLRows_ListView_Accounts" Then
|
|
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.ListViewProcessCurrentObjectController)()?.Active.SetItemValue("", False)
|
|
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.LinkUnlinkController)()?.Active.SetItemValue("", False)
|
|
Frame.GetController(Of DevExpress.ExpressApp.CloneObject.CloneObjectViewController)()?.Active.SetItemValue("", False)
|
|
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.NewObjectViewController)()?.Active.SetItemValue("", False)
|
|
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.ListViewProcessCurrentObjectController)()?.Active.SetItemValue("", False)
|
|
Frame.GetController(Of DevExpress.ExpressApp.Win.SystemModule.OpenObjectController)()?.Active.SetItemValue("", False)
|
|
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.ExportController)()?.Active.SetItemValue("", False)
|
|
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.RecordsNavigationController)()?.Active.SetItemValue("", False)
|
|
Frame.GetController(Of PrintingController)()?.Active.SetItemValue("", False)
|
|
End If
|
|
If View.Id = "Vivaldi_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 = "Vivaldi_InvoiceNameParameters_ListView" Then
|
|
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.ListViewProcessCurrentObjectController)()?.Active.SetItemValue("", True)
|
|
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.LinkUnlinkController)()?.Active.SetItemValue("", True)
|
|
Frame.GetController(Of DevExpress.ExpressApp.CloneObject.CloneObjectViewController)()?.Active.SetItemValue("", True)
|
|
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.NewObjectViewController)()?.Active.SetItemValue("", True)
|
|
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.ListViewProcessCurrentObjectController)()?.Active.SetItemValue("", True)
|
|
Frame.GetController(Of DevExpress.ExpressApp.Win.SystemModule.OpenObjectController)()?.Active.SetItemValue("", True)
|
|
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.ExportController)()?.Active.SetItemValue("", True)
|
|
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.RecordsNavigationController)()?.Active.SetItemValue("", True)
|
|
End If
|
|
If View.Id = "Vivaldi_CustomerNameParameters_ListView" Then
|
|
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.ListViewProcessCurrentObjectController)()?.Active.SetItemValue("", True)
|
|
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.LinkUnlinkController)()?.Active.SetItemValue("", True)
|
|
Frame.GetController(Of DevExpress.ExpressApp.CloneObject.CloneObjectViewController)()?.Active.SetItemValue("", True)
|
|
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.NewObjectViewController)()?.Active.SetItemValue("", True)
|
|
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.ListViewProcessCurrentObjectController)()?.Active.SetItemValue("", True)
|
|
Frame.GetController(Of DevExpress.ExpressApp.Win.SystemModule.OpenObjectController)()?.Active.SetItemValue("", True)
|
|
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.ExportController)()?.Active.SetItemValue("", True)
|
|
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.RecordsNavigationController)()?.Active.SetItemValue("", True)
|
|
End If
|
|
If View.Id = "Vivaldi_GLAccounts_ListView" Then
|
|
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.ListViewProcessCurrentObjectController)()?.Active.SetItemValue("", True)
|
|
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.LinkUnlinkController)()?.Active.SetItemValue("", True)
|
|
Frame.GetController(Of DevExpress.ExpressApp.CloneObject.CloneObjectViewController)()?.Active.SetItemValue("", True)
|
|
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.NewObjectViewController)()?.Active.SetItemValue("", True)
|
|
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.ListViewProcessCurrentObjectController)()?.Active.SetItemValue("", True)
|
|
Frame.GetController(Of DevExpress.ExpressApp.Win.SystemModule.OpenObjectController)()?.Active.SetItemValue("", True)
|
|
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.ExportController)()?.Active.SetItemValue("", True)
|
|
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.RecordsNavigationController)()?.Active.SetItemValue("", True)
|
|
Frame.GetController(Of PrintingController)()?.Active.SetItemValue("", True)
|
|
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.DeleteObjectsViewController)()?.Active.SetItemValue("", True)
|
|
End If
|
|
If View.Id = "GLHeader_GLRows_ListView_Accounts" Then
|
|
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.ListViewProcessCurrentObjectController)()?.Active.SetItemValue("", True)
|
|
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.LinkUnlinkController)()?.Active.SetItemValue("", True)
|
|
Frame.GetController(Of DevExpress.ExpressApp.CloneObject.CloneObjectViewController)()?.Active.SetItemValue("", True)
|
|
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.NewObjectViewController)()?.Active.SetItemValue("", True)
|
|
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.ListViewProcessCurrentObjectController)()?.Active.SetItemValue("", True)
|
|
Frame.GetController(Of DevExpress.ExpressApp.Win.SystemModule.OpenObjectController)()?.Active.SetItemValue("", True)
|
|
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.ExportController)()?.Active.SetItemValue("", True)
|
|
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.RecordsNavigationController)()?.Active.SetItemValue("", True)
|
|
Frame.GetController(Of PrintingController)()?.Active.SetItemValue("", True)
|
|
End If
|
|
End Sub
|
|
Protected Overrides Sub OnViewControlsCreated()
|
|
MyBase.OnViewControlsCreated()
|
|
End Sub
|
|
Sub SaveAction_Executing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs)
|
|
End Sub
|
|
|
|
Private Sub aCreateGLAccounts_Vivaldi_Execute(ByVal sender As System.Object, ByVal e As DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs) Handles aCreateGLAccounts_Vivaldi.Execute
|
|
Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace
|
|
Dim _Vivaldi As Vivaldi = _onew.GetObject(TryCast(View.SelectedObjects(0), Vivaldi))
|
|
Dim _RowCount As Long = 0
|
|
Dim _GLAccount As GLAccounts
|
|
Dim _GLRows As GLRows
|
|
If _Vivaldi.ExcelFile Is Nothing Then Exit Sub
|
|
Dim _VAT As VAT
|
|
Dim _DocumentNumber As String = ""
|
|
Dim _DocumentNumber_Last As String = ""
|
|
Dim _DocumentNumber_Act As String = ""
|
|
Dim _MemoryStream As New MemoryStream
|
|
_Vivaldi.ExcelFile.SaveToStream(_MemoryStream)
|
|
Dim _StreamReader As New System.IO.StreamReader(_MemoryStream, System.Text.Encoding.GetEncoding(1250))
|
|
Dim _StrBuffer As String = ""
|
|
Dim columns As String()
|
|
Dim _Loadable As Boolean = False
|
|
|
|
_MemoryStream.Seek(0, System.IO.SeekOrigin.Begin)
|
|
_StrBuffer = _StreamReader.ReadToEnd()
|
|
_StreamReader.Close()
|
|
_MemoryStream.Close()
|
|
|
|
Using parser As New TextFieldParser(New StringReader(_StrBuffer))
|
|
parser.TextFieldType = FieldType.Delimited
|
|
parser.SetDelimiters(";")
|
|
While Not parser.EndOfData
|
|
Try
|
|
columns = parser.ReadFields()
|
|
_RowCount += 1
|
|
Catch ex As MalformedLineException
|
|
|
|
End Try
|
|
End While
|
|
End Using
|
|
Try
|
|
Frame.GetController(Of Validation.PersistenceValidationController)?.Active.SetItemValue("", False)
|
|
GLOBAL_HAS_Audit = False
|
|
|
|
Using parser As New TextFieldParser(New StringReader(_StrBuffer))
|
|
parser.TextFieldType = FieldType.Delimited
|
|
parser.SetDelimiters(";")
|
|
parser.TrimWhiteSpace = True
|
|
_WaitFormClass.Initwork(1, 1, _RowCount)
|
|
While Not parser.EndOfData
|
|
Try
|
|
columns = parser.ReadFields()
|
|
_WaitFormClass.DoWork()
|
|
If parser.LineNumber > 2 Or parser.LineNumber = -1 Then
|
|
_DocumentNumber = Replace(columns(3).ToString, " ", "")
|
|
'If _DocumentNumber = "F01-1-204/2014" Then
|
|
If _DocumentNumber_Last <> _DocumentNumber Then
|
|
If _DocumentNumber_Last <> "" Then
|
|
'// Az előző befejezése
|
|
If _GLAccount IsNot Nothing Then
|
|
_GLAccount.RecalculateTotal()
|
|
_onew.CommitChanges()
|
|
End If
|
|
End If
|
|
_Loadable = False
|
|
_GLAccount = _onew.FindObject(Of GLAccounts)(CriteriaOperator.Parse("CustomersFrom=? and DocumentNumber=? and PartnerType=0 and IsEditable=False", _Vivaldi.CustomersFrom, _DocumentNumber), True)
|
|
If _GLAccount Is Nothing Then
|
|
_Loadable = True
|
|
_GLAccount = _onew.CreateObject(Of GLAccounts)()
|
|
|
|
_GLAccount.ConnectInfo = _DocumentNumber
|
|
_GLAccount.CurrencyName = _onew.FindObject(Of CurrencyName)(CriteriaOperator.Parse("ShortName=?", columns(18).ToString))
|
|
If _GLAccount.CurrencyName Is Nothing Then _GLAccount.CurrencyName = _onew.FindObject(Of CurrencyName)(CriteriaOperator.Parse("ShortName='HUF'", columns(18).ToString))
|
|
_GLAccount.Customers = _Vivaldi.Customers_ATM
|
|
If columns(0).ToString = "KPS" Then _GLAccount.Customers = _Vivaldi.Customers_Cash
|
|
If columns(0).ToString = "HKS" Then _GLAccount.Customers = _Vivaldi.Customers_ATM
|
|
_GLAccount.CustomersFrom = _Vivaldi.CustomersFrom
|
|
If _GLAccount.Customers.Oid = _Vivaldi.Customers_Cash.Oid Then
|
|
_GLAccount.PaymentOption = _onew.FindObject(Of PaymentOption)(CriteriaOperator.Parse("ShortName='Készpénz'"))
|
|
Else
|
|
_GLAccount.PaymentOption = _onew.FindObject(Of PaymentOption)(CriteriaOperator.Parse("ShortName='Átutalás'"))
|
|
End If
|
|
_GLAccount.DateCreated = CDate(columns(5))
|
|
_GLAccount.DateExecution = CDate(columns(6))
|
|
_GLAccount.DatePayment = CDate(columns(7))
|
|
_GLAccount.DocumentNumber = _GLAccount.ConnectInfo
|
|
_GLAccount.GLDocumentType = eGLDocumentType.eGLAccount
|
|
_GLAccount.ImportedOther = _Vivaldi.Oid
|
|
_GLAccount.IsEditable = False
|
|
_GLAccount.IsStorno = False
|
|
_GLAccount.NoteHeader = ""
|
|
_GLAccount.PartnerType = ePartnerType.eReceivables
|
|
|
|
|
|
_GLAccount.VATAvowalType = eVATAvowalType.eGeneral
|
|
End If
|
|
|
|
_DocumentNumber_Last = _DocumentNumber
|
|
Else
|
|
|
|
End If
|
|
|
|
If _GLAccount IsNot Nothing And _Loadable = True Then
|
|
|
|
'Nettó sor
|
|
|
|
Dim _Rate As Double = 1
|
|
If Val(SQLNum(columns(17))) <> 0 Then
|
|
_Rate = Math.Round((Val(SQLNum(columns(13))) + Val(SQLNum(columns(16)))) / Val(SQLNum(columns(17))), 4, MidpointRounding.AwayFromZero)
|
|
End If
|
|
|
|
_GLRows = _onew.CreateObject(Of GLRows)()
|
|
_GLRows.GLHeader = _GLAccount
|
|
|
|
_GLRows.AmountHUF = Val(SQLNum(columns(13)))
|
|
If Val(SQLNum(columns(17))) <> 0 Then
|
|
_GLRows.AmountDEV = Math.Round(_GLRows.AmountHUF / _Rate, 4, MidpointRounding.AwayFromZero)
|
|
End If
|
|
_GLRows.ConnectInfo = _GLAccount.ConnectInfo
|
|
_GLRows.Controlling = Nothing
|
|
_GLRows.CostHolder = _Vivaldi.CostHolder
|
|
_GLRows.CostPlace = Nothing
|
|
If columns(11) = "K" Then
|
|
_GLRows.CreditChartOfAccounts = _onew.FindObject(Of ChartOfAccounts)(CriteriaOperator.Parse("AccountYear=? and AccountNumber=?", Year(_GLAccount.DateExecution), columns(8).ToString))
|
|
_GLRows.DebitChartOfAccounts = _GLAccount.Customers.CustomersGLParameters.GetChartOfAccounts(Year(_GLAccount.DateExecution), eVATMode.eOut)
|
|
ElseIf columns(11) = "T" Then
|
|
_GLRows.DebitChartOfAccounts = _onew.FindObject(Of ChartOfAccounts)(CriteriaOperator.Parse("AccountYear=? and AccountNumber=?", Year(_GLAccount.DateExecution), columns(8).ToString))
|
|
_GLRows.CreditChartOfAccounts = _GLAccount.Customers.CustomersGLParameters.GetChartOfAccounts(Year(_GLAccount.DateExecution), eVATMode.eOut)
|
|
End If
|
|
_GLRows.Customer = _GLAccount.Customers
|
|
_GLRows.DateExecution = _GLAccount.DateExecution
|
|
_GLRows.DateVAT = _GLAccount.DateExecution
|
|
_GLRows.GLRowsType = eGLRowsType.eNormal
|
|
_GLRows.GLRowsTypeVAT = eGLRowsTypeVAT.eNettoRow
|
|
_GLRows.NoteRows = columns(12).ToString
|
|
_GLRows.PartnerType = ePartnerType.eReceivables
|
|
_GLRows.RowIndex = Val(columns(4))
|
|
_GLRows.TransactionType = eTransactionType.eNotSet
|
|
_VAT = _onew.FindObject(Of VAT)(CriteriaOperator.Parse("VATBag=?", columns(14)))
|
|
|
|
|
|
If _VAT IsNot Nothing Then _GLRows.VAT = _VAT
|
|
If Val(columns(16)) > 0 Then
|
|
'ÁFA sor
|
|
_GLRows = _onew.CreateObject(Of GLRows)()
|
|
_GLRows.GLHeader = _GLAccount
|
|
_GLRows.AmountDEV = 0
|
|
_GLRows.AmountHUF = Val(SQLNum(columns(16)))
|
|
If Val(SQLNum(columns(17))) <> 0 Then
|
|
_GLRows.AmountDEV = Math.Round(_GLRows.AmountHUF / _Rate, 4, MidpointRounding.AwayFromZero)
|
|
End If
|
|
|
|
_GLRows.ConnectInfo = _GLAccount.ConnectInfo
|
|
_GLRows.CostHolder = _Vivaldi.CostHolder
|
|
|
|
If columns(11) = "K" Then
|
|
_GLRows.CreditChartOfAccounts = _onew.FindObject(Of ChartOfAccounts)(CriteriaOperator.Parse("AccountYear=? and AccountNumber=?", Year(_GLAccount.DateExecution), columns(15).ToString))
|
|
_GLRows.DebitChartOfAccounts = _GLAccount.Customers.CustomersGLParameters.GetChartOfAccounts(Year(_GLAccount.DateExecution), eVATMode.eOut)
|
|
ElseIf columns(11) = "T" Then
|
|
_GLRows.DebitChartOfAccounts = _onew.FindObject(Of ChartOfAccounts)(CriteriaOperator.Parse("AccountYear=? and AccountNumber=?", Year(_GLAccount.DateExecution), columns(15).ToString))
|
|
_GLRows.CreditChartOfAccounts = _GLAccount.Customers.CustomersGLParameters.GetChartOfAccounts(Year(_GLAccount.DateExecution), eVATMode.eOut)
|
|
End If
|
|
|
|
_GLRows.Customer = _GLAccount.Customers
|
|
_GLRows.DateExecution = _GLAccount.DateExecution
|
|
_GLRows.DateVAT = _GLAccount.DateExecution
|
|
|
|
_GLRows.GLRowsType = eGLRowsType.eNormal
|
|
_GLRows.GLRowsTypeVAT = eGLRowsTypeVAT.eVATRow
|
|
_GLRows.NoteRows = ""
|
|
_GLRows.PartnerType = ePartnerType.eReceivables
|
|
_GLRows.RowIndex = Val(columns(4)) + 1
|
|
If _VAT IsNot Nothing Then _GLRows.VAT = _VAT
|
|
End If
|
|
End If
|
|
End If
|
|
'End If
|
|
Catch ex As MalformedLineException
|
|
|
|
End Try
|
|
End While
|
|
If _GLAccount IsNot Nothing Then _GLAccount.RecalculateTotal()
|
|
_onew.CommitChanges()
|
|
_WaitFormClass.FinalWork()
|
|
End Using
|
|
Catch ex As Exception
|
|
MsgBox(ex.Message, MsgBoxStyle.Critical)
|
|
Finally
|
|
GLOBAL_HAS_Audit = True
|
|
Frame.GetController(Of Validation.PersistenceValidationController)?.Active.SetItemValue("", True)
|
|
End Try
|
|
End Sub
|
|
|
|
Private Sub aCheckName_Vivaldi_Execute(ByVal sender As System.Object, ByVal e As DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs) Handles aCheckName_Vivaldi.Execute
|
|
Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace
|
|
Dim _Vivaldi As Vivaldi = _onew.GetObject(TryCast(View.SelectedObjects(0), Vivaldi))
|
|
Dim _RowCount As Long = 0
|
|
Dim _GLAccount As GLAccounts
|
|
Dim _GLRows As GLRows
|
|
If _Vivaldi.ExcelFile Is Nothing Then Exit Sub
|
|
Dim _VAT As VAT
|
|
Dim _DocumentNumber As String
|
|
Dim _J As Long = 1
|
|
Dim _MemoryStream As New MemoryStream
|
|
_Vivaldi.ExcelFile.SaveToStream(_MemoryStream)
|
|
Dim _StreamReader As New System.IO.StreamReader(_MemoryStream, System.Text.Encoding.GetEncoding(1250))
|
|
Dim _StrBuffer As String = ""
|
|
_MemoryStream.Seek(0, System.IO.SeekOrigin.Begin)
|
|
_StrBuffer = _StreamReader.ReadToEnd()
|
|
_StreamReader.Close()
|
|
_MemoryStream.Close()
|
|
|
|
Using parser As New TextFieldParser(New StringReader(_StrBuffer))
|
|
parser.TextFieldType = FieldType.Delimited
|
|
parser.SetDelimiters(";")
|
|
While Not parser.EndOfData
|
|
Try
|
|
Dim columns As String() = parser.ReadFields()
|
|
_RowCount += 1
|
|
Catch ex As MalformedLineException
|
|
|
|
End Try
|
|
End While
|
|
End Using
|
|
Try
|
|
Frame.GetController(Of Validation.PersistenceValidationController)?.Active.SetItemValue("", False)
|
|
GLOBAL_HAS_Audit = False
|
|
|
|
Using parser As New TextFieldParser(New StringReader(_StrBuffer))
|
|
parser.TextFieldType = FieldType.Delimited
|
|
parser.SetDelimiters(";")
|
|
parser.TrimWhiteSpace = True
|
|
_WaitFormClass.Initwork(1, 1, _RowCount)
|
|
While Not parser.EndOfData
|
|
Try
|
|
Dim columns As String() = parser.ReadFields()
|
|
_WaitFormClass.DoWork()
|
|
If parser.LineNumber > 2 Then
|
|
_DocumentNumber = Replace(columns(3).ToString, " ", "")
|
|
_GLAccount = _onew.FindObject(Of GLAccounts)(CriteriaOperator.Parse("CustomersFrom=? and DocumentNumber=? and PartnerType=0", _Vivaldi.CustomersFrom, _DocumentNumber), True)
|
|
If _GLAccount Is Nothing Then
|
|
Debug.Print(String.Format("{0:0000}. {1}", _J, _DocumentNumber))
|
|
_J += 1
|
|
End If
|
|
End If
|
|
Catch ex As MalformedLineException
|
|
|
|
End Try
|
|
End While
|
|
_WaitFormClass.FinalWork()
|
|
End Using
|
|
Catch ex As Exception
|
|
MsgBox(ex.Message, MsgBoxStyle.Critical)
|
|
Finally
|
|
GLOBAL_HAS_Audit = True
|
|
Frame.GetController(Of Validation.PersistenceValidationController)?.Active.SetItemValue("", True)
|
|
End Try
|
|
End Sub
|
|
|
|
Private Sub aRemoveGLAccounts_Vivaldi_Execute(sender As System.Object, e As DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs) Handles aRemoveGLAccounts_Vivaldi.Execute
|
|
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
|
|
Dim _uow As New UnitOfWork(_ocur.Session.DataLayer)
|
|
Dim _Vivaldi As Vivaldi = TryCast(View.SelectedObjects(0), Vivaldi)
|
|
Dim _GLAccounts_Collection As New XPCollection(Of GLAccounts)(_uow, CriteriaOperator.Parse("ImportedOther=?", _Vivaldi.Oid))
|
|
|
|
_uow.Delete(_GLAccounts_Collection)
|
|
_uow.CommitChanges()
|
|
|
|
Frame.GetController(Of RefreshController).RefreshAction.DoExecute()
|
|
End Sub
|
|
End Class |