diff --git a/BeWo/BeWo.csproj b/BeWo/BeWo.csproj index 65d14c7a1..bb757c621 100644 --- a/BeWo/BeWo.csproj +++ b/BeWo/BeWo.csproj @@ -121,6 +121,7 @@ + @@ -399,6 +400,10 @@ Designer MSBuild:Compile + + MSBuild:Compile + Designer + Designer MSBuild:Compile @@ -1320,6 +1325,9 @@ CustomerVermittlungArbeitControl.xaml + + PdfViewer.xaml + ColorPicker.xaml diff --git a/BeWo/BeWoApp.xaml.cs b/BeWo/BeWoApp.xaml.cs index ffa0e051a..8251d73a7 100644 --- a/BeWo/BeWoApp.xaml.cs +++ b/BeWo/BeWoApp.xaml.cs @@ -987,6 +987,11 @@ namespace BeWo MessageBox.Show(message, "Information", MessageBoxButton.OK, MessageBoxImage.Exclamation); } + public static void ShowErrorMessage(string message) + { + MessageBox.Show(message, "Fehler", MessageBoxButton.OK, MessageBoxImage.Warning); + } + public static void ShowErrorMessage(Exception e) { if (e is FaultException) diff --git a/BeWo/Core/BeWoUtils.cs b/BeWo/Core/BeWoUtils.cs index d7f7a87e7..e211ad2ae 100644 --- a/BeWo/Core/BeWoUtils.cs +++ b/BeWo/Core/BeWoUtils.cs @@ -2018,6 +2018,19 @@ namespace BeWo.Core BeWoApp.MainControl.EndWaiting(); } + public static void ShowPdfWindow(byte[] bytes) + => ShowPdfWindow(new MemoryStream(bytes)); + public static void ShowPdfWindow(MemoryStream ms) + { + var control = new PdfViewer(); + + control.PdfData = ms; + + var window = BeWoWindowBuilder.GetBeWoWindow("eRechnung", control); + + window.Show(); + } + public static PasswortSecurityStrength CheckPasswordSecurity(string paswd) { PasswortSicherheit pwS = new PasswortSicherheit(); diff --git a/BeWo/DebugConfig.cs b/BeWo/DebugConfig.cs index 7facbb6e1..547d40d47 100644 --- a/BeWo/DebugConfig.cs +++ b/BeWo/DebugConfig.cs @@ -10,7 +10,8 @@ namespace BeWo FeatureCustomerWohnhilfe, FeatureWohnheimWohneinheit, FeatureAuswertungenQuittierungsbelege, - FeatureDakota + FeatureDakota, + FeatureXRechnung } public class DebugConfig @@ -130,6 +131,15 @@ namespace BeWo Profilename = "5000000000" }); + name2config.Add("FeatureXRechnung", + new DebugConfig() + { + DebugConfigMode = DebugConfigMode.FeatureXRechnung, + AutoLogin = true, + SelectView = UIContext.Finance, + SelectIndex = 7, + }); + return name2config; } #endif diff --git a/BeWo/View/Controls/PdfViewer.xaml b/BeWo/View/Controls/PdfViewer.xaml new file mode 100644 index 000000000..38380089a --- /dev/null +++ b/BeWo/View/Controls/PdfViewer.xaml @@ -0,0 +1,16 @@ + + + + + diff --git a/BeWo/View/Controls/PdfViewer.xaml.cs b/BeWo/View/Controls/PdfViewer.xaml.cs new file mode 100644 index 000000000..abcaed5d8 --- /dev/null +++ b/BeWo/View/Controls/PdfViewer.xaml.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace BeWo.View.Controls +{ + /// + /// Interaktionslogik für PdfViewerPopup.xaml + /// + public partial class PdfViewer : UserControl + { + /// + /// Hier ein Memory Stream dran binden + /// + public object PdfData + { + get { return (object)GetValue(PdfDataProperty); } + set { SetValue(PdfDataProperty, value); } + } + + // Using a DependencyProperty as the backing store for PdfData. This enables animation, styling, binding, etc... + public static readonly DependencyProperty PdfDataProperty = + DependencyProperty.Register("PdfData", typeof(object), typeof(PdfViewer), new PropertyMetadata(null)); + + public PdfViewer() + { + InitializeComponent(); + } + } +} diff --git a/BeWo/View/Detail/Accounting/InvoiceOverview.xaml b/BeWo/View/Detail/Accounting/InvoiceOverview.xaml index 2b3d7eb51..797a1ca55 100644 --- a/BeWo/View/Detail/Accounting/InvoiceOverview.xaml +++ b/BeWo/View/Detail/Accounting/InvoiceOverview.xaml @@ -1,157 +1,418 @@ - + - - - + + + - - + + - - - + + + - - - + + - - - - - - + + + + + + + diff --git a/BeWo/View/Detail/Accounting/InvoiceOverview.xaml.cs b/BeWo/View/Detail/Accounting/InvoiceOverview.xaml.cs index 3c1bce601..89242ba9d 100644 --- a/BeWo/View/Detail/Accounting/InvoiceOverview.xaml.cs +++ b/BeWo/View/Detail/Accounting/InvoiceOverview.xaml.cs @@ -10,6 +10,7 @@ using System.Windows.Navigation; using System.Windows.Threading; using BeWo.Core; using BeWo.ServiceProxy; +using BeWo.View.Controls; using BeWo.ViewModel; using BeWo.ViewModel.ListViewModel; @@ -21,6 +22,7 @@ using BS.Shared.Translation; using DevExpress.Xpf.Editors; using DevExpress.Xpf.Grid; using Microsoft.Win32; +using Newtonsoft.Json; namespace BeWo.View.Detail.Accounting { @@ -624,5 +626,16 @@ namespace BeWo.View.Detail.Accounting return list; } + + private void button_eRechnung_Click(object sender, RoutedEventArgs e) + { + var res = ServiceFacade.DoAccountingServiceSync(x => x.GetXRechnung(null)); + + if (res.HasErrors) + BeWoApp.ShowErrorMessage("Fehler: " + res.ResponseString); + else + BeWoUtils.ShowPdfWindow(res.ResponseBytes); + + } } } \ No newline at end of file diff --git a/Service/ServiceImplementations/AccountingServiceImp.cs b/Service/ServiceImplementations/AccountingServiceImp.cs index 36c7a1907..38771203d 100644 --- a/Service/ServiceImplementations/AccountingServiceImp.cs +++ b/Service/ServiceImplementations/AccountingServiceImp.cs @@ -30,6 +30,8 @@ using BS.Shared.AppSender; using BeWo.Data.Security; using BeWo.Data.Models.XRechnung; using BS.Shared.DataContracts.Invoicing.XRechnung; +using BeWo.Service.ServiceUtils.XRechnung; +using System.IO; namespace BeWo.Service.ServiceImplementations { @@ -750,7 +752,21 @@ namespace BeWo.Service.ServiceImplementations public XRechnungResponse GetXRechnung(XRechnungRequest req) { - return null; + try + { + var str = File.ReadAllText(@"C:\dev\invoicetest.json", System.Text.Encoding.UTF8); + var xrec = JsonConvert.DeserializeObject(str); + + var url = "https://app5.bewoplaner.de/service/DownloadFile.aspx?key=jhkf4589141324h6543958"; + + var response = XRechnungSender.Send(xrec, url); + + return response; + } + catch (Exception e) + { + throw Utils.CreateBeWoFaultException(e); + } } #region GKV diff --git a/Shared/DataContracts/AppResponseDC.cs b/Shared/DataContracts/AppResponseDC.cs index ac01ac7e9..90994c38b 100644 --- a/Shared/DataContracts/AppResponseDC.cs +++ b/Shared/DataContracts/AppResponseDC.cs @@ -8,7 +8,7 @@ using System.Threading.Tasks; namespace BS.Shared.DataContracts { [DataContract] - public abstract class AppResponseDC + public abstract class AppResponseDC : IDataContract { [DataMember] public bool Success { get; set; } [DataMember] public string Message { get; set; } diff --git a/Shared/DataContracts/Invoicing/XRechnung/XRechnungRequest.cs b/Shared/DataContracts/Invoicing/XRechnung/XRechnungRequest.cs index a34931014..e8b5c3f19 100644 --- a/Shared/DataContracts/Invoicing/XRechnung/XRechnungRequest.cs +++ b/Shared/DataContracts/Invoicing/XRechnung/XRechnungRequest.cs @@ -3,6 +3,7 @@ using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; +using System.Runtime.Serialization; using System.Text; using System.Threading.Tasks; @@ -10,9 +11,8 @@ namespace BS.Shared.DataContracts.Invoicing.XRechnung { public class XRechnungRequest : OwnSoftRequest { - public string XRechnung { get; set; } - - public string Url { get; set; } + [DataMember] public string XRechnung { get; set; } + [DataMember] public string Url { get; set; } public void SetXRechnung(object obj) { diff --git a/Shared/DataContracts/Invoicing/XRechnung/XRechnungResponse.cs b/Shared/DataContracts/Invoicing/XRechnung/XRechnungResponse.cs index 2d537b8ce..ff7ea8de5 100644 --- a/Shared/DataContracts/Invoicing/XRechnung/XRechnungResponse.cs +++ b/Shared/DataContracts/Invoicing/XRechnung/XRechnungResponse.cs @@ -3,6 +3,7 @@ using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; +using System.Runtime.Serialization; using System.Text; using System.Threading.Tasks; @@ -10,13 +11,18 @@ namespace BS.Shared.DataContracts.Invoicing.XRechnung { public class XRechnungResponse : OwnSoftResponse { - public byte[] ResponseBytes { get; set; } - public string ResponseString { get; set; } - public List Errors { get; set; } + [DataMember] public byte[] ResponseBytes { get; set; } + [DataMember] public string ResponseString { get; set; } + [DataMember] public List Errors { get; set; } public bool HasErrors => Errors is object && Errors.Any(); - private XRechnungResponse(byte[] res_bytes) + private XRechnungResponse() + { + + } + + private XRechnungResponse(byte[] res_bytes) : this() { ResponseBytes = res_bytes; } diff --git a/Shared/DataContracts/OwnSoftRequest.cs b/Shared/DataContracts/OwnSoftRequest.cs index dd5b0dccf..6fbb46896 100644 --- a/Shared/DataContracts/OwnSoftRequest.cs +++ b/Shared/DataContracts/OwnSoftRequest.cs @@ -1,12 +1,14 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Runtime.Serialization; using System.Text; using System.Threading.Tasks; namespace BS.Shared.DataContracts { - public class OwnSoftRequest + [DataContract] + public class OwnSoftRequest : IDataContract { } } diff --git a/Shared/DataContracts/OwnSoftResponse.cs b/Shared/DataContracts/OwnSoftResponse.cs index 58720b6ab..bd8441d77 100644 --- a/Shared/DataContracts/OwnSoftResponse.cs +++ b/Shared/DataContracts/OwnSoftResponse.cs @@ -1,12 +1,14 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Runtime.Serialization; using System.Text; using System.Threading.Tasks; namespace BS.Shared.DataContracts { - public class OwnSoftResponse + [DataContract] + public class OwnSoftResponse : IDataContract { } }