Compare commits
4 Commits
v1.0.3.3
...
23db4de1ee
| Author | SHA1 | Date | |
|---|---|---|---|
| 23db4de1ee | |||
| 9e5f709d42 | |||
| 4cd7ef85a1 | |||
| 2c0b000073 |
@@ -100,6 +100,12 @@
|
|||||||
<td></td>
|
<td></td>
|
||||||
<td></td>
|
<td></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="8">Davon abgewertet:</td>
|
||||||
|
<td colspan="2" class="number">@($"{Model.Data.Rows.Where(p => p.IsDepreciated).Sum(p => p.Weight):N0}")</td>
|
||||||
|
<td></td>
|
||||||
|
<td></td>
|
||||||
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
@Raw(BusinessDocument.PrintSortenaufteilung(Model.MemberStats))
|
@Raw(BusinessDocument.PrintSortenaufteilung(Model.MemberStats))
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>WinExe</OutputType>
|
<OutputType>WinExe</OutputType>
|
||||||
<TargetFramework>net10.0-windows</TargetFramework>
|
<TargetFramework>net10.0-windows</TargetFramework>
|
||||||
|
<PlatformTarget>x64</PlatformTarget>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<UseWPF>true</UseWPF>
|
<UseWPF>true</UseWPF>
|
||||||
<UseWindowsForms>true</UseWindowsForms>
|
<UseWindowsForms>true</UseWindowsForms>
|
||||||
@@ -22,6 +23,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<PackageReference Include="bblanchon.PDFium.Win32" Version="147.0.7690" />
|
||||||
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
|
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
|
||||||
<PackageReference Include="LinqKit" Version="1.3.9" />
|
<PackageReference Include="LinqKit" Version="1.3.9" />
|
||||||
<PackageReference Include="MailKit" Version="4.14.1" />
|
<PackageReference Include="MailKit" Version="4.14.1" />
|
||||||
@@ -31,15 +33,12 @@
|
|||||||
<PackageReference Include="Microsoft.Extensions.Configuration.Ini" Version="10.0.2" />
|
<PackageReference Include="Microsoft.Extensions.Configuration.Ini" Version="10.0.2" />
|
||||||
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.3650.58" />
|
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.3650.58" />
|
||||||
<PackageReference Include="NJsonSchema" Version="11.5.2" />
|
<PackageReference Include="NJsonSchema" Version="11.5.2" />
|
||||||
<PackageReference Include="PdfiumViewer.Updated" Version="2.14.5" />
|
|
||||||
<PackageReference Include="PdfiumViewer.Native.x86_64.no_v8-no_xfa" Version="2018.4.8.256" />
|
|
||||||
<PackageReference Include="RazorLight" Version="2.3.1" />
|
<PackageReference Include="RazorLight" Version="2.3.1" />
|
||||||
<PackageReference Include="ScottPlot.WPF" Version="5.1.57" />
|
<PackageReference Include="ScottPlot.WPF" Version="5.1.57" />
|
||||||
<PackageReference Include="SQLitePCLRaw.bundle_e_sqlite3" Version="3.0.2" />
|
<PackageReference Include="SQLitePCLRaw.bundle_e_sqlite3" Version="3.0.2" />
|
||||||
<PackageReference Include="System.IO.Hashing" Version="10.0.2" />
|
<PackageReference Include="System.IO.Hashing" Version="10.0.2" />
|
||||||
<PackageReference Include="System.IO.Ports" Version="10.0.2" />
|
<PackageReference Include="System.IO.Ports" Version="10.0.2" />
|
||||||
<PackageReference Include="System.Management" Version="10.0.2" />
|
<PackageReference Include="System.Management" Version="10.0.2" />
|
||||||
<PackageReference Include="System.Text.Encoding.CodePages" Version="10.0.2" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ namespace Elwig.Helpers {
|
|||||||
public static class AppDbUpdater {
|
public static class AppDbUpdater {
|
||||||
|
|
||||||
// Don't forget to update value in Tests/fetch-resources.bat!
|
// Don't forget to update value in Tests/fetch-resources.bat!
|
||||||
public static readonly int RequiredSchemaVersion = 36;
|
public static readonly int RequiredSchemaVersion = 37;
|
||||||
|
|
||||||
private static int VersionOffset = 0;
|
private static int VersionOffset = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using Elwig.Windows;
|
using Elwig.Windows;
|
||||||
using PdfiumViewer;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
@@ -27,6 +26,7 @@ namespace Elwig.Helpers.Printing {
|
|||||||
public static bool IsReady => WinziPrintProc != null;
|
public static bool IsReady => WinziPrintProc != null;
|
||||||
|
|
||||||
public static async Task Init(Action? evtHandler = null) {
|
public static async Task Init(Action? evtHandler = null) {
|
||||||
|
PdfiumNative.FPDF_InitLibrary();
|
||||||
// NOTE: If the WinziPrint daemon is already running this will succeed, but the process will fail.
|
// NOTE: If the WinziPrint daemon is already running this will succeed, but the process will fail.
|
||||||
// Should be no problem, as long as the daemon is not closed
|
// Should be no problem, as long as the daemon is not closed
|
||||||
var p = new Process() { StartInfo = new() {
|
var p = new Process() { StartInfo = new() {
|
||||||
@@ -47,6 +47,7 @@ namespace Elwig.Helpers.Printing {
|
|||||||
public static Task Cleanup() {
|
public static Task Cleanup() {
|
||||||
WinziPrintProc?.Kill(true);
|
WinziPrintProc?.Kill(true);
|
||||||
WinziPrintProc?.Close();
|
WinziPrintProc?.Close();
|
||||||
|
PdfiumNative.FPDF_DestroyLibrary();
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -123,9 +124,9 @@ namespace Elwig.Helpers.Printing {
|
|||||||
|
|
||||||
public static Task Print(string path, PrinterSettings settings) {
|
public static Task Print(string path, PrinterSettings settings) {
|
||||||
try {
|
try {
|
||||||
using var doc = PdfDocument.Load(path);
|
using var printDoc = new PdfPrintDocument(path) {
|
||||||
using var printDoc = doc.CreatePrintDocument(PdfPrintMode.CutMargin);
|
PrinterSettings = settings,
|
||||||
printDoc.PrinterSettings = settings;
|
};
|
||||||
printDoc.Print();
|
printDoc.Print();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
MessageBox.Show("Beim Drucken ist ein Fehler aufgetreten:\n\n" + e.Message, "Fehler beim Drucken", MessageBoxButton.OK, MessageBoxImage.Error);
|
MessageBox.Show("Beim Drucken ist ein Fehler aufgetreten:\n\n" + e.Message, "Fehler beim Drucken", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
|
|||||||
102
Elwig/Helpers/Printing/PdfPrintDocument.cs
Normal file
102
Elwig/Helpers/Printing/PdfPrintDocument.cs
Normal file
@@ -0,0 +1,102 @@
|
|||||||
|
using System;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Drawing.Imaging;
|
||||||
|
using System.Drawing.Printing;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
namespace Elwig.Helpers.Printing {
|
||||||
|
public class PdfPrintDocument : PrintDocument {
|
||||||
|
|
||||||
|
private readonly IntPtr _handle;
|
||||||
|
private readonly int _pageCount;
|
||||||
|
private readonly double _dpi;
|
||||||
|
|
||||||
|
private int _currentPage;
|
||||||
|
|
||||||
|
public PdfPrintDocument(string path, string? password = null, double dpi = 300.0) :
|
||||||
|
base() {
|
||||||
|
_handle = PdfiumNative.FPDF_LoadDocument(path, password);
|
||||||
|
_pageCount = PdfiumNative.FPDF_GetPageCount(_handle);
|
||||||
|
_dpi = dpi;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Dispose(bool disposing) {
|
||||||
|
PdfiumNative.FPDF_CloseDocument(_handle);
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnBeginPrint(PrintEventArgs evt) {
|
||||||
|
_currentPage = (PrinterSettings.FromPage != 0) ? (PrinterSettings.FromPage - 1) : 0;
|
||||||
|
base.OnBeginPrint(evt);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnPrintPage(PrintPageEventArgs evt) {
|
||||||
|
if (_currentPage < _pageCount) {
|
||||||
|
IntPtr page = PdfiumNative.FPDF_LoadPage(_handle, _currentPage);
|
||||||
|
double width = PdfiumNative.FPDF_GetPageWidth(page);
|
||||||
|
double height = PdfiumNative.FPDF_GetPageHeight(page);
|
||||||
|
int pixelWidth = (int)(width / 72.0 * _dpi);
|
||||||
|
int pixelHeight = (int)(height / 72.0 * _dpi);
|
||||||
|
|
||||||
|
IntPtr bitmap = PdfiumNative.FPDFBitmap_Create(pixelWidth, pixelHeight, 1);
|
||||||
|
PdfiumNative.FPDF_RenderPageBitmap(bitmap, page, 0, 0, pixelWidth, pixelHeight, 0, 0);
|
||||||
|
|
||||||
|
IntPtr buffer = PdfiumNative.FPDFBitmap_GetBuffer(bitmap);
|
||||||
|
int stride = PdfiumNative.FPDFBitmap_GetStride(bitmap);
|
||||||
|
using (var bmp = new Bitmap(pixelWidth, pixelHeight, stride, PixelFormat.Format32bppArgb, buffer)) {
|
||||||
|
evt.Graphics?.DrawImage(bmp, evt.PageBounds);
|
||||||
|
}
|
||||||
|
_currentPage++;
|
||||||
|
|
||||||
|
PdfiumNative.FPDFBitmap_Destroy(bitmap);
|
||||||
|
PdfiumNative.FPDF_ClosePage(page);
|
||||||
|
}
|
||||||
|
evt.HasMorePages = _currentPage < ((PrinterSettings.ToPage == 0) ? _pageCount : Math.Min(PrinterSettings.ToPage, _pageCount));
|
||||||
|
base.OnPrintPage(evt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
internal partial class PdfiumNative {
|
||||||
|
[LibraryImport("pdfium.dll")]
|
||||||
|
public static partial void FPDF_InitLibrary();
|
||||||
|
|
||||||
|
[LibraryImport("pdfium.dll")]
|
||||||
|
public static partial void FPDF_DestroyLibrary();
|
||||||
|
|
||||||
|
[LibraryImport("pdfium.dll", StringMarshalling = StringMarshalling.Utf8)]
|
||||||
|
public static partial IntPtr FPDF_LoadDocument(string filePath, string? password);
|
||||||
|
|
||||||
|
[LibraryImport("pdfium.dll")]
|
||||||
|
public static partial void FPDF_CloseDocument(IntPtr document);
|
||||||
|
|
||||||
|
[LibraryImport("pdfium.dll")]
|
||||||
|
public static partial int FPDF_GetPageCount(IntPtr document);
|
||||||
|
|
||||||
|
[LibraryImport("pdfium.dll")]
|
||||||
|
public static partial IntPtr FPDF_LoadPage(IntPtr document, int pageIndex);
|
||||||
|
|
||||||
|
[LibraryImport("pdfium.dll")]
|
||||||
|
public static partial void FPDF_ClosePage(IntPtr page);
|
||||||
|
|
||||||
|
[LibraryImport("pdfium.dll")]
|
||||||
|
public static partial double FPDF_GetPageWidth(IntPtr page);
|
||||||
|
|
||||||
|
[LibraryImport("pdfium.dll")]
|
||||||
|
public static partial double FPDF_GetPageHeight(IntPtr page);
|
||||||
|
|
||||||
|
[LibraryImport("pdfium.dll")]
|
||||||
|
public static partial IntPtr FPDFBitmap_Create(int width, int height, int alpha);
|
||||||
|
|
||||||
|
[LibraryImport("pdfium.dll")]
|
||||||
|
public static partial void FPDFBitmap_Destroy(IntPtr bitmap);
|
||||||
|
|
||||||
|
[LibraryImport("pdfium.dll")]
|
||||||
|
public static partial IntPtr FPDFBitmap_GetBuffer(IntPtr bitmap);
|
||||||
|
|
||||||
|
[LibraryImport("pdfium.dll")]
|
||||||
|
public static partial int FPDFBitmap_GetStride(IntPtr bitmap);
|
||||||
|
|
||||||
|
[LibraryImport("pdfium.dll")]
|
||||||
|
public static partial void FPDF_RenderPageBitmap(IntPtr bitmap, IntPtr page, int start_x, int start_y, int size_x, int size_y, int rotate, int flags);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -75,6 +75,7 @@ namespace Elwig.Models.Dtos {
|
|||||||
public string? Attribute;
|
public string? Attribute;
|
||||||
public string? Cultivation;
|
public string? Cultivation;
|
||||||
public string QualityLevel;
|
public string QualityLevel;
|
||||||
|
public bool IsDepreciated;
|
||||||
public (double Oe, double Kmw) Gradation;
|
public (double Oe, double Kmw) Gradation;
|
||||||
public string[] Modifiers;
|
public string[] Modifiers;
|
||||||
public int Weight;
|
public int Weight;
|
||||||
@@ -89,17 +90,15 @@ namespace Elwig.Models.Dtos {
|
|||||||
Attribute = p.Attribute?.Name;
|
Attribute = p.Attribute?.Name;
|
||||||
Cultivation = p.Cultivation?.Name;
|
Cultivation = p.Cultivation?.Name;
|
||||||
QualityLevel = p.Quality.Name;
|
QualityLevel = p.Quality.Name;
|
||||||
|
IsDepreciated = p.QualId == "WEI";
|
||||||
Gradation = (p.Oe, p.Kmw);
|
Gradation = (p.Oe, p.Kmw);
|
||||||
Modifiers = p.Modifiers
|
Modifiers = [.. p.Modifiers.Select(m => m.Name)];
|
||||||
.Select(m => m.Name)
|
|
||||||
.ToArray();
|
|
||||||
Weight = p.Weight;
|
Weight = p.Weight;
|
||||||
IsNetWeight = p.IsNetWeight;
|
IsNetWeight = p.IsNetWeight;
|
||||||
Buckets = p.Buckets
|
Buckets = [.. p.Buckets
|
||||||
.Where(b => b.Value > 0)
|
.Where(b => b.Value > 0)
|
||||||
.OrderByDescending(b => b.BktNr)
|
.OrderByDescending(b => b.BktNr)
|
||||||
.Select(b => (b.Discr == "_" ? "ungeb." : $"geb. {p.SortId}{b.Discr}", b.Value))
|
.Select(b => (b.Discr == "_" ? "ungeb." : $"geb. {p.SortId}{b.Discr}", b.Value))];
|
||||||
.ToArray();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
-- schema version 34 to 35
|
-- schema version 34 to 35
|
||||||
|
|
||||||
|
UPDATE client_parameter SET value = '0' WHERE param = 'ENABLE_TIME_TRIGGERS';
|
||||||
ALTER TABLE delivery_part ADD COLUMN unloading TEXT DEFAULT NULL;
|
ALTER TABLE delivery_part ADD COLUMN unloading TEXT DEFAULT NULL;
|
||||||
UPDATE delivery_part SET unloading = 'pumped' WHERE lesewagen;
|
UPDATE delivery_part SET unloading = 'pumped' WHERE lesewagen;
|
||||||
UPDATE delivery_part SET unloading = 'box' WHERE (SELECT zwstid IN ('H','S') FROM delivery d WHERE (d.year, d.did) = (delivery_part.year, delivery_part.did));
|
UPDATE delivery_part SET unloading = 'box' WHERE (SELECT zwstid IN ('H','S') FROM delivery d WHERE (d.year, d.did) = (delivery_part.year, delivery_part.did));
|
||||||
ALTER TABLE delivery_part DROP COLUMN lesewagen;
|
ALTER TABLE delivery_part DROP COLUMN lesewagen;
|
||||||
|
UPDATE client_parameter SET value = '1' WHERE param = 'ENABLE_TIME_TRIGGERS';
|
||||||
|
|||||||
12
Elwig/Resources/Sql/36-37.sql
Normal file
12
Elwig/Resources/Sql/36-37.sql
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
-- schema version 36 to 37
|
||||||
|
|
||||||
|
UPDATE client_parameter SET value = '0' WHERE param = 'ENABLE_TIME_TRIGGERS';
|
||||||
|
|
||||||
|
-- fix old deliveries
|
||||||
|
UPDATE delivery SET xtime = NULL, mtime = ctime WHERE year <= 2022 AND mtime >= 1768521600 AND mtime < 1772323200;
|
||||||
|
UPDATE delivery_part SET xtime = NULL, mtime = ctime WHERE year <= 2022 AND mtime >= 1768521600 AND mtime < 1772323200;
|
||||||
|
-- clear xtime at one laptop to force updates from this one
|
||||||
|
UPDATE delivery SET xtime = NULL WHERE year >= 2023 AND xtime >= 1771200000 AND xtime < 1771286400;
|
||||||
|
UPDATE delivery_part SET xtime = NULL WHERE year >= 2023 AND xtime >= 1771200000 AND xtime < 1771286400;
|
||||||
|
|
||||||
|
UPDATE client_parameter SET value = '1' WHERE param = 'ENABLE_TIME_TRIGGERS';
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
Programmiersprache: C#<LineBreak/>
|
Programmiersprache: C#<LineBreak/>
|
||||||
Framework: Windows Presentation Framework (WPF)<LineBreak/>
|
Framework: Windows Presentation Framework (WPF)<LineBreak/>
|
||||||
Datenbank: <Hyperlink NavigateUri="https://sqlite.org/" RequestNavigate="Hyperlink_RequestNavigate">SQLite</Hyperlink><LineBreak/>
|
Datenbank: <Hyperlink NavigateUri="https://sqlite.org/" RequestNavigate="Hyperlink_RequestNavigate">SQLite</Hyperlink><LineBreak/>
|
||||||
PDF-Erstellung: <Hyperlink NavigateUri="https://weasyprint.org/" RequestNavigate="Hyperlink_RequestNavigate">WeasyPrint</Hyperlink>, <Hyperlink NavigateUri="https://github.com/toddams/RazorLight" RequestNavigate="Hyperlink_RequestNavigate">RazorLight</Hyperlink>, <Hyperlink NavigateUri="https://github.com/pvginkel/PdfiumViewer" RequestNavigate="Hyperlink_RequestNavigate">PdfiumViewer</Hyperlink><LineBreak/>
|
PDF-Erstellung: <Hyperlink NavigateUri="https://weasyprint.org/" RequestNavigate="Hyperlink_RequestNavigate">WeasyPrint</Hyperlink>, <Hyperlink NavigateUri="https://github.com/toddams/RazorLight" RequestNavigate="Hyperlink_RequestNavigate">RazorLight</Hyperlink>, <Hyperlink NavigateUri="https://github.com/bblanchon/pdfium-binaries" RequestNavigate="Hyperlink_RequestNavigate">Pdfium</Hyperlink><LineBreak/>
|
||||||
Paketierung: <Hyperlink NavigateUri="https://www.firegiant.com/wixtoolset/" RequestNavigate="Hyperlink_RequestNavigate">WiX Toolset</Hyperlink>
|
Paketierung: <Hyperlink NavigateUri="https://www.firegiant.com/wixtoolset/" RequestNavigate="Hyperlink_RequestNavigate">WiX Toolset</Hyperlink>
|
||||||
</TextBlock>
|
</TextBlock>
|
||||||
|
|
||||||
|
|||||||
@@ -248,7 +248,7 @@
|
|||||||
<Button x:Name="BreakdownButton"
|
<Button x:Name="BreakdownButton"
|
||||||
Click="BreakdownButton_Click"
|
Click="BreakdownButton_Click"
|
||||||
Margin="195,90,0,10" Width="190" Padding="3,5,5,5"
|
Margin="195,90,0,10" Width="190" Padding="3,5,5,5"
|
||||||
ToolTip="Aufschlüsselung der Menge nach Zweigstelle, Mitglied, Sorte, Attribut/Bewirt., Qualitätsstufe, gebunden/ungebunden">
|
ToolTip="Aufschlüsselung der Menge nach Zweigstelle, Sorte, Attribut/Bewirt., Qualitätsstufe, gebunden/ungebunden">
|
||||||
<Grid>
|
<Grid>
|
||||||
<TextBlock FontFamily="Segoe MDL2 Assets" FontSize="16" Text=""
|
<TextBlock FontFamily="Segoe MDL2 Assets" FontSize="16" Text=""
|
||||||
TextAlignment="Left" HorizontalAlignment="Left" Padding="6.5,0.5,0,0"/>
|
TextAlignment="Left" HorizontalAlignment="Left" Padding="6.5,0.5,0,0"/>
|
||||||
|
|||||||
@@ -43,5 +43,5 @@ Packaging: [WiX Toolset](https://www.firegiant.com/wixtoolset/)
|
|||||||
Programmiersprache: C#
|
Programmiersprache: C#
|
||||||
Framework: Windows Presentation Framework (WPF)
|
Framework: Windows Presentation Framework (WPF)
|
||||||
Datenbank: [SQLite](https://sqlite.org/)
|
Datenbank: [SQLite](https://sqlite.org/)
|
||||||
PDF-Erstellung: [WeasyPrint](https://weasyprint.org/), [RazorLight](https://github.com/toddams/RazorLight), [PdfiumViewer](https://github.com/pvginkel/PdfiumViewer)
|
PDF-Erstellung: [WeasyPrint](https://weasyprint.org/), [RazorLight](https://github.com/toddams/RazorLight), [Pdfium](https://github.com/bblanchon/pdfium-binaries)
|
||||||
Paketierung: [WiX Toolset](https://www.firegiant.com/wixtoolset/)
|
Paketierung: [WiX Toolset](https://www.firegiant.com/wixtoolset/)
|
||||||
|
|||||||
Reference in New Issue
Block a user