From 42147da6b727630b0f1d84fe152cf9c4175d7356 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Szab=C3=B3=20Iv=C3=A1n?= Date: Mon, 7 Sep 2020 22:56:48 +0200 Subject: [PATCH] =?UTF-8?q?DEBRA=20sz=C3=A1ll=C3=ADt=C3=B3i=20sz=C3=A1mla?= =?UTF-8?q?=20felad=C3=A1s=20VOL2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Migration/Migration_VC.Designer.cs | 1 + .../BusinessObjects/Migration/Migration_VC.cs | 537 +++++++++++++++++- .../Migration/Migration_VC.resx | 4 +- .../Model.DesignedDiffs.Localization.hu.xafml | 5 + .../Model.DesignedDiffs.xafml | 19 + .../Controllers/VATReport_VC.cs | 34 +- .../Model.DesignedDiffs.Localization.hu.xafml | 2 + Nuvolar.Module/Model.DesignedDiffs.xafml | 10 +- Nuvolar.Module/My Project/AssemblyInfo.vb | 2 +- Nuvolar.Module/My Project/licenses.licx | 2 + 10 files changed, 584 insertions(+), 32 deletions(-) diff --git a/Nuvolar.Module.CSharp/BusinessObjects/Migration/Migration_VC.Designer.cs b/Nuvolar.Module.CSharp/BusinessObjects/Migration/Migration_VC.Designer.cs index f713a53..ab4c635 100644 --- a/Nuvolar.Module.CSharp/BusinessObjects/Migration/Migration_VC.Designer.cs +++ b/Nuvolar.Module.CSharp/BusinessObjects/Migration/Migration_VC.Designer.cs @@ -67,6 +67,7 @@ this.aMigrateInvoiceIn.TargetViewType = DevExpress.ExpressApp.ViewType.DetailView; this.aMigrateInvoiceIn.ToolTip = null; this.aMigrateInvoiceIn.TypeOfView = typeof(DevExpress.ExpressApp.DetailView); + this.aMigrateInvoiceIn.Execute += new DevExpress.ExpressApp.Actions.SimpleActionExecuteEventHandler(this.aMigrateInvoiceIn_Execute); // // Migration_VC // diff --git a/Nuvolar.Module.CSharp/BusinessObjects/Migration/Migration_VC.cs b/Nuvolar.Module.CSharp/BusinessObjects/Migration/Migration_VC.cs index 52f05bf..7cd5a9e 100644 --- a/Nuvolar.Module.CSharp/BusinessObjects/Migration/Migration_VC.cs +++ b/Nuvolar.Module.CSharp/BusinessObjects/Migration/Migration_VC.cs @@ -46,6 +46,7 @@ namespace Nuvolar.Module.BusinessObjects.Migration if (_MigrationParameters.SQLType == eSQLType.MSSQL) { Sync_XPObjectType_MSSQL_MySQL(_ocur); + Sync_Country_MSSQL_MySQL(_ocur); //Sync_HCategory_ChartOfAccounts_MSSQL_MySQL(_ocur); //Sync_ChartOfAccounts_MSSQL_MySQL(_ocur); //Sync_ChartOfAccountsYear_MSSQL_MySQL(_ocur); @@ -59,13 +60,14 @@ namespace Nuvolar.Module.BusinessObjects.Migration //Sync_CustomersGLParametersYear_MSSQL_MySQL(_ocur); //Sync_Party_CustomersFrom_MSSQL_MySQL(_ocur); - Sync_PaymentOption_MSSQL_MySQL(_ocur); + //Sync_PaymentOption_MSSQL_MySQL(_ocur); //Sync_LiquidAssets_MSSQL_MySQL(_ocur); } } private void Sync_XPObjectType_MSSQL_MySQL(XPObjectSpace _ocur) { + MakeObjectType(_ocur); MakeObjectType(_ocur); MakeObjectType(_ocur); MakeObjectType(_ocur); @@ -107,7 +109,105 @@ namespace Nuvolar.Module.BusinessObjects.Migration } return _return; } + private void Sync_Country_MSSQL_MySQL(XPObjectSpace _ocur) + { + MigrationParameters _MigrationParameters = View.SelectedObjects[0] as MigrationParameters; + _ocur.Session.ExecuteNonQuery("SET FOREIGN_KEY_CHECKS=0"); + string _ConnectionStringMSSQL = string.Format(" User ID={0}; " + + " Password={1};" + + " Pooling=false;" + + " Data Source={2};" + + " Initial Catalog={3}", + _MigrationParameters.SQLUser, + _MigrationParameters.SQLPassword, + _MigrationParameters.SQLServer, + _MigrationParameters.SQLDatabase); + + + SqlConnection _SqlConnection = new SqlConnection(_ConnectionStringMSSQL); + MySqlConnection _MySqlConnection = new MySqlConnection(Nuvolar.Module.GeneralFunction.GLOBAL_ConnectionString.Replace("XpoProvider=MySql;", "")); + + _SqlConnection.Open(); + _MySqlConnection.Open(); + if (_SqlConnection.State == ConnectionState.Open) + { + + + string _SQL = " select t1.* " + + " from Country t1 " + + " WHERE t1.GCRecord is null"; + SqlCommand _SqlCommand = new SqlCommand(_SQL, _SqlConnection); + SqlDataReader _SqlDataReader = _SqlCommand.ExecuteReader(); + + int _ObjectType_OID = GetObjectTypeOID(_ocur); + + if (_SqlDataReader.HasRows) + { + while (_SqlDataReader.Read()) + { + string _MySQL = "SELECT count(*) FROM Country WHERE Oid=@Oid"; + using (MySqlCommand _MySqlCommand = new MySqlCommand() { CommandText = _MySQL, Connection = _MySqlConnection }) + { + _MySqlCommand.Parameters.Add(new MySqlParameter() { ParameterName = "@Oid", DbType = DbType.Guid, Value = _SqlDataReader["Oid"] }); + + object _Found = _MySqlCommand.ExecuteScalar(); + + if (_Found != null) + { + double _F; + IsNumeric(_Found, out _F); + if (_F == 0) + { + + _MySQL = " SET FOREIGN_KEY_CHECKS=0;" + + " INSERT INTO Country (Oid,Name,PhoneCode,ObjectType,EUMember,ISOCode)" + + " SELECT @Oid,@Name,@PhoneCode,@ObjectType,@EUMember,@ISOCode"; + using (MySqlCommand _MySqlCommand_Insert = new MySqlCommand() { CommandText = _MySQL, Connection = _MySqlConnection }) + { + _MySqlCommand_Insert.Parameters.Add(new MySqlParameter() { ParameterName = "@Oid", DbType = DbType.Guid, Value = _SqlDataReader["Oid"] }); + _MySqlCommand_Insert.Parameters.Add(new MySqlParameter() { ParameterName = "@Name", DbType = DbType.String, Value = _SqlDataReader["Name"] }); + _MySqlCommand_Insert.Parameters.Add(new MySqlParameter() { ParameterName = "@PhoneCode", DbType = DbType.String, Value = _SqlDataReader["PhoneCode"] }); + _MySqlCommand_Insert.Parameters.Add(new MySqlParameter() { ParameterName = "@ObjectType", DbType = DbType.Int64, Value = _ObjectType_OID }); + //_MySqlCommand_Insert.Parameters.Add(new MySqlParameter() { ParameterName = "@Name_GB", DbType = DbType.String, Value = _SqlDataReader["Name_GB"] }); + //_MySqlCommand_Insert.Parameters.Add(new MySqlParameter() { ParameterName = "@ShortName", DbType = DbType.String, Value = _SqlDataReader["ShortName"] }); + _MySqlCommand_Insert.Parameters.Add(new MySqlParameter() { ParameterName = "@EUMember", DbType = DbType.Boolean, Value = _SqlDataReader["EUMember"] }); + _MySqlCommand_Insert.Parameters.Add(new MySqlParameter() { ParameterName = "@ISOCode", DbType = DbType.String, Value = _SqlDataReader["ISOCode"] }); + + + + _MySqlCommand_Insert.ExecuteNonQuery(); + } + } + else // Ha már VAN + { + //_MySQL = " SET FOREIGN_KEY_CHECKS=0;" + + // " UPDATE HCategory SET Name=@Name," + + // " Parent=@Parent " + + // " WHERE Oid=@Oid"; + //using (MySqlCommand _MySqlCommand_Update = new MySqlCommand() { CommandText = _MySQL, Connection = _MySqlConnection }) + //{ + + // _MySqlCommand_Update.Parameters.Add(new MySqlParameter() { ParameterName = "@Oid", DbType = DbType.Guid, Value = _SqlDataReader["Oid"] }); + // _MySqlCommand_Update.Parameters.Add(new MySqlParameter() { ParameterName = "@Parent", DbType = DbType.Guid, Value = _SqlDataReader["Parent"] }); + // _MySqlCommand_Update.Parameters.Add(new MySqlParameter() { ParameterName = "@Name", DbType = DbType.String, Value = _SqlDataReader["Name"] }); + + // _MySqlCommand_Update.ExecuteNonQuery(); + //} + + } + } + } + + } + } + + + } + _SqlConnection.Close(); + _MySqlConnection.Close(); + _ocur.Session.ExecuteNonQuery("SET FOREIGN_KEY_CHECKS=1"); + } private void Sync_HCategory_ChartOfAccounts_MSSQL_MySQL(XPObjectSpace _ocur) { MigrationParameters _MigrationParameters = View.SelectedObjects[0] as MigrationParameters; @@ -1135,9 +1235,9 @@ namespace Nuvolar.Module.BusinessObjects.Migration { _MySQL = " SET FOREIGN_KEY_CHECKS=0;" + - " INSERT INTO LiquidAssets (Oid,ShortName,Description,LiquidAssetsType,Description,Active,CurrencyName,IsRounding," + + " INSERT INTO LiquidAssets (Oid,ShortName,Description,CustomerFrom,LiquidAssetsType,Active,CurrencyName,IsRounding," + " NoPrint,NoDocumentNumber,NoTimeCheck)" + - " SELECT @Oid,@ShortName,@Description,@LiquidAssetsType,@Description,@Active,@CurrencyName,@IsRounding," + + " SELECT @Oid,@ShortName,@Description,@CustomerFrom,@LiquidAssetsType,@Active,@CurrencyName,@IsRounding," + " @NoPrint,@NoDocumentNumber,@NoTimeCheck;"; using (MySqlCommand _MySqlCommand_Insert = new MySqlCommand() { CommandText = _MySQL, Connection = _MySqlConnection }) { @@ -1145,6 +1245,18 @@ namespace Nuvolar.Module.BusinessObjects.Migration _MySqlCommand_Insert.Parameters.Add(new MySqlParameter() { ParameterName = "@ShortName", DbType = DbType.String, Value = _SqlDataReader["ShortName"] }); _MySqlCommand_Insert.Parameters.Add(new MySqlParameter() { ParameterName = "@Description", DbType = DbType.String, Value = _SqlDataReader["Description"] }); + _MySqlCommand_Insert.Parameters.Add(new MySqlParameter() { ParameterName = "@CustomerFrom", DbType = DbType.Guid, Value = _SqlDataReader["CustomerFrom"] }); + _MySqlCommand_Insert.Parameters.Add(new MySqlParameter() { ParameterName = "@LiquidAssetsType", DbType = DbType.String, Value = _SqlDataReader["LiquidAssetsType"] }); + _MySqlCommand_Insert.Parameters.Add(new MySqlParameter() { ParameterName = "@Active", DbType = DbType.Boolean, Value = _SqlDataReader["Active"] }); + + _MySqlCommand_Insert.Parameters.Add(new MySqlParameter() { ParameterName = "@CurrencyName", DbType = DbType.Guid, Value = _SqlDataReader["CurrencyName"] }); + _MySqlCommand_Insert.Parameters.Add(new MySqlParameter() { ParameterName = "@IsRounding", DbType = DbType.Boolean, Value = _SqlDataReader["IsRounding"] }); + _MySqlCommand_Insert.Parameters.Add(new MySqlParameter() { ParameterName = "@NoPrint", DbType = DbType.Boolean, Value = _SqlDataReader["NoPrint"] }); + + _MySqlCommand_Insert.Parameters.Add(new MySqlParameter() { ParameterName = "@NoDocumentNumber", DbType = DbType.Boolean, Value = _SqlDataReader["NoDocumentNumber"] }); + _MySqlCommand_Insert.Parameters.Add(new MySqlParameter() { ParameterName = "@NoTimeCheck", DbType = DbType.Boolean, Value = _SqlDataReader["NoTimeCheck"] }); + + _MySqlCommand_Insert.ExecuteNonQuery(); } } @@ -1172,6 +1284,93 @@ namespace Nuvolar.Module.BusinessObjects.Migration } + } + _SqlConnection.Close(); + _MySqlConnection.Close(); + _ocur.Session.ExecuteNonQuery("SET FOREIGN_KEY_CHECKS=1"); + } + private void Sync_CurrencyName_MSSQL_MySQL(XPObjectSpace _ocur) + { + MigrationParameters _MigrationParameters = View.SelectedObjects[0] as MigrationParameters; + _ocur.Session.ExecuteNonQuery("SET FOREIGN_KEY_CHECKS=0"); + string _ConnectionStringMSSQL = string.Format(" User ID={0}; " + + " Password={1};" + + " Pooling=false;" + + " Data Source={2};" + + " Initial Catalog={3}", + _MigrationParameters.SQLUser, + _MigrationParameters.SQLPassword, + _MigrationParameters.SQLServer, + _MigrationParameters.SQLDatabase); + + + + SqlConnection _SqlConnection = new SqlConnection(_ConnectionStringMSSQL); + MySqlConnection _MySqlConnection = new MySqlConnection(Nuvolar.Module.GeneralFunction.GLOBAL_ConnectionString.Replace("XpoProvider=MySql;", "")); + + _SqlConnection.Open(); + _MySqlConnection.Open(); + if (_SqlConnection.State == ConnectionState.Open) + { + + + string _SQL = " select t1.* " + + " from CurrencyName t1 " + + " WHERE t1.GCRecord is null"; + SqlCommand _SqlCommand = new SqlCommand(_SQL, _SqlConnection); + SqlDataReader _SqlDataReader = _SqlCommand.ExecuteReader(); + + if (_SqlDataReader.HasRows) + { + while (_SqlDataReader.Read()) + { + string _MySQL = "SELECT count(*) FROM CurrencyName WHERE ShortName=@Shortname"; + using (MySqlCommand _MySqlCommand = new MySqlCommand() { CommandText = _MySQL, Connection = _MySqlConnection }) + { + _MySqlCommand.Parameters.Add(new MySqlParameter() { ParameterName = "@Shortname", DbType = DbType.Guid, Value = _SqlDataReader["ShortName"] }); + + object _Found = _MySqlCommand.ExecuteScalar(); + + if (_Found != null) + { + double _F; + IsNumeric(_Found, out _F); + if (_F == 0) + { + + _MySQL = " SET FOREIGN_KEY_CHECKS=0;" + + " INSERT INTO CurrencyName (Oid,ShortName)" + + " SELECT @Oid,@ShortName,@Description;"; + using (MySqlCommand _MySqlCommand_Insert = new MySqlCommand() { CommandText = _MySQL, Connection = _MySqlConnection }) + { + _MySqlCommand_Insert.Parameters.Add(new MySqlParameter() { ParameterName = "@Oid", DbType = DbType.Guid, Value = _SqlDataReader["Oid"] }); + _MySqlCommand_Insert.Parameters.Add(new MySqlParameter() { ParameterName = "@ShortName", DbType = DbType.String, Value = _SqlDataReader["ShortName"] }); + + + _MySqlCommand_Insert.ExecuteNonQuery(); + } + } + else // Ha már VAN + { + _MySQL = " SET FOREIGN_KEY_CHECKS=0;" + + " UPDATE CurrencyName SET Oid=@Oid" + + " WHERE ShortName=@ShortName"; + using (MySqlCommand _MySqlCommand_Update = new MySqlCommand() { CommandText = _MySQL, Connection = _MySqlConnection }) + { + _MySqlCommand_Update.Parameters.Add(new MySqlParameter() { ParameterName = "@Oid", DbType = DbType.Guid, Value = _SqlDataReader["Oid"] }); + _MySqlCommand_Update.Parameters.Add(new MySqlParameter() { ParameterName = "@ShortName", DbType = DbType.String, Value = _SqlDataReader["ShortName"] }); + + _MySqlCommand_Update.ExecuteNonQuery(); + } + + } + } + } + + } + } + + } _SqlConnection.Close(); _MySqlConnection.Close(); @@ -1293,6 +1492,12 @@ namespace Nuvolar.Module.BusinessObjects.Migration XPObjectSpace _ocur = View.ObjectSpace as XPObjectSpace; Sync_Invoice_Out_By_Date_MSSQL_MySQL(_ocur); } + private void aMigrateInvoiceIn_Execute(object sender, SimpleActionExecuteEventArgs e) + { + MigrationParameters _MigrationParameters = View.SelectedObjects[0] as MigrationParameters; + XPObjectSpace _ocur = View.ObjectSpace as XPObjectSpace; + Sync_Invoice_In_By_Date_MSSQL_MySQL(_ocur); + } #region Vevői számlák private void Sync_Invoice_Out_By_Date_MSSQL_MySQL(XPObjectSpace _ocur) @@ -1536,23 +1741,23 @@ namespace Nuvolar.Module.BusinessObjects.Migration try { - - _GLRows = new GLRows(_uow); - _GLRows.GLHeader = _GLAccounts; - _GLRows.NoteRows = "ÉRTÉKESÍTÉS ÁFA"; - _GLRows.DebitChartOfAccounts = _uow.GetObjectByKey(_SqlDataReader["ChartOfAccountsT"]); - _GLRows.CreditChartOfAccounts = _uow.GetObjectByKey(_SqlDataReader["ChartOfAccountsK"]); - _GLRows.AmountHUF = (double)_SqlDataReader["AmountVATHUF"]; - _GLRows.AmountDEV = (double)_SqlDataReader["AmountVATDEV"]; - _GLRows.VAT = _uow.GetObjectByKey(_SqlDataReader["VAT"]); - _GLRows.GLRowsTypeVAT = eGLRowsTypeVAT.eVATRow; - _GLRows.GLRowsType = eGLRowsType.eNormal; - _GLRows.PartnerType = ePartnerType.eReceivables; - _GLRows.Customer = _GLAccounts.Customers; - _GLRows.ConnectInfo = _GLAccounts.ConnectInfo; - _GLRows.DateVAT = _GLAccounts.DateExecution; - _GLRows.DateExecution = _GLAccounts.DateExecution; - _uow.CommitChanges(); + + _GLRows = new GLRows(_uow); + _GLRows.GLHeader = _GLAccounts; + _GLRows.NoteRows = "ÉRTÉKESÍTÉS ÁFA"; + _GLRows.DebitChartOfAccounts = _uow.GetObjectByKey(_SqlDataReader["ChartOfAccountsT"]); + _GLRows.CreditChartOfAccounts = _uow.GetObjectByKey(_SqlDataReader["ChartOfAccountsK"]); + _GLRows.AmountHUF = (double)_SqlDataReader["AmountVATHUF"]; + _GLRows.AmountDEV = (double)_SqlDataReader["AmountVATDEV"]; + _GLRows.VAT = _uow.GetObjectByKey(_SqlDataReader["VAT"]); + _GLRows.GLRowsTypeVAT = eGLRowsTypeVAT.eVATRow; + _GLRows.GLRowsType = eGLRowsType.eNormal; + _GLRows.PartnerType = ePartnerType.eReceivables; + _GLRows.Customer = _GLAccounts.Customers; + _GLRows.ConnectInfo = _GLAccounts.ConnectInfo; + _GLRows.DateVAT = _GLAccounts.DateExecution; + _GLRows.DateExecution = _GLAccounts.DateExecution; + _uow.CommitChanges(); } catch (Exception ex) { @@ -1568,7 +1773,7 @@ namespace Nuvolar.Module.BusinessObjects.Migration } } - + } GLFunctions.ReconfigurePCI(_uow, _GLAccounts.CustomersFrom, _GLAccounts.Customers, _GLAccounts.PartnerType, _GLAccounts.ConnectInfo); @@ -1808,6 +2013,296 @@ namespace Nuvolar.Module.BusinessObjects.Migration _MySqlConnection.Close(); _ocur.Session.ExecuteNonQuery("SET FOREIGN_KEY_CHECKS=1"); } + private void Sync_Address_One_MSSQL_MySQL(XPObjectSpace _ocur, string _Address_OID) + { + + } + #endregion + + #region Szállítói számlák + private void Sync_Invoice_In_By_Date_MSSQL_MySQL(XPObjectSpace _ocur) + { + MigrationParameters _MigrationParameters = View.SelectedObjects[0] as MigrationParameters; + WaitFormClass _WaitFormClass = new WaitFormClass(); + UnitOfWork _uow_log = new UnitOfWork(_ocur.Session.DataLayer); + User _CurrentUser = _uow_log.GetObjectByKey(SecuritySystem.CurrentUserId); + + string _ConnectionStringMSSQL = string.Format(" User ID={0}; " + + " Password={1};" + + " Pooling=false;" + + " Data Source={2};" + + " Initial Catalog={3}", + _MigrationParameters.SQLUser, + _MigrationParameters.SQLPassword, + _MigrationParameters.SQLServer, + _MigrationParameters.SQLDatabase); + string _SQL = ""; + object _Count = null; + + SqlConnection _SqlConnection = new SqlConnection(_ConnectionStringMSSQL); + MySqlConnection _MySqlConnection = new MySqlConnection(Nuvolar.Module.GeneralFunction.GLOBAL_ConnectionString.Replace("XpoProvider=MySql;", "")); + + _SqlConnection.Open(); + _MySqlConnection.Open(); + if (_SqlConnection.State == ConnectionState.Open) + { + + _SQL = string.Format(" select count(*) FROM GLHeader t1 join GLAccounts t2 on t1.Oid = t2.Oid WHERE t1.DateExecution>='{0}' AND t1.DateExecution <='{1}'", + _MigrationParameters.DateFrom.Date.ToString("yyyy-MM-dd"), _MigrationParameters.DateTo.Date.ToString("yyyy-MM-dd")); + using (SqlCommand _SqlCommand = new SqlCommand(_SQL, _SqlConnection)) + { + _Count = _SqlCommand.ExecuteScalar(); + } + + if (_Count != null) + { + _SQL = string.Format(" SELECT t1.Oid FROM GLHeader t1 join GLAccounts t2 on t1.Oid = t2.Oid " + + " WHERE t1.DateExecution>='{0}' AND t1.DateExecution <='{1}' AND t1.GCRecord IS NULL AND t1.IsEditable=False", + _MigrationParameters.DateFrom.Date.ToString("yyyy-MM-dd"), _MigrationParameters.DateTo.Date.ToString("yyyy-MM-dd")); + + using (SqlCommand _SqlCommand = new SqlCommand(_SQL, _SqlConnection)) + { + SqlDataReader _SqlDataReader = _SqlCommand.ExecuteReader(); + + if (_SqlDataReader.HasRows) + { + _WaitFormClass.Initwork(1, 1, (int)_Count); + while (_SqlDataReader.Read()) + { + try + { + this.Sync_Invoice_In_MSSQL_MySQL(_ocur, _SqlDataReader["Oid"].ToString().Trim()); + _WaitFormClass.DoWork(); + } + catch (Exception ex) + { + MigrationLog _MigrationLog = new MigrationLog(_uow_log); + _MigrationLog.UserCreated = _CurrentUser; + _MigrationLog.ShortName = string.Format("ERROR INVOICE IN : GLHeader {0}", _SqlDataReader["Oid"].ToString().Trim()); + _MigrationLog.DateCreated = DateTime.Now; + _MigrationLog.Description = ex.Message; + _uow_log.CommitChanges(); + } + } + _WaitFormClass.FinalWork(); + } + } + } + } + _SqlConnection.Close(); + _MySqlConnection.Close(); + } + private void Sync_Invoice_In_MSSQL_MySQL(XPObjectSpace _ocur,string _GLHeader_OID) + { + MigrationParameters _MigrationParameters = View.SelectedObjects[0] as MigrationParameters; + _ocur.Session.ExecuteNonQuery("SET FOREIGN_KEY_CHECKS=0"); + UnitOfWork _uow = new UnitOfWork(_ocur.Session.DataLayer); + UnitOfWork _uow_log = new UnitOfWork(_ocur.Session.DataLayer); + User _CurrentUser = _uow_log.GetObjectByKey(SecuritySystem.CurrentUserId); + string _ConnectionStringMSSQL = string.Format(" User ID={0}; " + + " Password={1};" + + " Pooling=true;" + + " Data Source={2};" + + " Initial Catalog={3}", + _MigrationParameters.SQLUser, + _MigrationParameters.SQLPassword, + _MigrationParameters.SQLServer, + _MigrationParameters.SQLDatabase); + + + + SqlConnection _SqlConnection = new SqlConnection(_ConnectionStringMSSQL); + MySqlConnection _MySqlConnection = new MySqlConnection(Nuvolar.Module.GeneralFunction.GLOBAL_ConnectionString.Replace("XpoProvider=MySql;", "")); + + _SqlConnection.Open(); + _MySqlConnection.Open(); + if (_SqlConnection.State == ConnectionState.Open) + { + + GLAccounts _GLAccounts = null; + GLRows _GLRows = null; + + /// Számla fejléc adatok rögzítése + string _SQL = string.Format(" SELECT t1.Oid,t1.DocumentNumber,t1.PaymentOption,t1.ConnectInfo,t1.CustomersFrom,t1.Customers,t1.DateCreated,t1.DateExecution,t1.DatePayment,t1.TotalBruttoHUF,t1.TotalBruttoDEV," + + " t1.CurrencyName" + + " FROM GLHeader t1 JOIN GLAccounts t2 on t1.Oid=t2.Oid" + + " WHERE t1.GCRecord is null AND t1.Oid='{0}' AND t1.IsEditable=False", _GLHeader_OID); + using (SqlCommand _SqlCommand = new SqlCommand(_SQL, _SqlConnection)) + { + using (SqlDataReader _SqlDataReader = _SqlCommand.ExecuteReader()) + { + if (_SqlDataReader.HasRows) + { + while (_SqlDataReader.Read()) + { + this.Sync_Party_Customers_One_MSSQL_MySQL(_ocur, _SqlDataReader["Customers"].ToString().Trim()); + + try + { + + + _GLAccounts = _uow.FindObject(CriteriaOperator.Parse("Customers.Oid = ? AND CustomersFrom.Oid = ? AND PartnerType = 0 AND DocumentNumber = ? AND ConnectInfo = ?", + _SqlDataReader["Customers"], _SqlDataReader["CustomersFrom"], _SqlDataReader["DocumentNumber"], _SqlDataReader["ConnectInfo"])); + if (_GLAccounts == null) + { + _GLAccounts = new GLAccounts(_uow); + } + + _GLAccounts.PartnerType = ePartnerType.eReceivables; + _GLAccounts.DocumentNumber = _SqlDataReader["DocumentNumber"].ToString().Trim(); + _GLAccounts.ConnectInfo = _SqlDataReader["ConnectInfo"].ToString().Trim(); + _GLAccounts.Customers = _uow.GetObjectByKey(_SqlDataReader["Customers"]); + _GLAccounts.CustomersFrom = _uow.GetObjectByKey(_SqlDataReader["CustomersFrom"]); + _GLAccounts.CurrencyName = _uow.GetObjectByKey(_SqlDataReader["CurrencyName"]); + _GLAccounts.IsEditable = false; + _GLAccounts.DateCreated = (DateTime)_SqlDataReader["DateCreated"]; + _GLAccounts.DateExecution = (DateTime)_SqlDataReader["DateExecution"]; + _GLAccounts.DatePayment = (DateTime)_SqlDataReader["DatePayment"]; + _GLAccounts.AmountHUFBrutto = (double)_SqlDataReader["TotalBruttoHUF"]; + _GLAccounts.AmountDEVBrutto = (double)_SqlDataReader["TotalBruttoDEV"]; + _GLAccounts.PaymentOption = _uow.GetObjectByKey(_SqlDataReader["PaymentOption"]); + _uow.CommitChanges(); + } + catch (Exception ex) + { + MigrationLog _MigrationLog = new MigrationLog(_uow_log); + _MigrationLog.UserCreated = _CurrentUser; + _MigrationLog.ShortName = string.Format("ERROR GLAccounts: {0}", _SqlDataReader["DocumentNumber"].ToString().Trim()); + _MigrationLog.DateCreated = DateTime.Now; + _MigrationLog.Description = ex.Message; + _uow_log.CommitChanges(); + } + } + } + } + } + + _uow.ExecuteNonQuery(string.Format("DELETE FROM GLDetails WHERE GLRows IN (SELECT Oid FROM GLRows WHERE GLHeader = '{0}')", _GLAccounts.Oid.ToString())); + _uow.ExecuteNonQuery(string.Format("DELETE FROM GLRows WHERE GLHeader = '{0}'", _GLAccounts.Oid.ToString())); + /// Számla nettó sorok rögzítése + _SQL = string.Format(" SELECT sum(t1.SumPriceHUF) AS SumPriceHUF,sum(t1.SumPriceDEV) AS SumPriceDEV,t1.VAT,t1.Controlling,t3.Name,Max(t5.ChartOfAccountsOut) AS ChartOfAccountsT, " + + " MAX(t7.ChartOfAccounts) AS ChartOfAccountsK,Max(t4.DocumentNumber) AS DocumentNumber " + + + " FROM InvoiceRows t1 left join Controlling t2 on " + + " t1.Controlling = t2.Oid left join HCategory t3 on " + + " t2.Oid = t3.Oid LEFT JOIN InvoiceHeader t4 on" + + " t1.InvoiceHeader = t4.Oid LEFT JOIN Customers t6 ON " + + " t4.Customers = t6.Oid LEFT JOIN CustomersGLParametersYear t5 on" + + " t5.AccountYear=Year(t4.DateExecution) AND t6.CustomersGLParameters = t5.CustomersGLParameters" + + " LEFT JOIN ControllingYear t7 ON" + + " t1.Controlling=t7.Controlling AND t7.AccountYear=Year(t4.DateExecution)" + + + " WHERE t1.InvoiceHeader ='{0}' AND t1.GCRecord IS NULL AND t7.GCRecord IS NULL AND t5.GCRecord IS NULL" + + " GROUP BY t1.Controlling,t3.Name,t1.VAT", _InvoiceHeader_OID); + using (SqlCommand _SqlCommand = new SqlCommand(_SQL, _SqlConnection)) + { + using (SqlDataReader _SqlDataReader = _SqlCommand.ExecuteReader()) + { + + if (_SqlDataReader.HasRows) + { + while (_SqlDataReader.Read()) + { + try + { + _GLRows = new GLRows(_uow); + _GLRows.GLHeader = _GLAccounts; + _GLRows.NoteRows = "ÉRTÉKESÍTÉS NETTÓ"; + _GLRows.DebitChartOfAccounts = _uow.GetObjectByKey(_SqlDataReader["ChartOfAccountsT"]); + _GLRows.CreditChartOfAccounts = _uow.GetObjectByKey(_SqlDataReader["ChartOfAccountsK"]); + _GLRows.AmountHUF = (double)_SqlDataReader["SumPriceHUF"]; + _GLRows.AmountDEV = (double)_SqlDataReader["SumPriceDEV"]; + _GLRows.VAT = _uow.GetObjectByKey(_SqlDataReader["VAT"]); + _GLRows.GLRowsTypeVAT = eGLRowsTypeVAT.eNettoRow; + _GLRows.GLRowsType = eGLRowsType.eNormal; + _GLRows.PartnerType = ePartnerType.eReceivables; + _GLRows.Customer = _GLAccounts.Customers; + _GLRows.ConnectInfo = _GLAccounts.ConnectInfo; + _GLRows.DateVAT = _GLAccounts.DateExecution; + _GLRows.DateExecution = _GLAccounts.DateExecution; + _uow.CommitChanges(); + } + catch (Exception ex) + { + MigrationLog _MigrationLog = new MigrationLog(_uow_log); + _MigrationLog.UserCreated = _CurrentUser; + _MigrationLog.ShortName = string.Format("ERROR GLRows Netto: {0}", _SqlDataReader["DocumentNumber"].ToString().Trim()); + _MigrationLog.DateCreated = DateTime.Now; + _MigrationLog.Description = ex.Message; + _uow_log.CommitChanges(); + } + } + + } + } + + } + + /// Számla ÁFA rögzítése ... + _SQL = string.Format(" SELECT t1.VAT,t4.ChartOfAccountsOut As ChartOfAccountsT,t5.ChartOfAccountsOut As ChartOfAccountsK," + + " t1.AmountBruttoDEV,t1.AmountBruttoHUF,t1.AmountVATDEV,t1.AmountVATHUF,t1.AmountNettoHUF,t1.AmountNettoDEV" + + " FROM InvoiceVATRows t1 join InvoiceHeader t2 ON" + + " t1.InvoiceHeader = t2.Oid LEFT JOIN Customers t3 ON" + + " t2.Customers=t3.Oid LEFT JOIN CustomersGLParametersYear t4 ON" + + " Year(t2.DateExecution) = t4.AccountYear AND t4.CustomersGLParameters = t3.CustomersGLParameters LEFT JOIN VATYear t5 on" + + " Year(t2.DateExecution) = t5.AccountYear AND t1.VAT=t5.VAT" + + " WHERE t2.Oid = '{0}' AND t1.GCRecord IS NULL", _InvoiceHeader_OID); + using (SqlCommand _SqlCommand = new SqlCommand(_SQL, _SqlConnection)) + { + using (SqlDataReader _SqlDataReader = _SqlCommand.ExecuteReader()) + { + + if (_SqlDataReader.HasRows) + { + while (_SqlDataReader.Read()) + { + if ((double)_SqlDataReader["AmountVATHUF"] > 0.00) + { + try + { + + + _GLRows = new GLRows(_uow); + _GLRows.GLHeader = _GLAccounts; + _GLRows.NoteRows = "ÉRTÉKESÍTÉS ÁFA"; + _GLRows.DebitChartOfAccounts = _uow.GetObjectByKey(_SqlDataReader["ChartOfAccountsT"]); + _GLRows.CreditChartOfAccounts = _uow.GetObjectByKey(_SqlDataReader["ChartOfAccountsK"]); + _GLRows.AmountHUF = (double)_SqlDataReader["AmountVATHUF"]; + _GLRows.AmountDEV = (double)_SqlDataReader["AmountVATDEV"]; + _GLRows.VAT = _uow.GetObjectByKey(_SqlDataReader["VAT"]); + _GLRows.GLRowsTypeVAT = eGLRowsTypeVAT.eVATRow; + _GLRows.GLRowsType = eGLRowsType.eNormal; + _GLRows.PartnerType = ePartnerType.eReceivables; + _GLRows.Customer = _GLAccounts.Customers; + _GLRows.ConnectInfo = _GLAccounts.ConnectInfo; + _GLRows.DateVAT = _GLAccounts.DateExecution; + _GLRows.DateExecution = _GLAccounts.DateExecution; + _uow.CommitChanges(); + } + catch (Exception ex) + { + MigrationLog _MigrationLog = new MigrationLog(_uow_log); + _MigrationLog.UserCreated = _CurrentUser; + _MigrationLog.ShortName = string.Format("ERROR GLRows VAT: {0}", _SqlDataReader["DocumentNumber"].ToString().Trim()); + _MigrationLog.DateCreated = DateTime.Now; + _MigrationLog.Description = ex.Message; + _uow_log.CommitChanges(); + } + } + } + + } + } + + } + + GLFunctions.ReconfigurePCI(_uow, _GLAccounts.CustomersFrom, _GLAccounts.Customers, _GLAccounts.PartnerType, _GLAccounts.ConnectInfo); + _uow.CommitChanges(); + } + _SqlConnection.Close(); + _MySqlConnection.Close(); + _ocur.Session.ExecuteNonQuery("SET FOREIGN_KEY_CHECKS=1"); + } #endregion } } diff --git a/Nuvolar.Module.CSharp/BusinessObjects/Migration/Migration_VC.resx b/Nuvolar.Module.CSharp/BusinessObjects/Migration/Migration_VC.resx index 4de492a..122d985 100644 --- a/Nuvolar.Module.CSharp/BusinessObjects/Migration/Migration_VC.resx +++ b/Nuvolar.Module.CSharp/BusinessObjects/Migration/Migration_VC.resx @@ -118,10 +118,10 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - 17, 95 + 17, 56 - 17, 56 + 17, 95 343, 17 diff --git a/Nuvolar.Module.CSharp/Model.DesignedDiffs.Localization.hu.xafml b/Nuvolar.Module.CSharp/Model.DesignedDiffs.Localization.hu.xafml index 1c48494..7c266b6 100644 --- a/Nuvolar.Module.CSharp/Model.DesignedDiffs.Localization.hu.xafml +++ b/Nuvolar.Module.CSharp/Model.DesignedDiffs.Localization.hu.xafml @@ -79,6 +79,11 @@ + + + + + diff --git a/Nuvolar.Module.CSharp/Model.DesignedDiffs.xafml b/Nuvolar.Module.CSharp/Model.DesignedDiffs.xafml index 971cf3c..d05f9dc 100644 --- a/Nuvolar.Module.CSharp/Model.DesignedDiffs.xafml +++ b/Nuvolar.Module.CSharp/Model.DesignedDiffs.xafml @@ -301,6 +301,25 @@ + + + + + + + + + + + + + + + + + + + diff --git a/Nuvolar.Module.Win.CSharp/Controllers/VATReport_VC.cs b/Nuvolar.Module.Win.CSharp/Controllers/VATReport_VC.cs index ebd35f1..88abe47 100644 --- a/Nuvolar.Module.Win.CSharp/Controllers/VATReport_VC.cs +++ b/Nuvolar.Module.Win.CSharp/Controllers/VATReport_VC.cs @@ -1,9 +1,11 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.IO; using System.Linq; using System.Text; using System.Windows.Forms; +using System.Xml; using DevExpress.Data.Filtering; using DevExpress.ExpressApp; using DevExpress.ExpressApp.Actions; @@ -54,10 +56,12 @@ namespace Nuvolar.Module.Win.CSharp.Controllers if (_NAVProgramPath != "") { _FileName60 = string.Format("{0}{1}.xml", Path.GetTempPath(), _VATReport.ShortName); - //Me.Create1465XML(_ocur, _FileName65, _VATReport) - //string _ShellCommand = String.Format("{0} ""cmd:open.xml {1}""", _NAVProgramPath, _FileName60); + Create60XML(_ocur, _FileName60, _VATReport); + string _ShellCommand = String.Format("{0} \"cmd:open.xml {1}\" ", _NAVProgramPath, _FileName60); + ProcessStartInfo _ProcessStartInfo = new ProcessStartInfo(); + _ProcessStartInfo.FileName = _ShellCommand; - //Shell(_ShellCommand, AppWinStyle.NormalFocus) + Process.Start(_ProcessStartInfo); } else { @@ -71,7 +75,7 @@ namespace Nuvolar.Module.Win.CSharp.Controllers { _FileName60 = _SaveFileDialog.FileName; - //Me.Create65XML(_ocur, _FileName65, _VATReport) + Create60XML(_ocur, _FileName60, _VATReport); //MsgBox(String.Format("Az XML file ""{0}"" névvel a következő helyen került elmentésre:" + vbNewLine + "{1}", System.IO.Path.GetFileName(_SaveFileDialog.FileName), IO.Path.GetFullPath(_SaveFileDialog.FileName)), _ @@ -79,5 +83,27 @@ namespace Nuvolar.Module.Win.CSharp.Controllers } } } + private void Create60XML(XPObjectSpace _ocur, string _FileName60, VATReport _VATReport) + { + XmlTextWriter _XmlTextWriter = new XmlTextWriter(_FileName60, System.Text.Encoding.UTF8); + _XmlTextWriter.WriteEndElement(); + /* --Itt kezdődik ... -------------------------------------------------------------------------------------*/ + + + + /* -- Itt végződik ... ------------------------------------------------------------------------------------*/ + _XmlTextWriter.Flush(); + _XmlTextWriter.Close(); + + } + private void UploadField(XmlTextWriter _XmlTextWriter, string _FieldID, string _ValueString) + { + _XmlTextWriter.WriteStartElement("mezo"); + _XmlTextWriter.WriteAttributeString("eazon", _FieldID); + _XmlTextWriter.WriteString(_ValueString); + _XmlTextWriter.WriteEndElement(); + + + } } } diff --git a/Nuvolar.Module/Model.DesignedDiffs.Localization.hu.xafml b/Nuvolar.Module/Model.DesignedDiffs.Localization.hu.xafml index 0ea835a..126bc18 100644 --- a/Nuvolar.Module/Model.DesignedDiffs.Localization.hu.xafml +++ b/Nuvolar.Module/Model.DesignedDiffs.Localization.hu.xafml @@ -904,6 +904,8 @@ + + diff --git a/Nuvolar.Module/Model.DesignedDiffs.xafml b/Nuvolar.Module/Model.DesignedDiffs.xafml index 1b57a3c..5964584 100644 --- a/Nuvolar.Module/Model.DesignedDiffs.xafml +++ b/Nuvolar.Module/Model.DesignedDiffs.xafml @@ -1075,8 +1075,10 @@ - - + + + + @@ -4583,8 +4585,8 @@ - - + + diff --git a/Nuvolar.Module/My Project/AssemblyInfo.vb b/Nuvolar.Module/My Project/AssemblyInfo.vb index 5fe2f84..144fe86 100644 --- a/Nuvolar.Module/My Project/AssemblyInfo.vb +++ b/Nuvolar.Module/My Project/AssemblyInfo.vb @@ -28,5 +28,5 @@ Imports System.Runtime.InteropServices ' by using the '*' as shown below: ' - + diff --git a/Nuvolar.Module/My Project/licenses.licx b/Nuvolar.Module/My Project/licenses.licx index 80e4ada..5195519 100644 --- a/Nuvolar.Module/My Project/licenses.licx +++ b/Nuvolar.Module/My Project/licenses.licx @@ -1 +1,3 @@ DevExpress.ExpressApp.ViewController, DevExpress.ExpressApp.v20.1, Version=20.1.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a + +DevExpress.ExpressApp.SystemModule.SystemModule, DevExpress.ExpressApp.v20.1, Version=20.1.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a \ No newline at end of file