From 6ce0c4c9eb5304e744962da5ebdcd9761a1740e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Szab=C3=B3=20Iv=C3=A1n?= Date: Wed, 18 Jul 2018 13:54:19 +0200 Subject: [PATCH] NAV OnlineInvoices --- .../Controllers/NAV_Online_VC.Designer.cs | 93 +++++ .../Controllers/NAV_Online_VC.cs | 259 ++++++++++++++ Nuvolar.Module.CSharp/Laravel/Users.cs | 29 ++ .../Model.DesignedDiffs.Localization.hu.xafml | 22 ++ .../Model.DesignedDiffs.xafml | 120 +++++++ .../Nuvolar.Module.CSharp.csproj | 13 + Nuvolar.Module.CSharp/StaticClass/RestAPI.cs | 234 ++++++++++++ Nuvolar.Module.CSharp/packages.config | 1 + .../Business/Product/ProductsGant_VC.vb | 332 ++++++++++-------- .../Invoice/InvoiceHeader.vb | 44 +++ .../Business/Products/ProductsGant.vb | 3 + .../GeneralObjects/Customers/Customers.vb | 41 ++- .../GeneralObjects/Customers/CustomersFrom.vb | 54 ++- Nuvolar.Win.Lite/WinApplication_DB.vb | 7 + Nuvolar.Win.Lite/app.config | 2 +- 15 files changed, 1107 insertions(+), 147 deletions(-) create mode 100644 Nuvolar.Module.CSharp/Controllers/NAV_Online_VC.Designer.cs create mode 100644 Nuvolar.Module.CSharp/Controllers/NAV_Online_VC.cs create mode 100644 Nuvolar.Module.CSharp/Laravel/Users.cs create mode 100644 Nuvolar.Module.CSharp/StaticClass/RestAPI.cs diff --git a/Nuvolar.Module.CSharp/Controllers/NAV_Online_VC.Designer.cs b/Nuvolar.Module.CSharp/Controllers/NAV_Online_VC.Designer.cs new file mode 100644 index 0000000..4fcdc97 --- /dev/null +++ b/Nuvolar.Module.CSharp/Controllers/NAV_Online_VC.Designer.cs @@ -0,0 +1,93 @@ +namespace Nuvolar.Module.Controllers +{ + partial class NAV_Online_VC + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + this.aNAV_queryInvoiceStatus = new DevExpress.ExpressApp.Actions.SimpleAction(this.components); + this.aNAV_manageInvoice = new DevExpress.ExpressApp.Actions.SimpleAction(this.components); + this.aNAV_queryTaxpayer = new DevExpress.ExpressApp.Actions.SimpleAction(this.components); + this.aNAV_queryInvoiceData = new DevExpress.ExpressApp.Actions.SimpleAction(this.components); + // + // aNAV_queryInvoiceStatus + // + this.aNAV_queryInvoiceStatus.Caption = "aNAV_queryInvoiceStatus"; + this.aNAV_queryInvoiceStatus.ConfirmationMessage = null; + this.aNAV_queryInvoiceStatus.Id = "aNAV_queryInvoiceStatus"; + this.aNAV_queryInvoiceStatus.SelectionDependencyType = DevExpress.ExpressApp.Actions.SelectionDependencyType.RequireSingleObject; + this.aNAV_queryInvoiceStatus.TargetObjectType = typeof(Nuvolar.Module.InvoiceHeader); + this.aNAV_queryInvoiceStatus.ToolTip = null; + this.aNAV_queryInvoiceStatus.Execute += new DevExpress.ExpressApp.Actions.SimpleActionExecuteEventHandler(this.aNAV_queryInvoiceStatus_Execute); + // + // aNAV_manageInvoice + // + this.aNAV_manageInvoice.Caption = "aNAV_manageInvoice"; + this.aNAV_manageInvoice.ConfirmationMessage = null; + this.aNAV_manageInvoice.Id = "aNAV_manageInvoice"; + this.aNAV_manageInvoice.SelectionDependencyType = DevExpress.ExpressApp.Actions.SelectionDependencyType.RequireSingleObject; + this.aNAV_manageInvoice.TargetObjectType = typeof(Nuvolar.Module.InvoiceHeader); + this.aNAV_manageInvoice.ToolTip = null; + this.aNAV_manageInvoice.Execute += new DevExpress.ExpressApp.Actions.SimpleActionExecuteEventHandler(this.aNAV_manageInvoice_Execute); + // + // aNAV_queryTaxpayer + // + this.aNAV_queryTaxpayer.Caption = "aNAV_queryTaxpayer"; + this.aNAV_queryTaxpayer.ConfirmationMessage = null; + this.aNAV_queryTaxpayer.Id = "aNAV_queryTaxpayer"; + this.aNAV_queryTaxpayer.SelectionDependencyType = DevExpress.ExpressApp.Actions.SelectionDependencyType.RequireSingleObject; + this.aNAV_queryTaxpayer.TargetObjectType = typeof(Nuvolar.Module.Customers); + this.aNAV_queryTaxpayer.ToolTip = null; + this.aNAV_queryTaxpayer.Execute += new DevExpress.ExpressApp.Actions.SimpleActionExecuteEventHandler(this.aNAV_queryTaxpayer_Execute); + // + // aNAV_queryInvoiceData + // + this.aNAV_queryInvoiceData.Caption = "aNAV_queryInvoiceData"; + this.aNAV_queryInvoiceData.ConfirmationMessage = null; + this.aNAV_queryInvoiceData.Id = "aNAV_queryInvoiceData"; + this.aNAV_queryInvoiceData.SelectionDependencyType = DevExpress.ExpressApp.Actions.SelectionDependencyType.RequireSingleObject; + this.aNAV_queryInvoiceData.TargetObjectType = typeof(Nuvolar.Module.InvoiceHeader); + this.aNAV_queryInvoiceData.ToolTip = null; + this.aNAV_queryInvoiceData.Execute += new DevExpress.ExpressApp.Actions.SimpleActionExecuteEventHandler(this.aNAV_queryInvoiceData_Execute); + // + // NAV_Online_VC + // + this.Actions.Add(this.aNAV_queryInvoiceStatus); + this.Actions.Add(this.aNAV_manageInvoice); + this.Actions.Add(this.aNAV_queryTaxpayer); + this.Actions.Add(this.aNAV_queryInvoiceData); + + } + + #endregion + + private DevExpress.ExpressApp.Actions.SimpleAction aNAV_queryInvoiceStatus; + private DevExpress.ExpressApp.Actions.SimpleAction aNAV_manageInvoice; + private DevExpress.ExpressApp.Actions.SimpleAction aNAV_queryTaxpayer; + private DevExpress.ExpressApp.Actions.SimpleAction aNAV_queryInvoiceData; + } +} diff --git a/Nuvolar.Module.CSharp/Controllers/NAV_Online_VC.cs b/Nuvolar.Module.CSharp/Controllers/NAV_Online_VC.cs new file mode 100644 index 0000000..355fdd6 --- /dev/null +++ b/Nuvolar.Module.CSharp/Controllers/NAV_Online_VC.cs @@ -0,0 +1,259 @@ +using DevExpress.Data.Filtering; +using DevExpress.ExpressApp; +using DevExpress.ExpressApp.Actions; +using DevExpress.ExpressApp.Xpo; +using Newtonsoft.Json; +using Nuvolar.Module.StaticClass; + +namespace Nuvolar.Module.Controllers +{ + public partial class NAV_Online_VC : ViewController + { + public NAV_Online_VC() + { + InitializeComponent(); + // Target required Views (via the TargetXXX properties) and create their Actions. + } + protected override void OnActivated() + { + base.OnActivated(); + // Perform various tasks depending on the target View. + } + protected override void OnViewControlsCreated() + { + base.OnViewControlsCreated(); + // Access and customize the target View control. + } + protected override void OnDeactivated() + { + // Unsubscribe from previously subscribed events and release other references and resources. + base.OnDeactivated(); + } + /// + /// Adószám ellenőrzése a kiválasztott ügyfelek alapján + /// + /// + /// + private void aNAV_queryTaxpayer_Execute(object sender, SimpleActionExecuteEventArgs e) + { + XPObjectSpace _ocur = View.ObjectSpace as XPObjectSpace; + Customers _Customers = View.SelectedObjects[0] as Customers; + CustomersFrom _CustomersFrom = _ocur.FindObject(CriteriaOperator.Parse("IsDefault=True")); + var _postData = new + { + customersfrom = _CustomersFrom.Oid.ToString(), + taxPayer = _Customers.VATNumber.Substring(0, 8), + softwareId = "123456789123456789", + softwareName = "3C ERP System", + softwareOperation = "ONLINE_SERVICE", + softwareMainVersion = "17.2.3", + softwareDevName = "3C Távközlési Kft.", + softwareDevContact = "http:\\3ctelecom.hu", + softwareDevCountryCode = "HU", + softwareDevTaxNumber = "10644209-2-43" + }; + + RestAPI.ExecuteRootePOST("onlineinvoice/querytaxpayer", true, JsonConvert.SerializeObject(_postData)); + var _StatusCode = RestAPI.StatusCode; + var _StatusDescription = RestAPI.StatusMessage; + + if (_StatusCode == 200) + { + + + dynamic _ResultJSON = JsonConvert.DeserializeObject(_StatusDescription); + + if (_ResultJSON.status.ToString() == "OK") + { + if (_ResultJSON.taxpayerValidity["0"].ToString() == "false") + { + _ocur.Session.ExecuteNonQuery(string.Format("UPDATE Customers set NAV_valid = 0,NAV_queryDate=NOW() WHERE Oid = '{0}'", + _Customers.Oid.ToString())); + } + if (_ResultJSON.taxpayerValidity["0"].ToString() == "true") + { + _ocur.Session.ExecuteNonQuery(string.Format("UPDATE Customers set NAV_valid = 1,NAV_queryDate=NOW() WHERE Oid = '{0}'", + _Customers.Oid.ToString())); + } + Application.ShowViewStrategy.ShowMessage("Adószám ellenőrzés megtörtént !", InformationType.Success, 2000, InformationPosition.Bottom); + } + if (_ResultJSON.status.ToString() == "ERROR") + { + string _ERROR = "Adószám ellenőrzés nem történt meg !"; + _ERROR += " [" + _ResultJSON.xml.result.message.ToString() + "]"; + Application.ShowViewStrategy.ShowMessage(_ERROR, InformationType.Error, 5000, InformationPosition.Bottom); + } + } + else + { + string _ERROR = "Adószám ellenőrzés nem történt meg !"; + _ERROR += " [" + _StatusDescription.ToString() + "]"; + Application.ShowViewStrategy.ShowMessage(_ERROR, InformationType.Error, 5000, InformationPosition.Bottom); + } + } + + private void aNAV_manageInvoice_Execute(object sender, SimpleActionExecuteEventArgs e) + { + XPObjectSpace _ocur = View.ObjectSpace as XPObjectSpace; + InvoiceHeader _InvoiceHeader = View.SelectedObjects[0] as InvoiceHeader; + string _operation = "CREATE"; + + if (_InvoiceHeader.IsStorno) + { + _operation = "STORNO"; + } + var _postData = new + { + documentnumber = _InvoiceHeader.DocumentNumber, + customersfrom = _InvoiceHeader.CustomersFrom.Oid.ToString(), + operation = _operation, + technicalAnnulment = false, + softwareId = "123456789123456789", + softwareName = "3C ERP System", + softwareOperation = "ONLINE_SERVICE", + softwareMainVersion = "17.2.3", + softwareDevName = "3C Távközlési Kft.", + softwareDevContact = "http:\\3ctelecom.hu", + softwareDevCountryCode = "HU", + softwareDevTaxNumber = "10644209-2-43" + + }; + + RestAPI.ExecuteRootePOST("onlineinvoice/manageinvoice", true, JsonConvert.SerializeObject(_postData)); + var _StatusCode = RestAPI.StatusCode; + var _StatusDescription = RestAPI.StatusMessage; + + if (_StatusCode == 200) + { + dynamic _ResultJSON = JsonConvert.DeserializeObject(_StatusDescription); + + if (_ResultJSON.status.ToString() == "OK") + { + _ocur.Session.ExecuteNonQuery(string.Format("UPDATE InvoiceHeader set NAV_transactionID='{0}' WHERE Oid = '{1}'", _ResultJSON.transactionId["0"].ToString(), _InvoiceHeader.Oid.ToString())); + + Application.ShowViewStrategy.ShowMessage("A számla beküldése megtörtént !", InformationType.Success, 2000, InformationPosition.Bottom); + } + if (_ResultJSON.status.ToString() == "ERROR") + { + string _ERROR = "A számla beküldése nem történt meg !"; + _ERROR += " [" + _ResultJSON.xml.result.message.ToString() + "]"; + Application.ShowViewStrategy.ShowMessage(_ERROR, InformationType.Error, 5000, InformationPosition.Bottom); + } + } + else + { + string _ERROR = "A számla beküldése nem történt meg !"; + _ERROR += " [" + _StatusDescription + "]"; + Application.ShowViewStrategy.ShowMessage(_ERROR, InformationType.Error, 5000, InformationPosition.Bottom); + } + + (View as ListView).CollectionSource.Reload(); + } + + private void aNAV_queryInvoiceStatus_Execute(object sender, SimpleActionExecuteEventArgs e) + { + XPObjectSpace _ocur = View.ObjectSpace as XPObjectSpace; + InvoiceHeader _InvoiceHeader = View.SelectedObjects[0] as InvoiceHeader; + + var _postData = new + { + documentnumber = _InvoiceHeader.DocumentNumber, + customersfrom = _InvoiceHeader.CustomersFrom.Oid.ToString(), + transactionId = _InvoiceHeader.NAV_transactionId, + softwareId = "123456789123456789", + softwareName = "3C ERP System", + softwareOperation = "ONLINE_SERVICE", + softwareMainVersion = "17.2.3", + softwareDevName = "3C Távközlési Kft.", + softwareDevContact = "http:\\3ctelecom.hu", + softwareDevCountryCode = "HU", + softwareDevTaxNumber = "10644209-2-43" + + }; + + RestAPI.ExecuteRootePOST("onlineinvoice/queryinvoicestatus", true, JsonConvert.SerializeObject(_postData)); + var _StatusCode = RestAPI.StatusCode; + var _StatusDescription = RestAPI.StatusMessage; + + if (_StatusCode == 200) + { + dynamic _ResultJSON = JsonConvert.DeserializeObject(_StatusDescription); + + if (_ResultJSON.status.ToString() == "OK") + { + _ocur.Session.ExecuteNonQuery(string.Format("UPDATE InvoiceHeader set NAV_InvoiceStatus='{0}',NAV_queryDate=NOW() WHERE Oid = '{1}'", + _ResultJSON.processingResults.processingResult.invoiceStatus.ToString(), _InvoiceHeader.Oid.ToString())); + Application.ShowViewStrategy.ShowMessage("A számla státusz lekérdezése megtörtént !", InformationType.Success, 2000, InformationPosition.Bottom); + } + if (_ResultJSON.status.ToString() == "ERROR") + { + + } + } + else + { + string _ERROR = "A számla státusz ellenőrzés nem történt meg !"; + _ERROR += " [" + _StatusDescription + "]"; + Application.ShowViewStrategy.ShowMessage(_ERROR, InformationType.Error, 5000, InformationPosition.Bottom); + } + } + + private void aNAV_queryInvoiceData_Execute(object sender, SimpleActionExecuteEventArgs e) + { + InvoiceHeader _InvoiceHeader = View.SelectedObjects[0] as InvoiceHeader; + + var _postData = new + { + invoiceNumber = _InvoiceHeader.DocumentNumber, + customersfrom = _InvoiceHeader.CustomersFrom.Oid.ToString(), + softwareId = "123456789123456789", + softwareName = "3C ERP System", + softwareOperation = "ONLINE_SERVICE", + softwareMainVersion = "17.2.3", + softwareDevName = "3C Távközlési Kft.", + softwareDevContact = "http:\\3ctelecom.hu", + softwareDevCountryCode = "HU", + softwareDevTaxNumber = "10644209-2-43" + + }; + + RestAPI.ExecuteRootePOST("onlineinvoice/queryinvoicedata", true, JsonConvert.SerializeObject(_postData)); + var _StatusCode = RestAPI.StatusCode; + var _StatusDescription = RestAPI.StatusMessage; + if (_StatusCode == 200) + { + dynamic _ResultJSON = JsonConvert.DeserializeObject(_StatusDescription); + + if (_ResultJSON.status.ToString() == "OK") + { + if (_ResultJSON.queryResults.availablePage.ToString() == "0") + { + string _ERROR = "A számla adat ellenőrzés megtörtént ! Nincs elérhető adat!"; + + Application.ShowViewStrategy.ShowMessage(_ERROR, InformationType.Warning, 5000, InformationPosition.Bottom); + } + if (_ResultJSON.queryResults.availablePage.ToString() != "0") + { + string _ERROR = "A számla adat ellenőrzés megtörtént !"; + + Application.ShowViewStrategy.ShowMessage(_ERROR, InformationType.Success, 5000, InformationPosition.Bottom); + } + } + if (_ResultJSON.status.ToString() == "ERROR") + { + string _ERROR = "A számla adat ellenőrzés nem történt meg !"; + _ERROR += " [" + _ResultJSON.technicalValidationMessages.message.ToString() + "]"; + Application.ShowViewStrategy.ShowMessage(_ERROR, InformationType.Error, 5000, InformationPosition.Bottom); + } + } + else + { + string _ERROR = "A számla státusz ellenőrzés nem történt meg !"; + _ERROR += " [" + _StatusDescription + "]"; + Application.ShowViewStrategy.ShowMessage(_ERROR, InformationType.Error, 5000, InformationPosition.Bottom); + + } + + } + } +} diff --git a/Nuvolar.Module.CSharp/Laravel/Users.cs b/Nuvolar.Module.CSharp/Laravel/Users.cs new file mode 100644 index 0000000..abd23db --- /dev/null +++ b/Nuvolar.Module.CSharp/Laravel/Users.cs @@ -0,0 +1,29 @@ +using DevExpress.Persistent.Base; +using DevExpress.Persistent.BaseImpl.PermissionPolicy; +using DevExpress.Xpo; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace Nuvolar.Module.Laravel +{ + [DefaultClassOptions, Persistent("Users")] + public class Users : XPLiteObject + { + public Users(Session session) + : base(session) + { + } + public override void AfterConstruction() + { + base.AfterConstruction(); + } + [Key(true), Persistent("id")] public int id; + [Persistent("name")] public string name; + [Persistent("email")] public string email; + [Persistent("api_token")] public string api_token; + [Persistent("permissionpolicyuser"), NoForeignKey] public PermissionPolicyUser PermissionPolicyUser; + [NonPersistent, VisibleInListView(false), VisibleInLookupListView(false)] public string row_password; + } +} diff --git a/Nuvolar.Module.CSharp/Model.DesignedDiffs.Localization.hu.xafml b/Nuvolar.Module.CSharp/Model.DesignedDiffs.Localization.hu.xafml index 1deab27..836fd99 100644 --- a/Nuvolar.Module.CSharp/Model.DesignedDiffs.Localization.hu.xafml +++ b/Nuvolar.Module.CSharp/Model.DesignedDiffs.Localization.hu.xafml @@ -67,6 +67,15 @@ + + + + + + + + + @@ -83,6 +92,18 @@ + + + + + + + + + + + + @@ -95,6 +116,7 @@ + diff --git a/Nuvolar.Module.CSharp/Model.DesignedDiffs.xafml b/Nuvolar.Module.CSharp/Model.DesignedDiffs.xafml index 88be985..ce43b74 100644 --- a/Nuvolar.Module.CSharp/Model.DesignedDiffs.xafml +++ b/Nuvolar.Module.CSharp/Model.DesignedDiffs.xafml @@ -7,6 +7,7 @@ + @@ -59,6 +60,17 @@ + + + + + + + + + + + @@ -106,6 +118,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -164,6 +219,71 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Nuvolar.Module.CSharp/Nuvolar.Module.CSharp.csproj b/Nuvolar.Module.CSharp/Nuvolar.Module.CSharp.csproj index 30c8b58..4d05df8 100644 --- a/Nuvolar.Module.CSharp/Nuvolar.Module.CSharp.csproj +++ b/Nuvolar.Module.CSharp/Nuvolar.Module.CSharp.csproj @@ -190,15 +190,20 @@ False + ..\packages\MySql.Data.6.9.9\lib\net40\MySql.Data.dll True + + ..\packages\Newtonsoft.Json.8.0.3\lib\net40\Newtonsoft.Json.dll + System False + 3.5 False @@ -270,6 +275,12 @@ NavInvoiceReportVC.cs + + Component + + + NAV_Online_VC.cs + Component @@ -313,6 +324,7 @@ + Component @@ -327,6 +339,7 @@ Report_Invoice.cs + diff --git a/Nuvolar.Module.CSharp/StaticClass/RestAPI.cs b/Nuvolar.Module.CSharp/StaticClass/RestAPI.cs new file mode 100644 index 0000000..d97d7a6 --- /dev/null +++ b/Nuvolar.Module.CSharp/StaticClass/RestAPI.cs @@ -0,0 +1,234 @@ +using DevExpress.Data.Filtering; +using DevExpress.ExpressApp.Xpo; +using DevExpress.Persistent.Base; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using System; +using System.Collections.Generic; +using System.Configuration; +using System.IO; +using System.Linq; +using System.Net; +using System.Text; +using System.Threading.Tasks; + +namespace Nuvolar.Module.StaticClass +{ + /// + /// Laravel RestAPI kezelő osztály + /// + public static class RestAPI + { + private static string _UriBase; + private static Dictionary _LoginInfo; + private static int _StatusCode; + private static string _StatusMessage; + private static string _ResponseMessage; + private static string _API_Token; + private static string _GeocodeAPIKey; + + public static int StatusCode + { + get { return _StatusCode; } + } + public static string StatusMessage + { + get { return _StatusMessage; } + } + public static string ResponseMessage + { + get { return _ResponseMessage; } + } + public static void Init(XPObjectSpace _onew) + { + + _ResponseMessage = ""; + _UriBase = ConfigurationManager.AppSettings["Uri"]; + _GeocodeAPIKey = ConfigurationManager.AppSettings["GeocodeAPIKey"]; + Laravel.Users _Users = _onew.FindObject(CriteriaOperator.Parse("email='sysadmin@emango.com'")); + if (_Users != null) + { + if (String.IsNullOrEmpty(_Users.api_token)) + { + + _LoginInfo = new Dictionary { { "email", "sysadmin@emango.com" }, + { "password", "SysAdmin" }}; + + var json = ExecuteRootePOST("login", false, JsonConvert.SerializeObject(_LoginInfo)); + + if (_StatusCode == 200) + { + var dd = JsonConvert.DeserializeObject(json); + var dict = JObject.Parse(json).SelectToken("data").ToObject>(); + _API_Token = dict["api_token"]; + } + } + else + { + _API_Token = _Users.api_token; + } + } + } + public static string ExecuteRootePOST(string _RooteString, bool _NeedAuthentication, string _postData) + { + _StatusCode = 500; + _StatusMessage = "Not respond"; + string json = ""; + + + Tracing.Tracer.LogText(_UriBase + _RooteString); + + var _Uri = new Uri(_UriBase + _RooteString, UriKind.Absolute); + var _WebRequest = WebRequest.Create(_Uri); + HttpWebRequest _HttpWebRequest = (HttpWebRequest)_WebRequest; + + _HttpWebRequest.Method = "POST"; + byte[] byteArray = Encoding.UTF8.GetBytes(_postData); + + + if (_NeedAuthentication) + { + _HttpWebRequest.PreAuthenticate = true; + _HttpWebRequest.Headers.Add("Authorization", "Bearer " + _API_Token); + _HttpWebRequest.Headers.Add("cdb", GeneralFunction.GLOBAL_SQLDatabase); + } + + _HttpWebRequest.ContentType = "application/json"; + _HttpWebRequest.Accept = "application/json"; + _HttpWebRequest.ContentLength = byteArray.Length; + Stream _dataStream = _HttpWebRequest.GetRequestStream(); + _dataStream.Write(byteArray, 0, byteArray.Length); + _dataStream.Close(); + + try + { + WebResponse _WebResponse = _WebRequest.GetResponse(); + _StatusCode = (int)((HttpWebResponse)_WebResponse).StatusCode; + _StatusMessage = ((HttpWebResponse)_WebResponse).StatusDescription; + var _responseStream = _WebResponse.GetResponseStream(); + if (_responseStream == null) return json; + + var _StreamReader = new StreamReader(_responseStream, Encoding.Default); + json = _StreamReader.ReadToEnd(); + + try + { + _StatusMessage = JsonConvert.DeserializeObject(json).ToString(); + } + catch (Exception) + { + + } + + + _responseStream.Close(); + _WebResponse.Close(); + } + catch (WebException ex) + { + + if (ex.Status == WebExceptionStatus.ProtocolError) + { + var _WebResponse = (HttpWebResponse)ex.Response; + _StatusCode = (int)_WebResponse.StatusCode; + _StatusMessage = ((HttpWebResponse)_WebResponse).StatusDescription; + } + } + + return json; + + } + public static string ExecuteRooteGET(string _RooteString, bool _NeedAuthentication) + { + string json = ""; + + Tracing.Tracer.LogText(_UriBase + _RooteString); + + var _Uri = new Uri(_UriBase + _RooteString, UriKind.Absolute); + var _WebRequest = WebRequest.Create(_Uri); + _WebRequest.Method = "GET"; + + + HttpWebRequest _HttpWebRequest = (HttpWebRequest)_WebRequest; + if (_NeedAuthentication) + { + _HttpWebRequest.PreAuthenticate = true; + _HttpWebRequest.Headers.Add("Authorization", "Bearer " + _API_Token); + _HttpWebRequest.Headers.Add("cdb", GeneralFunction.GLOBAL_SQLDatabase); + } + + _HttpWebRequest.Accept = "application/json"; + _HttpWebRequest.ContentType = "application/json"; + + try + { + WebResponse _WebResponse = _WebRequest.GetResponse(); + _StatusCode = (int)((HttpWebResponse)_WebResponse).StatusCode; + Stream _responseStream = _WebResponse.GetResponseStream(); + if (_responseStream == null) return json; + + StreamReader _StreamReader = new StreamReader(_responseStream, Encoding.Default); + json = _StreamReader.ReadToEnd(); + + _responseStream.Close(); + _WebResponse.Close(); + } + catch (WebException ex) + { + + if (ex.Status == WebExceptionStatus.ProtocolError) + { + var _WebResponse = (HttpWebResponse)ex.Response; + _StatusCode = (int)_WebResponse.StatusCode; + } + } + + + return json; + } + public static string ExecuteGOOGLEMAPSGET(string _RouteString) + { + string json = ""; + + Tracing.Tracer.LogText(_UriBase + _RouteString); + + + var _Uri = new Uri("https://maps.googleapis.com/maps/api/geocode/json?address=" + _RouteString + "&key=" + _GeocodeAPIKey, UriKind.Absolute); + var _WebRequest = WebRequest.Create(_Uri); + _WebRequest.Method = "GET"; + + + HttpWebRequest _HttpWebRequest = (HttpWebRequest)_WebRequest; + + _HttpWebRequest.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8"; + _HttpWebRequest.ContentType = "application/json"; + _HttpWebRequest.Headers.Add("accept-language", "hu-HU,hu;q=0.9,en-US;q=0.8,en;q=0.7,pt;q=0.6"); + + try + { + WebResponse _WebResponse = _WebRequest.GetResponse(); + _StatusCode = (int)((HttpWebResponse)_WebResponse).StatusCode; + Stream _responseStream = _WebResponse.GetResponseStream(); + if (_responseStream == null) return json; + + StreamReader _StreamReader = new StreamReader(_responseStream, Encoding.Default); + json = _StreamReader.ReadToEnd(); + + _responseStream.Close(); + _WebResponse.Close(); + } + catch (WebException ex) + { + + if (ex.Status == WebExceptionStatus.ProtocolError) + { + var _WebResponse = (HttpWebResponse)ex.Response; + _StatusCode = (int)_WebResponse.StatusCode; + } + } + + + return json; + } + } +} diff --git a/Nuvolar.Module.CSharp/packages.config b/Nuvolar.Module.CSharp/packages.config index d257a89..f21a326 100644 --- a/Nuvolar.Module.CSharp/packages.config +++ b/Nuvolar.Module.CSharp/packages.config @@ -1,4 +1,5 @@  + \ No newline at end of file diff --git a/Nuvolar.Module.Win/BusinessObjects/Business/Product/ProductsGant_VC.vb b/Nuvolar.Module.Win/BusinessObjects/Business/Product/ProductsGant_VC.vb index d8a37ec..5014ffa 100644 --- a/Nuvolar.Module.Win/BusinessObjects/Business/Product/ProductsGant_VC.vb +++ b/Nuvolar.Module.Win/BusinessObjects/Business/Product/ProductsGant_VC.vb @@ -91,7 +91,7 @@ Public Class ProductsGant_VC End Sub Private Sub GenerateData(_ProductsGant As ProductsGant, _onew As Xpo.XPObjectSpace) - + Dim _FBS As Integer = 0 Dim _SQL As String @@ -106,151 +106,179 @@ Public Class ProductsGant_VC Dim _SelectedData As SelectedData = _onew.Session.ExecuteQuery(_SQL) - 'Try - _WaitFormClass.Initwork(1, 1, _SelectedData.ResultSet(0).Rows.Length) - For Each row As SelectStatementResultRow In _SelectedData.ResultSet(0).Rows - _WaitFormClass.DoWork() + Try + _WaitFormClass.Initwork(1, 1, _SelectedData.ResultSet(0).Rows.Length) + For Each row As SelectStatementResultRow In _SelectedData.ResultSet(0).Rows + _WaitFormClass.DoWork() - If row.Values(0) IsNot Nothing Then + If row.Values(0) IsNot Nothing Then - Dim _ProductsGantRows As ProductsGantRows = - _onew.FindObject(Of ProductsGantRows)(CriteriaOperator.Parse("Products.Oid = ? AND Customers.Oid= ? AND ProductsGant.Oid= ?", row.Values(1), row.Values(0), _ProductsGant.Oid)) - If _ProductsGantRows Is Nothing Then - _SQL = "insert ProductsGantRows (Oid,ProductsGant,Customers,Products,CalculatedRotation,ManualRotation,CalculatedRotationW52,QTT_Minimum,QTT_Critical)" - _SQL += " select " - _SQL += " UUID(), " - _SQL += "'" & _ProductsGant.Oid.ToString() & "'," - _SQL += "'" & row.Values(0) & "'," - _SQL += "'" & row.Values(1) & "'," - _SQL += Double.Parse(row.Values(2)).ToString("F", CultureInfo.InvariantCulture) & "," - _SQL += "0," - _SQL += Double.Parse(row.Values(3)).ToString("F", CultureInfo.InvariantCulture) & "," - _SQL += "0,0" + Dim _ProductsGantRows As ProductsGantRows = + _onew.FindObject(Of ProductsGantRows)(CriteriaOperator.Parse("Products.Oid = ? AND Customers.Oid= ? AND ProductsGant.Oid= ?", row.Values(1), row.Values(0), _ProductsGant.Oid)) + If _ProductsGantRows Is Nothing Then + _SQL = "insert ProductsGantRows (Oid,ProductsGant,Customers,Products,CalculatedRotation,ManualRotation,CalculatedRotationW52,QTT_Minimum,QTT_Critical)" + _SQL += " select " + _SQL += " UUID(), " + _SQL += "'" & _ProductsGant.Oid.ToString() & "'," + _SQL += "'" & row.Values(0) & "'," + _SQL += "'" & row.Values(1) & "'," + _SQL += Double.Parse(row.Values(2)).ToString("F", CultureInfo.InvariantCulture) & "," + _SQL += "0," + _SQL += Double.Parse(row.Values(3)).ToString("F", CultureInfo.InvariantCulture) & "," + _SQL += "0,0" - _onew.Session.ExecuteNonQuery(_SQL) - Else - _SQL = " update ProductsGantRows set CalculatedRotation = " & Double.Parse(row.Values(2)).ToString("F", CultureInfo.InvariantCulture) & "," - _SQL += " CalculatedRotationW52 = " & Double.Parse(row.Values(3)).ToString("F", CultureInfo.InvariantCulture) - _SQL += " where Oid='" & _ProductsGantRows.Oid.ToString & "'" - _onew.Session.ExecuteNonQuery(_SQL) + _onew.Session.ExecuteNonQuery(_SQL) + Else + _SQL = " update ProductsGantRows set CalculatedRotation = " & Double.Parse(row.Values(2)).ToString("F", CultureInfo.InvariantCulture) & "," + _SQL += " CalculatedRotationW52 = " & Double.Parse(row.Values(3)).ToString("F", CultureInfo.InvariantCulture) + _SQL += " where Oid='" & _ProductsGantRows.Oid.ToString & "'" + _onew.Session.ExecuteNonQuery(_SQL) + End If + + If _ProductsGantRows IsNot Nothing Then + Dim _Item As Long = _GanttControl.Items.get_FindItem(_ProductsGantRows.Oid.ToString, 0) + 'Most le kéne generálni a GANTROWSBAR elemeket is ..... + + _SQL = " select t1.QTT,t1.DateExecution" + _SQL += " from productsgantcustomersreport t1" + _SQL += " where t1.Products='" & row.Values(1) & "'" + _SQL += " AND t1.Customers='" & row.Values(0) & "'" + _SQL += " AND t1.GCRecord is null" + _SQL += " order by t1.DateExecution DESC" + + + Dim _SelectedData2 As SelectedData = _onew.Session.ExecuteQuery(_SQL) + For Each row2 As SelectStatementResultRow In _SelectedData2.ResultSet(0).Rows + Dim _AD As Double = 1 + + If Double.Parse(row.Values(2)) <> 0 Then + _AD = row2.Values(0) * 7 / Double.Parse(row.Values(2)) + End If + + + If _ProductsGantRows IsNot Nothing Then + If _ProductsGantRows.ManualRotation > 0 Then + _AD = row2.Values(0) * 7 / _ProductsGantRows.ManualRotation + End If + End If + + Dim _Key As String = Guid.NewGuid.ToString + _GanttControl.Items.AddBar(CInt(_Item), "Reported", row2.Values(1), DateTime.Parse(row2.Values(1)).AddDays(_AD), _Key, row2.Values(0)) + _GanttControl.Items.set_ItemBar(CInt(_Item), _Key, exontrol.EXG2ANTTLib.ItemBarPropertyEnum.exBarCanResize, False) + _GanttControl.Items.set_ItemBar(CInt(_Item), _Key, exontrol.EXG2ANTTLib.ItemBarPropertyEnum.exBarCanMove, False) + _GanttControl.Items.set_ItemBar(CInt(_Item), _Key, exontrol.EXG2ANTTLib.ItemBarPropertyEnum.exBarCanStartLink, False) + _GanttControl.Items.set_ItemBar(CInt(_Item), _Key, exontrol.EXG2ANTTLib.ItemBarPropertyEnum.exBarCanBeLinked, False) + _GanttControl.Items.set_BarHAlignCaption(CInt(_Item), _Key, AlignmentEnum.LeftAlignment) + + If _ProductsGantRows.QTT_Minimum > 0 Then + Dim _DateTo As DateTime = DateTime.Parse(row2.Values(1)).AddDays(_AD) + + Dim _AD2 As Double = 1 + + If Double.Parse(row.Values(2)) <> 0 Then + _AD2 = _ProductsGantRows.QTT_Minimum * 7 / Double.Parse(row.Values(2)) + End If + + + If _ProductsGantRows IsNot Nothing Then + If _ProductsGantRows.ManualRotation > 0 Then + _AD2 = _ProductsGantRows.QTT_Minimum * 7 / _ProductsGantRows.ManualRotation + End If + End If + Dim _DateFrom As DateTime = _DateTo.AddDays(_AD2 * -1) + Dim _Key2 As String = Guid.NewGuid.ToString + + _GanttControl.Items.AddBar(CInt(_Item), "Critical", _DateFrom, _DateTo, _Key2, _ProductsGantRows.QTT_Minimum) + _GanttControl.Items.set_ItemBar(CInt(_Item), _Key, exontrol.EXG2ANTTLib.ItemBarPropertyEnum.exBarCanResize, False) + _GanttControl.Items.set_ItemBar(CInt(_Item), _Key, exontrol.EXG2ANTTLib.ItemBarPropertyEnum.exBarCanMove, False) + _GanttControl.Items.set_ItemBar(CInt(_Item), _Key, exontrol.EXG2ANTTLib.ItemBarPropertyEnum.exBarCanStartLink, False) + _GanttControl.Items.set_ItemBar(CInt(_Item), _Key, exontrol.EXG2ANTTLib.ItemBarPropertyEnum.exBarCanBeLinked, False) + _GanttControl.Items.set_BarHAlignCaption(CInt(_Item), _Key, AlignmentEnum.LeftAlignment) + _FBS += 1 + End If + Exit For + Next + + + _SQL = " select sum(t1.QTT),DATE_FORMAT(t2.DateExecution,'%Y-%m-%d')" + _SQL += " from OrderInRows t1 join OrderInHeader t2 on t1.OrderInHeader=t2.Oid" + _SQL += " where t1.Products='" & row.Values(1) & "' AND t1.QTT > t1.QTT_Invoiced " + _SQL += " AND t2.Customers='" & row.Values(0) & "'" + _SQL += " AND t1.GCRecord is null and t2.GCRecord is null" + _SQL += " GROUP BY DATE_FORMAT(t2.DateExecution,'%Y-%m-%d')" + _SQL += " order by DATE_FORMAT(t2.DateExecution,'%Y-%m-%d') DESC" + + + _SelectedData2 = _onew.Session.ExecuteQuery(_SQL) + For Each row2 As SelectStatementResultRow In _SelectedData2.ResultSet(0).Rows + Dim _AD As Double = 1 + + If Double.Parse(row.Values(2)) <> 0 Then + _AD = row2.Values(0) * 7 / Double.Parse(row.Values(2)) + End If + + + If _ProductsGantRows IsNot Nothing Then + If _ProductsGantRows.ManualRotation > 0 Then + _AD = row2.Values(0) * 7 / _ProductsGantRows.ManualRotation + End If + End If + + Dim _Key As String = Guid.NewGuid.ToString + _GanttControl.Items.AddBar(CInt(_Item), "Ordered", row2.Values(1), DateTime.Parse(row2.Values(1)).AddDays(_AD), _Key, row2.Values(0)) + _GanttControl.Items.set_ItemBar(CInt(_Item), _Key, exontrol.EXG2ANTTLib.ItemBarPropertyEnum.exBarCanResize, False) + _GanttControl.Items.set_ItemBar(CInt(_Item), _Key, exontrol.EXG2ANTTLib.ItemBarPropertyEnum.exBarCanMove, False) + _GanttControl.Items.set_ItemBar(CInt(_Item), _Key, exontrol.EXG2ANTTLib.ItemBarPropertyEnum.exBarCanStartLink, False) + _GanttControl.Items.set_ItemBar(CInt(_Item), _Key, exontrol.EXG2ANTTLib.ItemBarPropertyEnum.exBarCanBeLinked, False) + _GanttControl.Items.set_BarHAlignCaption(CInt(_Item), _Key, AlignmentEnum.LeftAlignment) + + Next + + _SQL = " select sum(t1.QTT),DATE_FORMAT(t2.DateExecution,'%Y-%m-%d')" + _SQL += " from InvoiceRows t1 join InvoiceHeader t2 on t1.InvoiceHeader=t2.Oid" + _SQL += " left join OrderInRows t3 on t1.OrderInRows=t3.Oid" + _SQL += " where t3.Products='" & row.Values(1) & "'" + _SQL += " AND t2.Customers='" & row.Values(0) & "'" + _SQL += " AND t1.GCRecord is null and t2.GCRecord is null AND t2.IsEditable=0" + _SQL += " GROUP BY DATE_FORMAT(t2.DateExecution,'%Y-%m-%d')" + _SQL += " order by DATE_FORMAT(t2.DateExecution,'%Y-%m-%d') DESC" + + + _SelectedData2 = _onew.Session.ExecuteQuery(_SQL) + For Each row2 As SelectStatementResultRow In _SelectedData2.ResultSet(0).Rows + Dim _AD As Double = 1 + + If Double.Parse(row.Values(2)) <> 0 Then + _AD = row2.Values(0) * 7 / Double.Parse(row.Values(2)) + End If + + + If _ProductsGantRows IsNot Nothing Then + If _ProductsGantRows.ManualRotation > 0 Then + _AD = row2.Values(0) * 7 / _ProductsGantRows.ManualRotation + End If + End If + + Dim _Key As String = Guid.NewGuid.ToString + _GanttControl.Items.AddBar(CInt(_Item), "Accounted", row2.Values(1), DateTime.Parse(row2.Values(1)).AddDays(_AD), _Key, row2.Values(0)) + _GanttControl.Items.set_ItemBar(CInt(_Item), _Key, exontrol.EXG2ANTTLib.ItemBarPropertyEnum.exBarCanResize, False) + _GanttControl.Items.set_ItemBar(CInt(_Item), _Key, exontrol.EXG2ANTTLib.ItemBarPropertyEnum.exBarCanMove, False) + _GanttControl.Items.set_ItemBar(CInt(_Item), _Key, exontrol.EXG2ANTTLib.ItemBarPropertyEnum.exBarCanStartLink, False) + _GanttControl.Items.set_ItemBar(CInt(_Item), _Key, exontrol.EXG2ANTTLib.ItemBarPropertyEnum.exBarCanBeLinked, False) + _GanttControl.Items.set_BarHAlignCaption(CInt(_Item), _Key, AlignmentEnum.LeftAlignment) + + Next + End If End If + 'IDEIGLENES !!! + 'If _FBS > 5 Then Exit For + Next row + Catch ex As Exception + Throw New Exception(ex.Message) + Finally - If _ProductsGantRows IsNot Nothing Then - Dim _Item As Long = _GanttControl.Items.get_FindItem(_ProductsGantRows.Oid.ToString, 0) - 'Most le kéne generálni a GANTROWSBAR elemeket is ..... - - _SQL = " select t1.QTT,t1.DateExecution" - _SQL += " from productsgantcustomersreport t1" - _SQL += " where t1.Products='" & row.Values(1) & "'" - _SQL += " AND t1.Customers='" & row.Values(0) & "'" - _SQL += " AND t1.GCRecord is null" - _SQL += " order by t1.DateExecution DESC" - - - Dim _SelectedData2 As SelectedData = _onew.Session.ExecuteQuery(_SQL) - For Each row2 As SelectStatementResultRow In _SelectedData2.ResultSet(0).Rows - Dim _AD As Double = 1 - - If Double.Parse(row.Values(2)) <> 0 Then - _AD = row2.Values(0) * 7 / Double.Parse(row.Values(2)) - End If - - - If _ProductsGantRows IsNot Nothing Then - If _ProductsGantRows.ManualRotation > 0 Then - _AD = row2.Values(0) * 7 / _ProductsGantRows.ManualRotation - End If - End If - - Dim _Key As String = Guid.NewGuid.ToString - _GanttControl.Items.AddBar(CInt(_Item), "Reported", row2.Values(1), DateTime.Parse(row2.Values(1)).AddDays(_AD), _Key, row2.Values(0)) - _GanttControl.Items.set_ItemBar(CInt(_Item), _Key, exontrol.EXG2ANTTLib.ItemBarPropertyEnum.exBarCanResize, False) - _GanttControl.Items.set_ItemBar(CInt(_Item), _Key, exontrol.EXG2ANTTLib.ItemBarPropertyEnum.exBarCanMove, False) - _GanttControl.Items.set_ItemBar(CInt(_Item), _Key, exontrol.EXG2ANTTLib.ItemBarPropertyEnum.exBarCanStartLink, False) - _GanttControl.Items.set_ItemBar(CInt(_Item), _Key, exontrol.EXG2ANTTLib.ItemBarPropertyEnum.exBarCanBeLinked, False) - _GanttControl.Items.set_BarHAlignCaption(CInt(_Item), _Key, AlignmentEnum.LeftAlignment) - - Exit For - Next - - - _SQL = " select sum(t1.QTT),DATE_FORMAT(t2.DateExecution,'%Y-%m-%d')" - _SQL += " from OrderInRows t1 join OrderInHeader t2 on t1.OrderInHeader=t2.Oid" - _SQL += " where t1.Products='" & row.Values(1) & "' AND t1.QTT > t1.QTT_Invoiced " - _SQL += " AND t2.Customers='" & row.Values(0) & "'" - _SQL += " AND t1.GCRecord is null and t2.GCRecord is null" - _SQL += " GROUP BY DATE_FORMAT(t2.DateExecution,'%Y-%m-%d')" - _SQL += " order by DATE_FORMAT(t2.DateExecution,'%Y-%m-%d') DESC" - - - _SelectedData2 = _onew.Session.ExecuteQuery(_SQL) - For Each row2 As SelectStatementResultRow In _SelectedData2.ResultSet(0).Rows - Dim _AD As Double = 1 - - If Double.Parse(row.Values(2)) <> 0 Then - _AD = row2.Values(0) * 7 / Double.Parse(row.Values(2)) - End If - - - If _ProductsGantRows IsNot Nothing Then - If _ProductsGantRows.ManualRotation > 0 Then - _AD = row2.Values(0) * 7 / _ProductsGantRows.ManualRotation - End If - End If - - Dim _Key As String = Guid.NewGuid.ToString - _GanttControl.Items.AddBar(CInt(_Item), "Ordered", row2.Values(1), DateTime.Parse(row2.Values(1)).AddDays(_AD), _Key, row2.Values(0)) - _GanttControl.Items.set_ItemBar(CInt(_Item), _Key, exontrol.EXG2ANTTLib.ItemBarPropertyEnum.exBarCanResize, False) - _GanttControl.Items.set_ItemBar(CInt(_Item), _Key, exontrol.EXG2ANTTLib.ItemBarPropertyEnum.exBarCanMove, False) - _GanttControl.Items.set_ItemBar(CInt(_Item), _Key, exontrol.EXG2ANTTLib.ItemBarPropertyEnum.exBarCanStartLink, False) - _GanttControl.Items.set_ItemBar(CInt(_Item), _Key, exontrol.EXG2ANTTLib.ItemBarPropertyEnum.exBarCanBeLinked, False) - _GanttControl.Items.set_BarHAlignCaption(CInt(_Item), _Key, AlignmentEnum.LeftAlignment) - - Next - - _SQL = " select sum(t1.QTT),DATE_FORMAT(t2.DateExecution,'%Y-%m-%d')" - _SQL += " from InvoiceRows t1 join InvoiceHeader t2 on t1.InvoiceHeader=t2.Oid" - _SQL += " left join OrderInRows t3 on t1.OrderInRows=t3.Oid" - _SQL += " where t3.Products='" & row.Values(1) & "'" - _SQL += " AND t2.Customers='" & row.Values(0) & "'" - _SQL += " AND t1.GCRecord is null and t2.GCRecord is null AND t2.IsEditable=0" - _SQL += " GROUP BY DATE_FORMAT(t2.DateExecution,'%Y-%m-%d')" - _SQL += " order by DATE_FORMAT(t2.DateExecution,'%Y-%m-%d') DESC" - - - _SelectedData2 = _onew.Session.ExecuteQuery(_SQL) - For Each row2 As SelectStatementResultRow In _SelectedData2.ResultSet(0).Rows - Dim _AD As Double = 1 - - If Double.Parse(row.Values(2)) <> 0 Then - _AD = row2.Values(0) * 7 / Double.Parse(row.Values(2)) - End If - - - If _ProductsGantRows IsNot Nothing Then - If _ProductsGantRows.ManualRotation > 0 Then - _AD = row2.Values(0) * 7 / _ProductsGantRows.ManualRotation - End If - End If - - Dim _Key As String = Guid.NewGuid.ToString - _GanttControl.Items.AddBar(CInt(_Item), "Accounted", row2.Values(1), DateTime.Parse(row2.Values(1)).AddDays(_AD), _Key, row2.Values(0)) - _GanttControl.Items.set_ItemBar(CInt(_Item), _Key, exontrol.EXG2ANTTLib.ItemBarPropertyEnum.exBarCanResize, False) - _GanttControl.Items.set_ItemBar(CInt(_Item), _Key, exontrol.EXG2ANTTLib.ItemBarPropertyEnum.exBarCanMove, False) - _GanttControl.Items.set_ItemBar(CInt(_Item), _Key, exontrol.EXG2ANTTLib.ItemBarPropertyEnum.exBarCanStartLink, False) - _GanttControl.Items.set_ItemBar(CInt(_Item), _Key, exontrol.EXG2ANTTLib.ItemBarPropertyEnum.exBarCanBeLinked, False) - _GanttControl.Items.set_BarHAlignCaption(CInt(_Item), _Key, AlignmentEnum.LeftAlignment) - - Next - End If - End If - Next row - 'Catch ex As Exception - ' Throw New Exception(ex.Message) - 'Finally - - _WaitFormClass.FinalWork() - 'End Try + _WaitFormClass.FinalWork() + End Try @@ -366,7 +394,7 @@ Public Class ProductsGant_VC .HistogramPattern = PatternEnum.exPatternBox + PatternEnum.exPatternDot + PatternEnum.exPatternShadow .HistogramColor = Drawing.Color.Yellow .OverlaidType = OverlaidBarsTypeEnum.exOverlaidBarsStack - .OverlaidGroup = "Reported,Ordered,Accounted" + .OverlaidGroup = "Reported,Ordered,Accounted,Critical" End With With .Copy("Task", "Ordered") .Color = Drawing.Color.Black @@ -378,7 +406,7 @@ Public Class ProductsGant_VC .HistogramPattern = PatternEnum.exPatternBox + PatternEnum.exPatternDot + PatternEnum.exPatternShadow .HistogramColor = Drawing.Color.Pink .OverlaidType = OverlaidBarsTypeEnum.exOverlaidBarsStack - .OverlaidGroup = "Reported,Ordered,Accounted" + .OverlaidGroup = "Reported,Ordered,Accounted,Critical" End With With .Copy("Summary", "Reported") .Color = Drawing.Color.DarkGray @@ -393,7 +421,22 @@ Public Class ProductsGant_VC .HistogramPattern = PatternEnum.exPatternBox + PatternEnum.exPatternDot + PatternEnum.exPatternShadow + PatternEnum.exPatternEmpty .HistogramColor = Drawing.Color.Green .OverlaidType = OverlaidBarsTypeEnum.exOverlaidBarsStack - .OverlaidGroup = "Reported,Ordered,Accounted" + .OverlaidGroup = "Reported,Ordered,Accounted,Critical" + End With + With .Copy("Summary", "Critical") + .Color = Drawing.Color.DarkGray + .Shape = ShapeBarEnum.exShapeSolid + .StartShape = ShapeCornerEnum.exShapeIconUp3 + .EndShape = ShapeCornerEnum.exShapeIconDown3 + .HistogramRulerLinesColor = Drawing.Color.Black + .StartColor = Drawing.Color.Blue + .EndColor = Drawing.Color.Blue + .Pattern = PatternEnum.exPatternBox + PatternEnum.exPatternDot + PatternEnum.exPatternShadow + PatternEnum.exPatternEmpty + .Height = 18 + .HistogramPattern = PatternEnum.exPatternBox + PatternEnum.exPatternDot + PatternEnum.exPatternShadow + PatternEnum.exPatternEmpty + .HistogramColor = Drawing.Color.Green + .OverlaidType = OverlaidBarsTypeEnum.exOverlaidBarsStack + .OverlaidGroup = "Reported,Ordered,Accounted,Critical" End With With .Copy("Milestone", "OrderArrive") .StartShape = ShapeCornerEnum.exShapeIconVBar @@ -406,6 +449,7 @@ Public Class ProductsGant_VC .HistogramPattern = PatternEnum.exRectangularCurve + PatternEnum.exPatternDot + PatternEnum.exPatternShadow .HistogramColor = Drawing.Color.Red .OverlaidType = OverlaidBarsTypeEnum.exOverlaidBarsStack + .OverlaidGroup = "Reported,Ordered,Accounted,Critical" End With End With diff --git a/Nuvolar.Module/BusinessObjects/Business/BusinessTransactions/Invoice/InvoiceHeader.vb b/Nuvolar.Module/BusinessObjects/Business/BusinessTransactions/Invoice/InvoiceHeader.vb index 4900c41..c2c668c 100644 --- a/Nuvolar.Module/BusinessObjects/Business/BusinessTransactions/Invoice/InvoiceHeader.vb +++ b/Nuvolar.Module/BusinessObjects/Business/BusinessTransactions/Invoice/InvoiceHeader.vb @@ -151,6 +151,11 @@ Public Class InvoiceHeader Private _InvoiceFactoringParameter As InvoiceFactoringParameter ' Faktorálási paraméter !!! Private _InvoiceFactoringBank As InvoiceFactoringBank 'Bankba küldési csomag ! + 'NAV onlineszámla feladása + Private _NAV_transactionId As String + Private _NAV_InvoiceStatus As String + Private _NAV_queryDate As DateTime + '-- Nonpersistent objektumok a számla sor rögzítéséhez Private _row_CustomsTariffs As CustomsTariffs 'ITJ, SZJ, Vámtarifaszám stb. Private _row_ShortName As String 'Megnevezés @@ -1095,6 +1100,45 @@ Public Class InvoiceHeader SetPropertyValue("InvoiceFactoringBank", _InvoiceFactoringBank, value) End Set End Property + + 'NAV onlineszámla miatt + ''' + ''' NAV tranzakció azonosító Onlineszámla miatt + ''' + ''' + Property NAV_transactionId As String + Get + Return _NAV_transactionId + End Get + Set(value As String) + SetPropertyValue("NAV_transactionId", _NAV_transactionId, value) + End Set + End Property + ''' + ''' NAV számla állapota Online számla miatt + ''' + ''' + + Property NAV_InvoiceStatus As String + Get + Return _NAV_InvoiceStatus + End Get + Set(value As String) + SetPropertyValue("NAV_InvoiceStatus", _NAV_InvoiceStatus, value) + End Set + End Property + ''' + ''' NAV lekérdezés dátuma Onlineszámla miatt + ''' + ''' + Property NAV_queryDate As Date + Get + Return _NAV_queryDate + End Get + Set(value As Date) + SetPropertyValue("NAV_queryDate", _NAV_queryDate, value) + End Set + End Property '-- Nonpersistent property-k a számla sor rögzítéséhez diff --git a/Nuvolar.Module/BusinessObjects/Business/Products/ProductsGant.vb b/Nuvolar.Module/BusinessObjects/Business/Products/ProductsGant.vb index e5899ee..b929755 100644 --- a/Nuvolar.Module/BusinessObjects/Business/Products/ProductsGant.vb +++ b/Nuvolar.Module/BusinessObjects/Business/Products/ProductsGant.vb @@ -84,6 +84,9 @@ Public Class ProductsGant Get Dim _CC As String = " ProductsGant.Oid = '" & Me.Oid.ToString() & "'" + 'IDEIGLENES + '_CC += " AND Products.Oid ='81ed2085-6bf7-4c77-9906-d7165d0cbb8b'" + If String.IsNullOrEmpty(Criteria) = False Then _CC += " AND " & CriteriaOperator.Parse(Criteria).ToString() End If diff --git a/Nuvolar.Module/BusinessObjects/GeneralObjects/Customers/Customers.vb b/Nuvolar.Module/BusinessObjects/GeneralObjects/Customers/Customers.vb index bc72c6c..5c68545 100644 --- a/Nuvolar.Module/BusinessObjects/GeneralObjects/Customers/Customers.vb +++ b/Nuvolar.Module/BusinessObjects/GeneralObjects/Customers/Customers.vb @@ -93,6 +93,10 @@ Public Class Customers 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 @@ -577,7 +581,42 @@ Public Class Customers 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 diff --git a/Nuvolar.Module/BusinessObjects/GeneralObjects/Customers/CustomersFrom.vb b/Nuvolar.Module/BusinessObjects/GeneralObjects/Customers/CustomersFrom.vb index 85e74d1..9c938df 100644 --- a/Nuvolar.Module/BusinessObjects/GeneralObjects/Customers/CustomersFrom.vb +++ b/Nuvolar.Module/BusinessObjects/GeneralObjects/Customers/CustomersFrom.vb @@ -31,6 +31,11 @@ Public Class CustomersFrom '-- Ezek azok a cégek akik használják a programot Private _RabbitMQServerPassword As String Private _RabbitMQBodyEncryptCode As String + Private _NAV_login As String + Private _NAV_xmlSignkey As String + Private _NAV_password As String + Private _NAV_exchangeKey As String + Public Overrides Sub AfterConstruction() MyBase.AfterConstruction() IsDefault = False @@ -116,7 +121,54 @@ Public Class CustomersFrom '-- Ezek azok a cégek akik használják a programot SetPropertyValue("RabbitMQBodyEncryptCode", _RabbitMQBodyEncryptCode, value) End Set End Property - + ''' + ''' NAV felhasználó az Online számlához + ''' + ''' + Property NAV_login As String + Get + Return _NAV_login + End Get + Set(value As String) + SetPropertyValue("NAV_login", _NAV_login, value) + End Set + End Property + ''' + ''' NAV aláírókulcs az Online számlához + ''' + ''' + Property NAV_xmlSignkey As String + Get + Return _NAV_xmlSignkey + End Get + Set(value As String) + SetPropertyValue("NAV_xmlSignkey", _NAV_xmlSignkey, value) + End Set + End Property + ''' + ''' NAV jelszó az Online számlához + ''' + ''' + Property NAV_password As String + Get + Return _NAV_password + End Get + Set(value As String) + SetPropertyValue("NAV_password", _NAV_password, value) + End Set + End Property + ''' + ''' NAV cserekulcs az Online számlához + ''' + ''' + Property NAV_exchangeKey As String + Get + Return _NAV_exchangeKey + End Get + Set(value As String) + SetPropertyValue("NAV_exchangeKey", _NAV_exchangeKey, value) + End Set + End Property ReadOnly Property DefaultCustomerBankAccounts As CustomerBankAccounts Get Dim _CustomerBankAccounts As CustomerBankAccounts = Nothing diff --git a/Nuvolar.Win.Lite/WinApplication_DB.vb b/Nuvolar.Win.Lite/WinApplication_DB.vb index 5f3f454..0dbb9db 100644 --- a/Nuvolar.Win.Lite/WinApplication_DB.vb +++ b/Nuvolar.Win.Lite/WinApplication_DB.vb @@ -3,6 +3,9 @@ Imports DevExpress.ExpressApp Imports DevExpress.ExpressApp.Security Imports Nuvolar.Module Imports Nuvolar.Module.Win +Imports Nuvolar.Module.StaticClass +Imports DevExpress.ExpressApp.Xpo + Partial Public Class NuvolarWindowsFormsApplication Inherits WinApplication Implements IApplicationFactory @@ -108,6 +111,10 @@ Partial Public Class NuvolarWindowsFormsApplication GLOBAL_WINFormCaption = String.Format("Nuvolar Framework version: {0} [{1}]", Application.ProductVersion, anm.Version) GLOBAL_WINFormCaption += String.Format(", ({0}) Server: {1}, Database: {2}", _plattform, UCase(_ChangeLogon.SQLServer), UCase(_ChangeLogon.DBConnection)) GLOBAL_ApplicationStartupPath = Application.StartupPath & "\" + + Dim _ocur As IObjectSpace = CreateObjectSpace() + RestAPI.Init(TryCast(_ocur, XPObjectSpace)) + End Sub Protected Overrides Function OnLogonFailed(ByVal logonParameters As Object, ByVal e As Exception) As Boolean If WinChangeDatabaseHelper.SkipLogonDialog Then diff --git a/Nuvolar.Win.Lite/app.config b/Nuvolar.Win.Lite/app.config index 0390d6c..48f5054 100644 --- a/Nuvolar.Win.Lite/app.config +++ b/Nuvolar.Win.Lite/app.config @@ -9,7 +9,7 @@ - +