Compare commits
14 Commits
4daa6deb26
...
v0.6.5
| Author | SHA1 | Date | |
|---|---|---|---|
| 9a39879804 | |||
| 11be424c38 | |||
| 1b9064a97c | |||
| 805f782c83 | |||
| 912206f52d | |||
| 825bd6f304 | |||
| 9ecad6aa79 | |||
| 68f1a2c091 | |||
| 59cd69ddaf | |||
| 7c23f9bdae | |||
| 6d53e35399 | |||
| 42eb68d431 | |||
| 0591d91f49 | |||
| befe6a753b |
@@ -0,0 +1,55 @@
|
|||||||
|
name: Deploy
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags: ["v[0-9]+.[0-9]+.[0-9]+"]
|
||||||
|
jobs:
|
||||||
|
deploy:
|
||||||
|
name: Build and Deploy
|
||||||
|
runs-on: windows-latest
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
steps:
|
||||||
|
- name: Set APP_VERSION variable from tag
|
||||||
|
shell: powershell
|
||||||
|
run: |
|
||||||
|
$APP_VERSION = $env:GITHUB_REF -replace '^refs/tags/v', ''
|
||||||
|
Add-Content -Path $env:GITHUB_ENV -Value "APP_VERSION=$APP_VERSION"
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Check version in project
|
||||||
|
shell: powershell
|
||||||
|
run: |
|
||||||
|
Select-String Elwig/Elwig.csproj -Pattern "<Version>"
|
||||||
|
$res = Select-String Elwig/Elwig.csproj -Pattern "<Version>${{ env.APP_VERSION }}</Version>"
|
||||||
|
if ($res -eq $null) {
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
- name: Setup MSBuild
|
||||||
|
uses: microsoft/setup-msbuild@v1.1
|
||||||
|
- name: Setup NuGet
|
||||||
|
uses: nuget/setup-nuget@v1
|
||||||
|
- name: Restore NuGet packages
|
||||||
|
shell: powershell
|
||||||
|
run: $(& nuget restore Elwig.sln; $a=$lastexitcode) | findstr x*; exit $a
|
||||||
|
- name: Build Setup
|
||||||
|
shell: powershell
|
||||||
|
run: $(& msbuild -verbosity:quiet Setup/Setup.wixproj -property:Configuration=Release -property:Platform=x64; $a=$lastexitcode) | findstr x*; exit $a
|
||||||
|
- name: Rename artifact
|
||||||
|
shell: powershell
|
||||||
|
run: Move-Item Setup/bin/x64/Release/Elwig.exe Setup/bin/x64/Release/Elwig-${{ env.APP_VERSION }}.exe
|
||||||
|
- name: Create release
|
||||||
|
uses: akkuman/gitea-release-action@v1
|
||||||
|
with:
|
||||||
|
name: Elwig ${{ env.APP_VERSION }}
|
||||||
|
files: |-
|
||||||
|
Setup/bin/x64/Release/Elwig-${{ env.APP_VERSION }}.exe
|
||||||
|
- name: Upload to website
|
||||||
|
shell: powershell
|
||||||
|
run: |
|
||||||
|
$content = [System.IO.File]::ReadAllBytes("Setup/bin/x64/Release/Elwig-${{ env.APP_VERSION }}.exe")
|
||||||
|
Invoke-WebRequest `
|
||||||
|
-Uri "https://www.necronda.net/elwig/files/Elwig-${{ env.APP_VERSION }}.exe" `
|
||||||
|
-Method PUT `
|
||||||
|
-Body $content `
|
||||||
|
-Headers @{ Authorization = "${{ secrets.API_AUTHORIZATION }}" } `
|
||||||
|
-ContentType "application/octet-stream"
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
name: Test
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: ["**"]
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
name: Run tests
|
||||||
|
runs-on: windows-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Setup MSBuild
|
||||||
|
uses: microsoft/setup-msbuild@v1.1
|
||||||
|
- name: Setup NuGet
|
||||||
|
uses: nuget/setup-nuget@v1
|
||||||
|
- name: Restore NuGet packages
|
||||||
|
shell: powershell
|
||||||
|
run: $(& nuget restore Elwig.sln; $a=$lastexitcode) | findstr x*; exit $a
|
||||||
|
- name: Build Elwig
|
||||||
|
shell: powershell
|
||||||
|
run: $(& msbuild -verbosity:quiet Elwig/Elwig.csproj -property:Configuration=Debug; $a=$lastexitcode) | findstr x*; exit $a
|
||||||
|
- name: Build Tests
|
||||||
|
shell: powershell
|
||||||
|
run: $(& dotnet build Tests; $a=$lastexitcode) | findstr x*; exit $a
|
||||||
|
- name: Run Tests
|
||||||
|
shell: powershell
|
||||||
|
run: |
|
||||||
|
$env:PATH += ";$(pwd)\Installer\Files"
|
||||||
|
$(& dotnet test Tests; $a=$lastexitcode) | findstr x*; exit $a
|
||||||
@@ -4,3 +4,5 @@ bin/
|
|||||||
.vs
|
.vs
|
||||||
.idea
|
.idea
|
||||||
Tests/Resources/Sql/Create.sql
|
Tests/Resources/Sql/Create.sql
|
||||||
|
*.exe
|
||||||
|
!WinziPrint.exe
|
||||||
|
|||||||
+17
-18
@@ -141,26 +141,10 @@ namespace Elwig {
|
|||||||
MessageBox.Show("Invalid branch name in config!", "Invalid Branch Config", MessageBoxButton.OK, MessageBoxImage.Error);
|
MessageBox.Show("Invalid branch name in config!", "Invalid Branch Config", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
Shutdown();
|
Shutdown();
|
||||||
} else {
|
} else {
|
||||||
var entry = branches[Config.Branch.ToLower()];
|
SetBranch(branches[Config.Branch.ToLower()]);
|
||||||
ZwstId = entry.Item1;
|
|
||||||
BranchName = entry.Item2;
|
|
||||||
BranchPlz = entry.Item3;
|
|
||||||
BranchLocation = entry.Item4?.Split(" im ")[0].Split(" an ")[0].Split(" bei ")[0]; // FIXME
|
|
||||||
BranchAddress = entry.Item5;
|
|
||||||
BranchPhoneNr = entry.Item6;
|
|
||||||
BranchFaxNr = entry.Item7;
|
|
||||||
BranchMobileNr = entry.Item8;
|
|
||||||
}
|
}
|
||||||
} else if (branches.Count == 1) {
|
} else if (branches.Count == 1) {
|
||||||
var entry = branches.First().Value;
|
SetBranch(branches.First().Value);
|
||||||
ZwstId = entry.Item1;
|
|
||||||
BranchName = entry.Item2;
|
|
||||||
BranchPlz = entry.Item3;
|
|
||||||
BranchLocation = entry.Item4?.Split(" im ")[0].Split(" an ")[0].Split(" bei ")[0]; // FIXME
|
|
||||||
BranchAddress = entry.Item5;
|
|
||||||
BranchPhoneNr = entry.Item6;
|
|
||||||
BranchFaxNr = entry.Item7;
|
|
||||||
BranchMobileNr = entry.Item8;
|
|
||||||
} else {
|
} else {
|
||||||
MessageBox.Show("Unable to determine local branch!", "Invalid Branch Config", MessageBoxButton.OK, MessageBoxImage.Error);
|
MessageBox.Show("Unable to determine local branch!", "Invalid Branch Config", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
Shutdown();
|
Shutdown();
|
||||||
@@ -169,6 +153,21 @@ namespace Elwig {
|
|||||||
base.OnStartup(evt);
|
base.OnStartup(evt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void SetBranch(Branch b) {
|
||||||
|
SetBranch((b.ZwstId, b.Name, b.PostalDest?.AtPlz?.Plz, b.PostalDest?.AtPlz?.Ort.Name, b.Address, b.PhoneNr, b.FaxNr, b.MobileNr));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void SetBranch((string, string, int?, string?, string?, string?, string?, string?) entry) {
|
||||||
|
ZwstId = entry.Item1;
|
||||||
|
BranchName = entry.Item2;
|
||||||
|
BranchPlz = entry.Item3;
|
||||||
|
BranchLocation = entry.Item4?.Split(" im ")[0].Split(" an ")[0].Split(" bei ")[0]; // FIXME
|
||||||
|
BranchAddress = entry.Item5;
|
||||||
|
BranchPhoneNr = entry.Item6;
|
||||||
|
BranchFaxNr = entry.Item7;
|
||||||
|
BranchMobileNr = entry.Item8;
|
||||||
|
}
|
||||||
|
|
||||||
private void PrintingReadyChanged() {
|
private void PrintingReadyChanged() {
|
||||||
Dispatcher.BeginInvoke(OnPrintingReadyChanged, new EventArgs());
|
Dispatcher.BeginInvoke(OnPrintingReadyChanged, new EventArgs());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ namespace Elwig.Documents {
|
|||||||
// 3 - full
|
// 3 - full
|
||||||
public int DisplayStats = App.Client.ModeDeliveryNoteStats;
|
public int DisplayStats = App.Client.ModeDeliveryNoteStats;
|
||||||
|
|
||||||
public DeliveryNote(Delivery d, AppDbContext ctx) : base($"Traubenübernahmeschein Nr. {d.LsNr}", d.Member) {
|
public DeliveryNote(Delivery d, AppDbContext? ctx = null) : base($"Traubenübernahmeschein Nr. {d.LsNr}", d.Member) {
|
||||||
UseBillingAddress = true;
|
UseBillingAddress = true;
|
||||||
ShowDateAndLocation = true;
|
ShowDateAndLocation = true;
|
||||||
Delivery = d;
|
Delivery = d;
|
||||||
@@ -27,7 +27,7 @@ namespace Elwig.Documents {
|
|||||||
$"</tbody></table>";
|
$"</tbody></table>";
|
||||||
Text = App.Client.TextDeliveryNote;
|
Text = App.Client.TextDeliveryNote;
|
||||||
DocumentId = d.LsNr;
|
DocumentId = d.LsNr;
|
||||||
MemberBuckets = ctx.GetMemberBuckets(d.Year, d.Member.MgNr).GetAwaiter().GetResult();
|
MemberBuckets = ctx?.GetMemberBuckets(d.Year, d.Member.MgNr).GetAwaiter().GetResult() ?? [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,8 +63,8 @@
|
|||||||
<td colspan="5">
|
<td colspan="5">
|
||||||
@if (Model.Member.BillingAddress != null) {
|
@if (Model.Member.BillingAddress != null) {
|
||||||
@Model.Member.BillingAddress.PostalDest.AtPlz?.Plz
|
@Model.Member.BillingAddress.PostalDest.AtPlz?.Plz
|
||||||
@Model.Member.BillingAddress.PostalDest.AtPlz?.Dest
|
@(" ")@Model.Member.BillingAddress.PostalDest.AtPlz?.Dest
|
||||||
@("(")@Model.Member.BillingAddress.PostalDest.AtPlz?.Ort.Name@(")")
|
@(" (")@Model.Member.BillingAddress.PostalDest.AtPlz?.Ort.Name@(")")
|
||||||
}
|
}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
+1
-1
@@ -7,7 +7,7 @@
|
|||||||
<UseWPF>true</UseWPF>
|
<UseWPF>true</UseWPF>
|
||||||
<PreserveCompilationContext>true</PreserveCompilationContext>
|
<PreserveCompilationContext>true</PreserveCompilationContext>
|
||||||
<ApplicationIcon>Resources\Images\Elwig.ico</ApplicationIcon>
|
<ApplicationIcon>Resources\Images\Elwig.ico</ApplicationIcon>
|
||||||
<Version>0.6.4</Version>
|
<Version>0.6.5</Version>
|
||||||
<SatelliteResourceLanguages>de-AT</SatelliteResourceLanguages>
|
<SatelliteResourceLanguages>de-AT</SatelliteResourceLanguages>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
|||||||
@@ -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 = 15;
|
public static readonly int RequiredSchemaVersion = 16;
|
||||||
|
|
||||||
private static int VersionOffset = 0;
|
private static int VersionOffset = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -45,7 +45,15 @@ namespace Elwig.Helpers.Billing {
|
|||||||
""");
|
""");
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task CalculateBuckets(bool allowAttrsIntoLower, bool avoidUnderDeliveries, bool honorGebunden, SqliteConnection? cnx = null) {
|
public async Task CalculateBuckets(
|
||||||
|
bool? honorGebundenField = null,
|
||||||
|
bool? allowAttributesIntoLower = null,
|
||||||
|
bool? avoidUnderDeliveries = null,
|
||||||
|
SqliteConnection? cnx = null
|
||||||
|
) {
|
||||||
|
var honorGebunden = honorGebundenField ?? Season.Billing_HonorGebunden;
|
||||||
|
var allowAttrsIntoLower = allowAttributesIntoLower ?? Season.Billing_AllowAttrsIntoLower;
|
||||||
|
var avoidUnderDlvrs = avoidUnderDeliveries ?? Season.Billing_AvoidUnderDeliveries;
|
||||||
var attrVals = Context.WineAttributes.ToDictionary(a => a.AttrId, a => (a.IsStrict, a.FillLower));
|
var attrVals = Context.WineAttributes.ToDictionary(a => a.AttrId, a => (a.IsStrict, a.FillLower));
|
||||||
var attrForced = attrVals.Where(a => a.Value.IsStrict && a.Value.FillLower == 0).Select(a => a.Key).ToArray();
|
var attrForced = attrVals.Where(a => a.Value.IsStrict && a.Value.FillLower == 0).Select(a => a.Key).ToArray();
|
||||||
var ownCnx = cnx == null;
|
var ownCnx = cnx == null;
|
||||||
@@ -125,7 +133,7 @@ namespace Elwig.Helpers.Billing {
|
|||||||
SET discr = excluded.discr, value = value + excluded.value;
|
SET discr = excluded.discr, value = value + excluded.value;
|
||||||
""");
|
""");
|
||||||
|
|
||||||
if (!avoidUnderDeliveries) {
|
if (!avoidUnderDlvrs) {
|
||||||
if (ownCnx) await cnx.DisposeAsync();
|
if (ownCnx) await cnx.DisposeAsync();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,14 +18,10 @@ namespace Elwig.Helpers.Billing {
|
|||||||
Data = PaymentBillingData.FromJson(PaymentVariant.Data, Utils.GetVaributes(Context, Year, onlyDelivered: false));
|
Data = PaymentBillingData.FromJson(PaymentVariant.Data, Utils.GetVaributes(Context, Year, onlyDelivered: false));
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task Calculate() {
|
public async Task Calculate(bool? honorGebunden = null, bool ? allowAttrsIntoLower = null, bool? avoidUnderDeliveries = null) {
|
||||||
using var cnx = await AppDbContext.ConnectAsync();
|
using var cnx = await AppDbContext.ConnectAsync();
|
||||||
using var tx = await cnx.BeginTransactionAsync();
|
using var tx = await cnx.BeginTransactionAsync();
|
||||||
await CalculateBuckets(
|
await CalculateBuckets(honorGebunden, allowAttrsIntoLower, avoidUnderDeliveries, cnx);
|
||||||
Season.Billing_AllowAttrsIntoLower,
|
|
||||||
Season.Billing_AvoidUnderDeliveries,
|
|
||||||
Season.Billing_HonorGebunden,
|
|
||||||
cnx);
|
|
||||||
await DeleteInDb(cnx);
|
await DeleteInDb(cnx);
|
||||||
await SetCalcTime(cnx);
|
await SetCalcTime(cnx);
|
||||||
await CalculatePrices(cnx);
|
await CalculatePrices(cnx);
|
||||||
@@ -149,8 +145,9 @@ namespace Elwig.Helpers.Billing {
|
|||||||
foreach (var part in parts) {
|
foreach (var part in parts) {
|
||||||
var ungeb = part.Discr == "_";
|
var ungeb = part.Discr == "_";
|
||||||
var payAttrId = (part.Discr is "" or "_") ? null : part.Discr;
|
var payAttrId = (part.Discr is "" or "_") ? null : part.Discr;
|
||||||
var geb = !ungeb && payAttrId == part.AttrId;
|
var attrId = part.AttrId == "B" ? "B" : payAttrId; // FIXME
|
||||||
var price = Data.CalculatePrice(part.SortId, part.AttrId, part.QualId, geb, part.Oe, part.Kmw);
|
var geb = !ungeb; // FIXME && payAttrId == part.AttrId;
|
||||||
|
var price = Data.CalculatePrice(part.SortId, attrId, part.QualId, geb, part.Oe, part.Kmw);
|
||||||
var priceL = PaymentVariant.Season.DecToDb(price);
|
var priceL = PaymentVariant.Season.DecToDb(price);
|
||||||
inserts.Add((part.Year, part.DId, part.DPNr, part.BktNr, priceL, priceL * part.Value));
|
inserts.Add((part.Year, part.DId, part.DPNr, part.BktNr, priceL, priceL * part.Value));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,12 +2,14 @@ using Elwig.Models.Dtos;
|
|||||||
using Elwig.Models.Entities;
|
using Elwig.Models.Entities;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Security;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Elwig.Helpers.Export {
|
namespace Elwig.Helpers.Export {
|
||||||
public class Ebics(PaymentVar variant, string filename) : IBankingExporter {
|
public class Ebics(PaymentVar variant, string filename, int version) : IBankingExporter {
|
||||||
|
|
||||||
public static string FileExtension => "xml";
|
public static string FileExtension => "xml";
|
||||||
|
|
||||||
@@ -16,6 +18,7 @@ namespace Elwig.Helpers.Export {
|
|||||||
private readonly int Year = variant.Year;
|
private readonly int Year = variant.Year;
|
||||||
private readonly string Name = variant.Name;
|
private readonly string Name = variant.Name;
|
||||||
private readonly int AvNr = variant.AvNr;
|
private readonly int AvNr = variant.AvNr;
|
||||||
|
private readonly int Version = version;
|
||||||
|
|
||||||
public void Dispose() {
|
public void Dispose() {
|
||||||
GC.SuppressFinalize(this);
|
GC.SuppressFinalize(this);
|
||||||
@@ -32,6 +35,8 @@ namespace Elwig.Helpers.Export {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public async Task ExportAsync(IEnumerable<Transaction> transactions, IProgress<double>? progress = null) {
|
public async Task ExportAsync(IEnumerable<Transaction> transactions, IProgress<double>? progress = null) {
|
||||||
|
if (transactions.Any(tx => tx.Amount < 0))
|
||||||
|
throw new ArgumentException("Tranaction amount may not be negative");
|
||||||
progress?.Report(0.0);
|
progress?.Report(0.0);
|
||||||
var nbOfTxs = transactions.Count();
|
var nbOfTxs = transactions.Count();
|
||||||
int count = nbOfTxs + 2, i = 0;
|
int count = nbOfTxs + 2, i = 0;
|
||||||
@@ -41,26 +46,24 @@ namespace Elwig.Helpers.Export {
|
|||||||
|
|
||||||
await Writer.WriteLineAsync($"""
|
await Writer.WriteLineAsync($"""
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<Document xmlns="urn:iso:std:iso:20022:tech:xsd:pain.001.001.09"
|
<Document xmlns="urn:iso:std:iso:20022:tech:xsd:pain.001.001.{Version:00}">
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="urn:iso:std:iso:20022:tech:xsd:pain.001.001.09 pain.001.001.09.xsd">
|
|
||||||
<CstmrCdtTrfInitn>
|
<CstmrCdtTrfInitn>
|
||||||
<GrpHdr>
|
<GrpHdr>
|
||||||
<MsgId>{msgId}</MsgId>
|
<MsgId>{msgId}</MsgId>
|
||||||
<CreDtTm>{DateTime.UtcNow:o}</CreDtTm>
|
<CreDtTm>{DateTime.UtcNow:o}</CreDtTm>
|
||||||
<NbOfTxs>{nbOfTxs}</NbOfTxs>
|
<NbOfTxs>{nbOfTxs}</NbOfTxs>
|
||||||
<CtrlSum>{Transaction.FormatAmount(ctrlSum)}</CtrlSum>
|
<CtrlSum>{Transaction.FormatAmount(ctrlSum)}</CtrlSum>
|
||||||
<InitgPty><Nm>{App.Client.NameFull}</Nm></InitgPty>
|
<InitgPty><Nm>{SecurityElement.Escape(App.Client.NameFull)}</Nm></InitgPty>
|
||||||
</GrpHdr>
|
</GrpHdr>
|
||||||
<PmtInf>
|
<PmtInf>
|
||||||
<PmtInfId>{pmtInfId}</PmtInfId>
|
<PmtInfId>{pmtInfId}</PmtInfId>
|
||||||
<PmtMtd>TRF</PmtMtd>
|
<PmtMtd>TRF</PmtMtd>
|
||||||
<NbOfTxs>{nbOfTxs}</NbOfTxs>
|
<NbOfTxs>{nbOfTxs}</NbOfTxs>
|
||||||
<CtrlSum>{Transaction.FormatAmount(ctrlSum)}</CtrlSum>
|
<CtrlSum>{Transaction.FormatAmount(ctrlSum)}</CtrlSum>
|
||||||
<ReqdExctnDt><Dt>{Date:yyyy-MM-dd}</Dt></ReqdExctnDt>
|
<ReqdExctnDt>{(Version >= 8 ? "<Dt>" : "")}{Date:yyyy-MM-dd}{(Version >= 8 ? "</Dt>" : "")}</ReqdExctnDt>
|
||||||
<Dbtr><Nm>{App.Client.NameFull}</Nm></Dbtr>
|
<Dbtr><Nm>{SecurityElement.Escape(App.Client.NameFull)}</Nm></Dbtr>
|
||||||
<DbtrAcct><Id><IBAN>{App.Client.Iban?.Replace(" ", "")}</IBAN></Id></DbtrAcct>
|
<DbtrAcct><Id><IBAN>{App.Client.Iban!.Replace(" ", "")}</IBAN></Id></DbtrAcct>
|
||||||
<DbtrAgt><FinInstnId><BICFI>{App.Client.Bic ?? "NOTPROVIDED"}</BICFI></FinInstnId></DbtrAgt>
|
<DbtrAgt><FinInstnId>{(Version >= 4 ? "<BICFI>" : "<BIC>")}{App.Client.Bic ?? "NOTPROVIDED"}{(Version >= 4 ? "</BICFI>" : "</BIC>")}</FinInstnId></DbtrAgt>
|
||||||
""");
|
""");
|
||||||
progress?.Report(100.0 * ++i / count);
|
progress?.Report(100.0 * ++i / count);
|
||||||
|
|
||||||
@@ -74,16 +77,15 @@ namespace Elwig.Helpers.Export {
|
|||||||
<PmtId><EndToEndId>{id}</EndToEndId></PmtId>
|
<PmtId><EndToEndId>{id}</EndToEndId></PmtId>
|
||||||
<Amt><InstdAmt Ccy="{tx.Currency}">{Transaction.FormatAmount(tx.Amount)}</InstdAmt></Amt>
|
<Amt><InstdAmt Ccy="{tx.Currency}">{Transaction.FormatAmount(tx.Amount)}</InstdAmt></Amt>
|
||||||
<Cdtr>
|
<Cdtr>
|
||||||
<Nm>{a.Name}</Nm>
|
<Nm>{SecurityElement.Escape(a.Name[..Math.Min(140, a.Name.Length)])}</Nm>
|
||||||
<PstlAdr>
|
<PstlAdr>
|
||||||
<StrtNm>{a1}</StrtNm><BldgNb>{a2}</BldgNb>
|
<StrtNm>{a1?[..Math.Min(70, a1.Length)]}</StrtNm><BldgNb>{SecurityElement.Escape(a2?[..Math.Min(16, a2.Length)])}</BldgNb>
|
||||||
<PstCd>{a.PostalDest.AtPlz?.Plz}</PstCd><TwnNm>{a.PostalDest.AtPlz?.Ort.Name}</TwnNm>
|
<PstCd>{a.PostalDest.AtPlz?.Plz}</PstCd><TwnNm>{SecurityElement.Escape(a.PostalDest.AtPlz?.Ort.Name)}</TwnNm>
|
||||||
<Ctry>{a.PostalDest.Country.Alpha2}</Ctry>
|
<Ctry>{a.PostalDest.Country.Alpha2}</Ctry>
|
||||||
</PstlAdr>
|
</PstlAdr>
|
||||||
</Cdtr>
|
</Cdtr>
|
||||||
<CdtrAcct><Id><IBAN>{tx.Member.Iban}</IBAN></Id></CdtrAcct>
|
<CdtrAcct><Id><IBAN>{tx.Member.Iban!}</IBAN></Id></CdtrAcct>
|
||||||
<CdtrAgt><FinInstnId><BICFI>{tx.Member.Bic ?? "NOTPROVIDED"}</BICFI></FinInstnId></CdtrAgt>
|
<RmtInf><Ustrd>{SecurityElement.Escape(info)}</Ustrd></RmtInf>
|
||||||
<RmtInf><Ustrd>{info}</Ustrd></RmtInf>
|
|
||||||
</CdtTrfTxInf>
|
</CdtTrfTxInf>
|
||||||
""");
|
""");
|
||||||
progress?.Report(100.0 * ++i / count);
|
progress?.Report(100.0 * ++i / count);
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ namespace Elwig.Helpers.Printing {
|
|||||||
private static RazorLightEngine? Engine = null;
|
private static RazorLightEngine? Engine = null;
|
||||||
public static bool IsReady => Engine != null;
|
public static bool IsReady => Engine != null;
|
||||||
|
|
||||||
public static async Task Init(Action evtHandler) {
|
public static async Task Init(Action? evtHandler = null) {
|
||||||
var e = new RazorLightEngineBuilder()
|
var e = new RazorLightEngineBuilder()
|
||||||
.UseFileSystemProject(App.DataPath + "resources")
|
.UseFileSystemProject(App.DataPath + "resources")
|
||||||
.UseMemoryCachingProvider()
|
.UseMemoryCachingProvider()
|
||||||
@@ -24,7 +24,7 @@ namespace Elwig.Helpers.Printing {
|
|||||||
await e.CompileTemplateAsync("DeliveryConfirmation");
|
await e.CompileTemplateAsync("DeliveryConfirmation");
|
||||||
|
|
||||||
Engine = e;
|
Engine = e;
|
||||||
evtHandler();
|
evtHandler?.Invoke();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async Task<string> CompileRenderAsync(string key, object model) {
|
public static async Task<string> CompileRenderAsync(string key, object model) {
|
||||||
|
|||||||
@@ -11,13 +11,20 @@ using System.Linq;
|
|||||||
namespace Elwig.Helpers.Printing {
|
namespace Elwig.Helpers.Printing {
|
||||||
public static class Pdf {
|
public static class Pdf {
|
||||||
|
|
||||||
private static readonly string PdfToPrinter = App.ExePath + "PDFtoPrinter.exe";
|
private static readonly string PdfToPrinter = new string[] { App.ExePath }
|
||||||
private static readonly string WinziPrint = App.ExePath + "WinziPrint.exe";
|
.Union(Environment.GetEnvironmentVariable("PATH")?.Split(';') ?? [])
|
||||||
|
.Select(x => Path.Combine(x, "PDFtoPrinter.exe"))
|
||||||
|
.Where(x => File.Exists(x))
|
||||||
|
.FirstOrDefault() ?? throw new FileNotFoundException("PDFtoPrinter executable not found");
|
||||||
|
private static readonly string WinziPrint = new string[] { App.ExePath }
|
||||||
|
.Union(Environment.GetEnvironmentVariable("PATH")?.Split(';') ?? [])
|
||||||
|
.Select(x => Path.Combine(x, "WinziPrint.exe"))
|
||||||
|
.Where(x => File.Exists(x))
|
||||||
|
.FirstOrDefault() ?? throw new FileNotFoundException("WiniPrint executable not found");
|
||||||
private static Process? WinziPrintProc;
|
private static Process? WinziPrintProc;
|
||||||
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) {
|
|
||||||
var p = new Process() { StartInfo = new() {
|
var p = new Process() { StartInfo = new() {
|
||||||
FileName = WinziPrint,
|
FileName = WinziPrint,
|
||||||
CreateNoWindow = true,
|
CreateNoWindow = true,
|
||||||
@@ -33,7 +40,7 @@ namespace Elwig.Helpers.Printing {
|
|||||||
p.StartInfo.ArgumentList.Add("-");
|
p.StartInfo.ArgumentList.Add("-");
|
||||||
p.Start();
|
p.Start();
|
||||||
WinziPrintProc = p;
|
WinziPrintProc = p;
|
||||||
evtHandler();
|
evtHandler?.Invoke();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async Task<IEnumerable<int>> Convert(string htmlPath, string pdfPath, bool doubleSided = false, IProgress<double>? progress = null) {
|
public static async Task<IEnumerable<int>> Convert(string htmlPath, string pdfPath, bool doubleSided = false, IProgress<double>? progress = null) {
|
||||||
|
|||||||
@@ -0,0 +1,35 @@
|
|||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Elwig.Helpers.Weighing {
|
||||||
|
/// <summary>
|
||||||
|
/// Interface for controlling a a scale which responds to commands sent to it
|
||||||
|
/// </summary>
|
||||||
|
public interface ICommandScale : IScale {
|
||||||
|
/// <summary>
|
||||||
|
/// Get the current weight on the scale without performing a weighing process
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>Result of the weighing process (probably without a weighing id)</returns>
|
||||||
|
Task<WeighingResult> GetCurrentWeight();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Perform a weighing process
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>Result of the weighing process (including a weighing id)</returns>
|
||||||
|
Task<WeighingResult> Weigh();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Empty the scale container or grant clearance to do so
|
||||||
|
/// </summary>
|
||||||
|
Task Empty();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Grant clearance to fill the scale container
|
||||||
|
/// </summary>
|
||||||
|
Task GrantFillingClearance();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Revoke clearance to fill the scale container
|
||||||
|
/// </summary>
|
||||||
|
Task RevokeFillingClearance();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
namespace Elwig.Helpers.Weighing {
|
||||||
|
/// <summary>
|
||||||
|
/// Interface for controlling a a scale which automatically sends weighing updates
|
||||||
|
/// </summary>
|
||||||
|
public interface IEventScale : IScale {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,9 +1,8 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Elwig.Helpers.Weighing {
|
namespace Elwig.Helpers.Weighing {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Interface for controlling a industrial scale
|
/// Interface for controlling a industrial scale (industrial terminal, "IT")
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IScale : IDisposable {
|
public interface IScale : IDisposable {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -45,32 +44,5 @@ namespace Elwig.Helpers.Weighing {
|
|||||||
/// Where to log the requests and responses from the scale to
|
/// Where to log the requests and responses from the scale to
|
||||||
/// </summary>
|
/// </summary>
|
||||||
string? LogPath { get; }
|
string? LogPath { get; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Get the current weight on the scale without performing a weighing process
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>Result of the weighing process (probably without a weighing id)</returns>
|
|
||||||
Task<WeighingResult> GetCurrentWeight();
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Perform a weighing process
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>Result of the weighing process (including a weighing id)</returns>
|
|
||||||
Task<WeighingResult> Weigh();
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Empty the scale container or grant clearance to do so
|
|
||||||
/// </summary>
|
|
||||||
Task Empty();
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Grant clearance to fill the scale container
|
|
||||||
/// </summary>
|
|
||||||
Task GrantFillingClearance();
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Revoke clearance to fill the scale container
|
|
||||||
/// </summary>
|
|
||||||
Task RevokeFillingClearance();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,44 +1,19 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Elwig.Helpers.Weighing {
|
namespace Elwig.Helpers.Weighing {
|
||||||
public class InvalidScale : IScale {
|
public class InvalidScale(string id) : IScale {
|
||||||
|
|
||||||
public string Manufacturer => "NONE";
|
public string Manufacturer => "NONE";
|
||||||
public string Model => "NONE";
|
public string Model => "NONE";
|
||||||
public string ScaleId { get; private set; }
|
public string ScaleId => id;
|
||||||
public int InternalScaleNr => 0;
|
public int InternalScaleNr => 0;
|
||||||
public bool IsReady => false;
|
public bool IsReady => false;
|
||||||
public bool HasFillingClearance => false;
|
public bool HasFillingClearance => false;
|
||||||
public int? WeightLimit => null;
|
public int? WeightLimit => null;
|
||||||
public string? LogPath => null;
|
public string? LogPath => null;
|
||||||
|
|
||||||
public InvalidScale(string id) {
|
|
||||||
ScaleId = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Dispose() {
|
public void Dispose() {
|
||||||
GC.SuppressFinalize(this);
|
GC.SuppressFinalize(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<WeighingResult> Weigh() {
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Task<WeighingResult> GetCurrentWeight() {
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Task Empty() {
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Task GrantFillingClearance() {
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Task RevokeFillingClearance() {
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Elwig.Helpers.Weighing {
|
namespace Elwig.Helpers.Weighing {
|
||||||
// TODO implement SchemberScale
|
public class SchemberScale : IEventScale {
|
||||||
public class SchemberScale : IScale {
|
|
||||||
|
|
||||||
public string Manufacturer => "Schember";
|
public string Manufacturer => "Schember";
|
||||||
public string Model => throw new NotImplementedException();
|
public string Model => throw new NotImplementedException();
|
||||||
@@ -18,24 +16,7 @@ namespace Elwig.Helpers.Weighing {
|
|||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task Empty() {
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Task<WeighingResult> GetCurrentWeight() {
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Task GrantFillingClearance() {
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Task RevokeFillingClearance() {
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Task<WeighingResult> Weigh() {
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ using System.Text;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Elwig.Helpers.Weighing {
|
namespace Elwig.Helpers.Weighing {
|
||||||
public class SystecScale : IScale {
|
public class SystecScale : ICommandScale {
|
||||||
|
|
||||||
protected enum Output { RTS, DTR, OUT1, OUT2 };
|
protected enum Output { RTS, DTR, OUT1, OUT2 };
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using Elwig.Models.Entities;
|
using Elwig.Models.Entities;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
@@ -19,7 +20,7 @@ namespace Elwig.Models.Dtos {
|
|||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string FormatAmountCent(long cents) => $"{cents / 100}.{cents % 100:00}";
|
public static string FormatAmountCent(long cents) => $"{cents / 100}.{Math.Abs(cents % 100):00}";
|
||||||
|
|
||||||
public static string FormatAmount(decimal amount) => FormatAmountCent((int)(amount * 100));
|
public static string FormatAmount(decimal amount) => FormatAmountCent((int)(amount * 100));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
-- schema version 15 to 16
|
||||||
|
|
||||||
|
INSERT INTO AT_plz_dest (plz, okz, dest)
|
||||||
|
VALUES (2560, 3388, 'Grillenberg');
|
||||||
|
|
||||||
|
DELETE FROM AT_plz_dest WHERE (plz, okz) = (2561, 3388);
|
||||||
|
|
||||||
|
UPDATE AT_ort SET kgnr = 23351 WHERE okz = 5280;
|
||||||
|
UPDATE AT_ort SET kgnr = 4311 WHERE okz = 3388;
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
using Elwig.Documents;
|
using Elwig.Documents;
|
||||||
using Elwig.Helpers;
|
using Elwig.Helpers;
|
||||||
using Elwig.Helpers.Export;
|
using Elwig.Helpers.Export;
|
||||||
|
using Elwig.Helpers.Weighing;
|
||||||
using Elwig.Models.Entities;
|
using Elwig.Models.Entities;
|
||||||
using LinqKit;
|
using LinqKit;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
@@ -968,7 +969,8 @@ namespace Elwig.Windows {
|
|||||||
CancelCreatingButton.IsEnabled = false;
|
CancelCreatingButton.IsEnabled = false;
|
||||||
try {
|
try {
|
||||||
var s = App.Scales[index];
|
var s = App.Scales[index];
|
||||||
var res = await s.Weigh();
|
if (s is not ICommandScale cs) return;
|
||||||
|
var res = await cs.Weigh();
|
||||||
if ((res.Weight ?? 0) > 0 && res.FullWeighingId != null) {
|
if ((res.Weight ?? 0) > 0 && res.FullWeighingId != null) {
|
||||||
WeightInput.Text = $"{res.Weight:N0}";
|
WeightInput.Text = $"{res.Weight:N0}";
|
||||||
ScaleId = s.ScaleId;
|
ScaleId = s.ScaleId;
|
||||||
@@ -1080,8 +1082,8 @@ namespace Elwig.Windows {
|
|||||||
|
|
||||||
private void EmptyScale() {
|
private void EmptyScale() {
|
||||||
var scale = App.Scales.Where(s => s.ScaleId == ScaleId).FirstOrDefault();
|
var scale = App.Scales.Where(s => s.ScaleId == ScaleId).FirstOrDefault();
|
||||||
if (scale == null) return;
|
if (scale is not ICommandScale cs) return;
|
||||||
scale.Empty();
|
cs.Empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void NewDeliveryPartButton_Click(object sender, RoutedEventArgs evt) {
|
private async void NewDeliveryPartButton_Click(object sender, RoutedEventArgs evt) {
|
||||||
|
|||||||
@@ -160,7 +160,7 @@ namespace Elwig.Windows {
|
|||||||
filter.RemoveAt(i--);
|
filter.RemoveAt(i--);
|
||||||
} else if (e.Length > 2 && e.StartsWith('"') && e.EndsWith('"')) {
|
} else if (e.Length > 2 && e.StartsWith('"') && e.EndsWith('"')) {
|
||||||
filter[i] = e[1..^1];
|
filter[i] = e[1..^1];
|
||||||
} else if (e.Length <= 2) {
|
} else if (e.Length < 2) {
|
||||||
filter.RemoveAt(i--);
|
filter.RemoveAt(i--);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -307,8 +307,12 @@ namespace Elwig.Windows {
|
|||||||
if (d.ShowDialog() == true) {
|
if (d.ShowDialog() == true) {
|
||||||
ExportButton.IsEnabled = false;
|
ExportButton.IsEnabled = false;
|
||||||
Mouse.OverrideCursor = Cursors.AppStarting;
|
Mouse.OverrideCursor = Cursors.AppStarting;
|
||||||
using var e = new Ebics(v, d.FileName);
|
try {
|
||||||
await e.ExportAsync(Transaction.FromPaymentVariant(v));
|
using var e = new Ebics(v, d.FileName, 9);
|
||||||
|
await e.ExportAsync(Transaction.FromPaymentVariant(v));
|
||||||
|
} catch (Exception exc) {
|
||||||
|
MessageBox.Show(exc.Message, "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
|
}
|
||||||
Mouse.OverrideCursor = null;
|
Mouse.OverrideCursor = null;
|
||||||
ExportButton.IsEnabled = true;
|
ExportButton.IsEnabled = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,10 +57,7 @@ namespace Elwig.Windows {
|
|||||||
|
|
||||||
var b = new Billing(year);
|
var b = new Billing(year);
|
||||||
await b.FinishSeason();
|
await b.FinishSeason();
|
||||||
await b.CalculateBuckets(
|
await b.CalculateBuckets();
|
||||||
s.Billing_AllowAttrsIntoLower,
|
|
||||||
s.Billing_AvoidUnderDeliveries,
|
|
||||||
s.Billing_HonorGebunden);
|
|
||||||
Mouse.OverrideCursor = null;
|
Mouse.OverrideCursor = null;
|
||||||
CalculateBucketsButton.IsEnabled = true;
|
CalculateBucketsButton.IsEnabled = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using Elwig.Documents;
|
|||||||
using Elwig.Helpers;
|
using Elwig.Helpers;
|
||||||
using Elwig.Helpers.Billing;
|
using Elwig.Helpers.Billing;
|
||||||
using Elwig.Helpers.Export;
|
using Elwig.Helpers.Export;
|
||||||
|
using Elwig.Helpers.Weighing;
|
||||||
using Elwig.Models.Dtos;
|
using Elwig.Models.Dtos;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using System;
|
using System;
|
||||||
@@ -27,7 +28,8 @@ namespace Elwig.Windows {
|
|||||||
|
|
||||||
private async void WeighingButton1_Click(object sender, RoutedEventArgs evt) {
|
private async void WeighingButton1_Click(object sender, RoutedEventArgs evt) {
|
||||||
try {
|
try {
|
||||||
var res = await App.Scales[0].GetCurrentWeight();
|
if (App.Scales[0] is not ICommandScale cs) return;
|
||||||
|
var res = await cs.GetCurrentWeight();
|
||||||
Output.Text = res.ToString();
|
Output.Text = res.ToString();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
MessageBox.Show($"Beim Wiegen ist ein Fehler aufgetreten:\n\n{e.Message}", "Waagenfehler",
|
MessageBox.Show($"Beim Wiegen ist ein Fehler aufgetreten:\n\n{e.Message}", "Waagenfehler",
|
||||||
@@ -37,7 +39,8 @@ namespace Elwig.Windows {
|
|||||||
|
|
||||||
private async void WeighingButton2_Click(object sender, RoutedEventArgs evt) {
|
private async void WeighingButton2_Click(object sender, RoutedEventArgs evt) {
|
||||||
try {
|
try {
|
||||||
var res = await App.Scales[0].Weigh();
|
if (App.Scales[0] is not ICommandScale cs) return;
|
||||||
|
var res = await cs.Weigh();
|
||||||
Output.Text = res.ToString();
|
Output.Text = res.ToString();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
MessageBox.Show($"Beim Wiegen ist ein Fehler aufgetreten:\n\n{e.Message}", "Waagenfehler",
|
MessageBox.Show($"Beim Wiegen ist ein Fehler aufgetreten:\n\n{e.Message}", "Waagenfehler",
|
||||||
|
|||||||
@@ -25,8 +25,8 @@
|
|||||||
</Task>
|
</Task>
|
||||||
</UsingTask>
|
</UsingTask>
|
||||||
<Target Name="CustomBeforeBuild" BeforeTargets="BeforeBuild">
|
<Target Name="CustomBeforeBuild" BeforeTargets="BeforeBuild">
|
||||||
<Exec Command="curl -s -L "http://www.columbia.edu/~em36/PDFtoPrinter.exe" -z "$(TargetDir)PDFtoPrinter.exe" -o "$(TargetDir)PDFtoPrinter.exe"" />
|
<Exec Command="curl -s -L "http://www.columbia.edu/~em36/PDFtoPrinter.exe" -z "$(ProjectDir)\Files\PDFtoPrinter.exe" -o "$(ProjectDir)\Files\PDFtoPrinter.exe"" />
|
||||||
<Exec Command="dotnet publish "$(SolutionDir)Elwig\Elwig.csproj" "/p:PublishProfile=$(SolutionDir)\Elwig\Properties\PublishProfiles\FolderProfile.pubxml"" />
|
<Exec Command="dotnet publish "$(ProjectDir)\..\Elwig\Elwig.csproj" "/p:PublishProfile=$(ProjectDir)\..\Elwig\Properties\PublishProfiles\FolderProfile.pubxml"" />
|
||||||
<GetFileVersion AssemblyPath="..\Elwig\bin\Publish\Elwig.exe">
|
<GetFileVersion AssemblyPath="..\Elwig\bin\Publish\Elwig.exe">
|
||||||
<Output TaskParameter="Version" PropertyName="ElwigFileVersion" />
|
<Output TaskParameter="Version" PropertyName="ElwigFileVersion" />
|
||||||
</GetFileVersion>
|
</GetFileVersion>
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
<File Source="$(ProjectDir)\Files\WinziPrint.exe" Id="WinziPrint.exe"/>
|
<File Source="$(ProjectDir)\Files\WinziPrint.exe" Id="WinziPrint.exe"/>
|
||||||
</Component>
|
</Component>
|
||||||
<Component Directory="InstallFolder">
|
<Component Directory="InstallFolder">
|
||||||
<File Source="$(TargetDir)\PDFtoPrinter.exe" Id="PDFtoPrinter.exe"/>
|
<File Source="$(ProjectDir)\Files\PDFtoPrinter.exe" Id="PDFtoPrinter.exe"/>
|
||||||
</Component>
|
</Component>
|
||||||
</ComponentGroup>
|
</ComponentGroup>
|
||||||
</Fragment>
|
</Fragment>
|
||||||
|
|||||||
+21
-18
@@ -1,25 +1,28 @@
|
|||||||
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:bal="http://wixtoolset.org/schemas/v4/wxs/bal" xmlns:util="http://wixtoolset.org/schemas/v4/wxs/util">
|
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:bal="http://wixtoolset.org/schemas/v4/wxs/bal" xmlns:util="http://wixtoolset.org/schemas/v4/wxs/util">
|
||||||
<Bundle Name="Elwig" Manufacturer="Elwig" Version="!(bind.packageVersion.ElwigMsi)" UpgradeCode="f3c8fcab-c37c-43aa-9ab8-e42f4bb518b7" IconSourceFile="$(var.ElwigProjectDir)\Resources\Images\Elwig.ico" >
|
<Bundle Name="Elwig" Manufacturer="Elwig" Version="!(bind.packageVersion.ElwigMsi)" UpgradeCode="f3c8fcab-c37c-43aa-9ab8-e42f4bb518b7"
|
||||||
<BootstrapperApplication>
|
IconSourceFile="$(var.ElwigProjectDir)\Resources\Images\Elwig.ico">
|
||||||
<bal:WixStandardBootstrapperApplication LicenseUrl="" Theme="hyperlinkLicense" LogoFile="$(var.ElwigProjectDir)\Resources\Images\Elwig.png" SuppressOptionsUI="yes" ShowVersion="yes" />
|
<BootstrapperApplication>
|
||||||
</BootstrapperApplication>
|
<bal:WixStandardBootstrapperApplication LicenseUrl="" Theme="hyperlinkLicense" LogoFile="$(var.ElwigProjectDir)\Resources\Images\Elwig.png"
|
||||||
|
SuppressOptionsUI="yes" ShowVersion="yes"/>
|
||||||
<util:RegistrySearch Id="VCredistx86" Variable="VCredistx86" Result="exists" Root="HKLM" Key="SOFTWARE\Classes\Installer\Dependencies\VC,redist.x86,x86,14.36,bundle" />
|
</BootstrapperApplication>
|
||||||
<util:RegistrySearch Id="Webview2Machine" Variable="Webview2Machine" Result="exists" Root="HKLM" Key="SOFTWARE\WOW6432Node\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}" />
|
|
||||||
<util:RegistrySearch Id="Webview2User" Variable="Webview2User" Result="exists" Root="HKCU" Key="Software\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}" />
|
<util:RegistrySearch Id="VCredistx86" Variable="VCredistx86" Result="exists"
|
||||||
|
Root="HKLM" Key="SOFTWARE\Classes\Installer\Dependencies\VC,redist.x86,x86,14.36,bundle"/>
|
||||||
|
<util:RegistrySearch Id="Webview2Machine" Variable="Webview2Machine" Result="exists"
|
||||||
|
Root="HKLM" Key="SOFTWARE\WOW6432Node\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}"/>
|
||||||
|
<util:RegistrySearch Id="Webview2User" Variable="Webview2User" Result="exists"
|
||||||
|
Root="HKCU" Key="Software\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}"/>
|
||||||
|
|
||||||
<Chain>
|
<Chain>
|
||||||
<ExePackage Id="VCredistx86Installer" DisplayName="VC Redist x86 installer" Name="VC_redist.x86.exe" Cache="remove" Compressed="yes" PerMachine="yes"
|
<ExePackage Id="VCredistx86Installer" DisplayName="VC Redist x86 installer" Name="VC_redist.x86.exe"
|
||||||
Permanent="yes" Vital="yes" SourceFile="$(TargetDir)VC_redist.x86.exe" InstallArguments="/install /passive /norestart" DetectCondition="VCredistx86">
|
SourceFile="$(ProjectDir)\Files\VC_redist.x86.exe"
|
||||||
</ExePackage>
|
Cache="remove" Compressed="yes" PerMachine="yes" Permanent="yes" Vital="yes"
|
||||||
|
InstallArguments="/install /passive /norestart" DetectCondition="VCredistx86"/>
|
||||||
<ExePackage Id="MicrosoftEdgeWebview2" DisplayName="Microsoft Edge Webview2 Runtime" Name="MicrosoftEdgeWebview2Setup.exe" Cache="remove"
|
<ExePackage Id="MicrosoftEdgeWebview2" DisplayName="Microsoft Edge Webview2 Runtime" Name="MicrosoftEdgeWebview2Setup.exe"
|
||||||
Compressed="yes" PerMachine="yes" Permanent ="yes" Vital ="no" SourceFile="$(TargetDir)MicrosoftEdgeWebview2Setup.exe" InstallArguments="/silent /install"
|
SourceFile="$(ProjectDir)\Files\MicrosoftEdgeWebview2Setup.exe"
|
||||||
UninstallArguments="/silent /uninstall" DetectCondition="Webview2Machine OR Webview2User" >
|
Cache="remove" Compressed="yes" PerMachine="yes" Permanent ="yes" Vital="no"
|
||||||
</ExePackage>
|
InstallArguments="/silent /install" UninstallArguments="/silent /uninstall" DetectCondition="Webview2Machine OR Webview2User"/>
|
||||||
|
|
||||||
<MsiPackage Id="ElwigMsi" SourceFile="$(var.Installer.TargetDir)\Elwig.msi" Permanent="no" Compressed="yes" Vital="yes"/>
|
<MsiPackage Id="ElwigMsi" SourceFile="$(var.Installer.TargetDir)\Elwig.msi" Permanent="no" Compressed="yes" Vital="yes"/>
|
||||||
</Chain>
|
</Chain>
|
||||||
|
|
||||||
</Bundle>
|
</Bundle>
|
||||||
</Wix>
|
</Wix>
|
||||||
|
|||||||
+2
-2
@@ -5,8 +5,8 @@
|
|||||||
<Cultures>de-AT</Cultures>
|
<Cultures>de-AT</Cultures>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Target Name="CustomBeforeBuild" BeforeTargets="BeforeBuild">
|
<Target Name="CustomBeforeBuild" BeforeTargets="BeforeBuild">
|
||||||
<Exec Command='curl -s -L "https://go.microsoft.com/fwlink/p/?LinkId=2124703" -z "$(TargetDir)MicrosoftEdgeWebview2Setup.exe" -o "$(TargetDir)MicrosoftEdgeWebview2Setup.exe"' />
|
<Exec Command='curl -s -L "https://go.microsoft.com/fwlink/p/?LinkId=2124703" -z "$(ProjectDir)\Files\MicrosoftEdgeWebview2Setup.exe" -o "$(ProjectDir)\Files\MicrosoftEdgeWebview2Setup.exe"' />
|
||||||
<Exec Command='curl -s -L "https://aka.ms/vs/17/release/vc_redist.x86.exe" -z "$(TargetDir)VC_redist.x86.exe" -o "$(TargetDir)VC_redist.x86.exe"' />
|
<Exec Command='curl -s -L "https://aka.ms/vs/17/release/vc_redist.x86.exe" -z "$(ProjectDir)\Files\VC_redist.x86.exe" -o "$(ProjectDir)\Files\VC_redist.x86.exe"' />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<DefineConstants>ElwigProjectDir=..\Elwig</DefineConstants>
|
<DefineConstants>ElwigProjectDir=..\Elwig</DefineConstants>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ namespace Tests {
|
|||||||
public void Setup_2_Client() {
|
public void Setup_2_Client() {
|
||||||
using var ctx = new AppDbContext();
|
using var ctx = new AppDbContext();
|
||||||
App.Client = new ClientParameters(ctx);
|
App.Client = new ClientParameters(ctx);
|
||||||
|
App.SetBranch(ctx.Branches.Single());
|
||||||
}
|
}
|
||||||
|
|
||||||
[OneTimeSetUp]
|
[OneTimeSetUp]
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
using Elwig.Documents;
|
||||||
|
using Elwig.Helpers;
|
||||||
|
|
||||||
|
namespace Tests.DocumentTests {
|
||||||
|
[TestFixture]
|
||||||
|
public class DeliveryNoteTest {
|
||||||
|
|
||||||
|
private readonly AppDbContext Context = new();
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public async Task Test_01_OneDeliveryPart() {
|
||||||
|
var d = await Context.Deliveries.FindAsync(2020, 1);
|
||||||
|
using var doc = new DeliveryNote(d!, Context);
|
||||||
|
var text = await Utils.GeneratePdfText(doc);
|
||||||
|
Assert.Multiple(() => {
|
||||||
|
Assert.That(text, Contains.Substring("""
|
||||||
|
MUSTERMANN Max
|
||||||
|
Winzerstraße 1
|
||||||
|
2223 Hohenruppersdorf
|
||||||
|
"""));
|
||||||
|
Assert.That(text, Contains.Substring("1472583")); // Betriebsnummer
|
||||||
|
Assert.That(text, Contains.Substring("pauschaliert"));
|
||||||
|
Assert.That(text, Contains.Substring($"Wolkersdorf, am {DateTime.Now:dd.MM.yyyy}"));
|
||||||
|
Assert.That(text, Contains.Substring("Traubenübernahmeschein Nr. 20201001X001"));
|
||||||
|
// TODO
|
||||||
|
Assert.That(text, Contains.Substring("Ich bin der Text, der auf einem Traubenübernahmeschein steht!"));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
using Elwig.Helpers;
|
||||||
|
using System.Reflection;
|
||||||
|
using Microsoft.Data.Sqlite;
|
||||||
|
using Elwig.Helpers.Printing;
|
||||||
|
|
||||||
|
namespace Tests.DocumentTests {
|
||||||
|
[SetUpFixture]
|
||||||
|
public class Setup {
|
||||||
|
|
||||||
|
private SqliteConnection? Connection;
|
||||||
|
|
||||||
|
[OneTimeSetUp]
|
||||||
|
public async Task SetupDatabase() {
|
||||||
|
Connection = await AppDbContext.ConnectAsync();
|
||||||
|
await AppDbContext.ExecuteEmbeddedScript(Connection, Assembly.GetExecutingAssembly(), "Tests.Resources.Sql.DocumentInsert.sql");
|
||||||
|
}
|
||||||
|
|
||||||
|
[OneTimeTearDown]
|
||||||
|
public async Task TeardownDatabase() {
|
||||||
|
if (Connection == null) return;
|
||||||
|
await AppDbContext.ExecuteEmbeddedScript(Connection, Assembly.GetExecutingAssembly(), "Tests.Resources.Sql.DocumentDelete.sql");
|
||||||
|
await Connection.DisposeAsync();
|
||||||
|
Connection = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
[OneTimeSetUp]
|
||||||
|
public async Task SetupPrinting() {
|
||||||
|
await Html.Init();
|
||||||
|
await Pdf.Init();
|
||||||
|
}
|
||||||
|
|
||||||
|
[OneTimeTearDown]
|
||||||
|
public void TeardownPrinting() {
|
||||||
|
// no teardown needed yet
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
using Elwig.Documents;
|
||||||
|
using NReco.PdfRenderer;
|
||||||
|
|
||||||
|
namespace Tests.DocumentTests {
|
||||||
|
public static class Utils {
|
||||||
|
|
||||||
|
private static readonly string FileName = Path.Combine(Path.GetTempPath(), "test_document.pdf");
|
||||||
|
|
||||||
|
public static async Task<string> GeneratePdfText(Document doc) {
|
||||||
|
await doc.Generate();
|
||||||
|
try {
|
||||||
|
doc.SaveTo(FileName);
|
||||||
|
var conv = new PdfToTextConverter { CustomArgs = "-raw " };
|
||||||
|
return conv.GenerateText(FileName);
|
||||||
|
} finally {
|
||||||
|
File.Delete(FileName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,9 +7,18 @@ namespace Tests.HelperTests {
|
|||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class BillingTest {
|
public class BillingTest {
|
||||||
|
|
||||||
private const int Year1 = 2020, Year2 = 2020;
|
private const int Year1 = 2020, Year2 = 2021;
|
||||||
private const int MgNr1 = 101, MgNr2 = 102, MgNr3 = 103, MgNr4 = 104;
|
private const int MgNr1 = 101, MgNr2 = 102, MgNr3 = 103, MgNr4 = 104;
|
||||||
|
|
||||||
|
private const decimal
|
||||||
|
GV_ungeb = 0.50m,
|
||||||
|
GV_geb = 0.60m,
|
||||||
|
GVB_ungeb = 0.54m,
|
||||||
|
GVB_geb = 0.64m,
|
||||||
|
GVK_ungeb = 0.61m,
|
||||||
|
GVK_geb = 0.71m,
|
||||||
|
WEI = 0.10m;
|
||||||
|
|
||||||
private SqliteConnection? Connection;
|
private SqliteConnection? Connection;
|
||||||
|
|
||||||
[OneTimeSetUp]
|
[OneTimeSetUp]
|
||||||
@@ -26,6 +35,40 @@ namespace Tests.HelperTests {
|
|||||||
Connection = null;
|
Connection = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[SetUp]
|
||||||
|
public async Task CreatePaymentVariant() {
|
||||||
|
var json = """
|
||||||
|
{
|
||||||
|
"mode": "elwig",
|
||||||
|
"version": 1,
|
||||||
|
"payment": {
|
||||||
|
"GV/": "curve:0",
|
||||||
|
"GV/B": "curve:1",
|
||||||
|
"GV/K": "curve:2"
|
||||||
|
},
|
||||||
|
"quality": {"WEI": 0.1},
|
||||||
|
"curves": [{
|
||||||
|
"id": 0,
|
||||||
|
"mode": "oe",
|
||||||
|
"data": {"15kmw": 0.5},
|
||||||
|
"geb": 0.1
|
||||||
|
}, {
|
||||||
|
"id": 1,
|
||||||
|
"mode": "oe",
|
||||||
|
"data": {"15kmw": 0.54},
|
||||||
|
"geb": 0.1
|
||||||
|
}, {
|
||||||
|
"id": 2,
|
||||||
|
"mode": "oe",
|
||||||
|
"data": {"15kmw": 0.61},
|
||||||
|
"geb": 0.1
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
""";
|
||||||
|
await InsertPaymentVariant(Year1, 1, json);
|
||||||
|
await InsertPaymentVariant(Year2, 1, json);
|
||||||
|
}
|
||||||
|
|
||||||
[TearDown]
|
[TearDown]
|
||||||
public async Task CleanupDatabasePayment() {
|
public async Task CleanupDatabasePayment() {
|
||||||
if (Connection == null) return;
|
if (Connection == null) return;
|
||||||
@@ -51,11 +94,11 @@ namespace Tests.HelperTests {
|
|||||||
return ctx.GetMemberPaymentBuckets(year, mgnr, Connection);
|
return ctx.GetMemberPaymentBuckets(year, mgnr, Connection);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<Dictionary<(string, string), int>> GetMemberDeliveryPrices(int year, int mgnr) {
|
private async Task<Dictionary<(string, string), (int, decimal)>> GetMemberDeliveryPrices(int year, int mgnr) {
|
||||||
var buckets = new Dictionary<(string, string), int>();
|
var buckets = new Dictionary<(string, string), (int, decimal)>();
|
||||||
using (var cmd = Connection!.CreateCommand()) {
|
using (var cmd = Connection!.CreateCommand()) {
|
||||||
cmd.CommandText = $"""
|
cmd.CommandText = $"""
|
||||||
SELECT lsnr || '/' || d.dpnr, d.sortid || b.discr, price
|
SELECT lsnr || '/' || d.dpnr, d.sortid || b.discr, b.value, p.price
|
||||||
FROM v_delivery d
|
FROM v_delivery d
|
||||||
LEFT JOIN payment_delivery_part_bucket p ON (p.year, p.did, p.dpnr) = (d.year, d.did, d.dpnr)
|
LEFT JOIN payment_delivery_part_bucket p ON (p.year, p.did, p.dpnr) = (d.year, d.did, d.dpnr)
|
||||||
LEFT JOIN delivery_part_bucket b ON (b.year, b.did, b.dpnr, b.bktnr) = (p.year, p.did, p.dpnr, p.bktnr)
|
LEFT JOIN delivery_part_bucket b ON (b.year, b.did, b.dpnr, b.bktnr) = (p.year, p.did, p.dpnr, p.bktnr)
|
||||||
@@ -65,7 +108,7 @@ namespace Tests.HelperTests {
|
|||||||
while (await reader.ReadAsync()) {
|
while (await reader.ReadAsync()) {
|
||||||
var lsnr = reader.GetString(0);
|
var lsnr = reader.GetString(0);
|
||||||
var bucket = reader.GetString(1);
|
var bucket = reader.GetString(1);
|
||||||
buckets[(lsnr, bucket)] = reader.GetInt32(2);
|
buckets[(lsnr, bucket)] = (reader.GetInt32(2), Utils.DecFromDb(reader.GetInt32(3), 4));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return buckets;
|
return buckets;
|
||||||
@@ -81,34 +124,6 @@ namespace Tests.HelperTests {
|
|||||||
[Test]
|
[Test]
|
||||||
public async Task Test_01_NoActiveAreaComs() {
|
public async Task Test_01_NoActiveAreaComs() {
|
||||||
int mgnr = MgNr1, year = Year1;
|
int mgnr = MgNr1, year = Year1;
|
||||||
await InsertPaymentVariant(year, 1, """
|
|
||||||
{
|
|
||||||
"mode": "elwig",
|
|
||||||
"version": 1,
|
|
||||||
"payment": {
|
|
||||||
"GV/": "curve:0",
|
|
||||||
"GV/B": "curve:1",
|
|
||||||
"GV/K": "curve:2"
|
|
||||||
},
|
|
||||||
"quality": {"WEI": 0.1},
|
|
||||||
"curves": [{
|
|
||||||
"id": 0,
|
|
||||||
"mode": "oe",
|
|
||||||
"data": {"15kmw": 0.5},
|
|
||||||
"geb": 0.1
|
|
||||||
}, {
|
|
||||||
"id": 1,
|
|
||||||
"mode": "oe",
|
|
||||||
"data": {"15kmw": 0.54},
|
|
||||||
"geb": 0.1
|
|
||||||
}, {
|
|
||||||
"id": 2,
|
|
||||||
"mode": "oe",
|
|
||||||
"data": {"15kmw": 0.61},
|
|
||||||
"geb": 0.1
|
|
||||||
}]
|
|
||||||
}
|
|
||||||
""");
|
|
||||||
|
|
||||||
var areaCom = await GetMemberAreaCommitmentBuckets(year, mgnr);
|
var areaCom = await GetMemberAreaCommitmentBuckets(year, mgnr);
|
||||||
Assert.That(areaCom, Is.Empty);
|
Assert.That(areaCom, Is.Empty);
|
||||||
@@ -133,25 +148,117 @@ namespace Tests.HelperTests {
|
|||||||
var prices = await GetMemberDeliveryPrices(year, mgnr);
|
var prices = await GetMemberDeliveryPrices(year, mgnr);
|
||||||
Assert.Multiple(() => {
|
Assert.Multiple(() => {
|
||||||
Assert.That(prices, Has.Count.EqualTo(6));
|
Assert.That(prices, Has.Count.EqualTo(6));
|
||||||
Assert.That(prices[("20201001X001/1", "GV_")], Is.EqualTo(0_6100));
|
// Kabinett
|
||||||
Assert.That(prices[("20201001X001/2", "GV_")], Is.EqualTo(0_5000));
|
Assert.That(prices[("20201001X001/1", "GV_")], Is.EqualTo((4_000, GV_ungeb)));
|
||||||
Assert.That(prices[("20201001X002/1", "GV_")], Is.EqualTo(0_5400));
|
// ohne Attribut
|
||||||
Assert.That(prices[("20201001X002/2", "GV_")], Is.EqualTo(0_5400));
|
Assert.That(prices[("20201001X001/2", "GV_")], Is.EqualTo((4_000, GV_ungeb)));
|
||||||
Assert.That(prices[("20201001X003/1", "GV_")], Is.EqualTo(0_1000));
|
// Bio
|
||||||
Assert.That(prices[("20201001X003/2", "GV_")], Is.EqualTo(0_5000));
|
Assert.That(prices[("20201001X002/1", "GV_")], Is.EqualTo((4_000, GVB_ungeb)));
|
||||||
|
// Bio
|
||||||
|
Assert.That(prices[("20201001X002/2", "GV_")], Is.EqualTo((4_000, GVB_ungeb)));
|
||||||
|
// ohne Attribut
|
||||||
|
Assert.That(prices[("20201001X003/1", "GV_")], Is.EqualTo(( 500, WEI)));
|
||||||
|
// ohne Attribut
|
||||||
|
Assert.That(prices[("20201001X003/2", "GV_")], Is.EqualTo(( 500, GV_ungeb)));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
[Ignore("Not implemented yet")]
|
|
||||||
public async Task Test_02_SimpleNotStrictAreaComs() {
|
public async Task Test_02_SimpleNotStrictAreaComs() {
|
||||||
// TODO
|
int mgnr = MgNr1, year = Year2;
|
||||||
|
|
||||||
|
var areaCom = await GetMemberAreaCommitmentBuckets(year, mgnr);
|
||||||
|
Assert.Multiple(() => {
|
||||||
|
Assert.That(areaCom, Has.Count.EqualTo(1));
|
||||||
|
Assert.That(areaCom["GV"], Is.EqualTo(new AreaComBucket(10_000, 5_000, 10_000)));
|
||||||
|
});
|
||||||
|
var delivery = await GetMemberDeliveryBuckets(year, mgnr);
|
||||||
|
Assert.Multiple(() => {
|
||||||
|
Assert.That(delivery, Has.Count.EqualTo(4));
|
||||||
|
Assert.That(delivery["GV"], Is.EqualTo(16_000));
|
||||||
|
Assert.That(delivery["GV_"], Is.EqualTo( 1_000));
|
||||||
|
Assert.That(delivery["GVB"], Is.EqualTo( 8_000));
|
||||||
|
Assert.That(delivery["GVK"], Is.EqualTo( 4_000));
|
||||||
|
});
|
||||||
|
|
||||||
|
BillingVariant b = new(year, 1);
|
||||||
|
await b.CalculateBuckets(false, false, false, Connection);
|
||||||
|
var payment = await GetMemberPaymentBuckets(year, mgnr);
|
||||||
|
Assert.Multiple(() => {
|
||||||
|
Assert.That(payment, Has.Count.EqualTo(2));
|
||||||
|
Assert.That(payment["GV_"], Is.EqualTo( 7_000));
|
||||||
|
Assert.That(payment["GV"], Is.EqualTo(10_000));
|
||||||
|
});
|
||||||
|
|
||||||
|
await b.Calculate(false, false, false);
|
||||||
|
var prices = await GetMemberDeliveryPrices(year, mgnr);
|
||||||
|
Assert.Multiple(() => {
|
||||||
|
Assert.That(prices, Has.Count.EqualTo(10));
|
||||||
|
// Kabinett
|
||||||
|
Assert.That(prices[("20211001X001/1", "GV_")], Is.EqualTo((2_000, GV_ungeb)));
|
||||||
|
Assert.That(prices[("20211001X001/1", "GV")] , Is.EqualTo((2_000, GV_geb)));
|
||||||
|
// ohne Attribut
|
||||||
|
Assert.That(prices[("20211001X001/2", "GV_")], Is.EqualTo((4_000, GV_ungeb)));
|
||||||
|
Assert.That(prices[("20211001X001/2", "GV")], Is.EqualTo(( 0, GV_geb)));
|
||||||
|
// Bio
|
||||||
|
Assert.That(prices[("20211001X002/1", "GV_")], Is.EqualTo(( 0, GVB_ungeb)));
|
||||||
|
Assert.That(prices[("20211001X002/1", "GV")], Is.EqualTo((4_000, GVB_geb)));
|
||||||
|
// Bio
|
||||||
|
Assert.That(prices[("20211001X002/2", "GV_")], Is.EqualTo(( 0, GVB_ungeb)));
|
||||||
|
Assert.That(prices[("20211001X002/2", "GV")], Is.EqualTo((4_000, GVB_geb)));
|
||||||
|
// ohne Attribut
|
||||||
|
Assert.That(prices[("20211001X003/1", "GV_")], Is.EqualTo(( 500, WEI)));
|
||||||
|
// ohne Attribut
|
||||||
|
Assert.That(prices[("20211001X003/2", "GV_")], Is.EqualTo(( 500, GV_ungeb)));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
[Ignore("Not implemented yet")]
|
|
||||||
public async Task Test_03_SimpleNotStrictAreaComs_HonorGebunden() {
|
public async Task Test_03_SimpleNotStrictAreaComs_HonorGebunden() {
|
||||||
// TODO
|
int mgnr = MgNr1, year = Year2;
|
||||||
|
|
||||||
|
var areaCom = await GetMemberAreaCommitmentBuckets(year, mgnr);
|
||||||
|
Assert.Multiple(() => {
|
||||||
|
Assert.That(areaCom, Has.Count.EqualTo(1));
|
||||||
|
Assert.That(areaCom["GV"], Is.EqualTo(new AreaComBucket(10_000, 5_000, 10_000)));
|
||||||
|
});
|
||||||
|
var delivery = await GetMemberDeliveryBuckets(year, mgnr);
|
||||||
|
Assert.Multiple(() => {
|
||||||
|
Assert.That(delivery, Has.Count.EqualTo(4));
|
||||||
|
Assert.That(delivery["GV"], Is.EqualTo(16_000));
|
||||||
|
Assert.That(delivery["GV_"], Is.EqualTo( 1_000));
|
||||||
|
Assert.That(delivery["GVB"], Is.EqualTo( 8_000));
|
||||||
|
Assert.That(delivery["GVK"], Is.EqualTo( 4_000));
|
||||||
|
});
|
||||||
|
|
||||||
|
BillingVariant b = new(year, 1);
|
||||||
|
await b.CalculateBuckets(true, false, false, Connection);
|
||||||
|
var payment = await GetMemberPaymentBuckets(year, mgnr);
|
||||||
|
Assert.Multiple(() => {
|
||||||
|
Assert.That(payment, Has.Count.EqualTo(2));
|
||||||
|
Assert.That(payment["GV_"], Is.EqualTo(9_000));
|
||||||
|
Assert.That(payment["GV"], Is.EqualTo(8_000));
|
||||||
|
});
|
||||||
|
|
||||||
|
await b.Calculate(true, false, false);
|
||||||
|
var prices = await GetMemberDeliveryPrices(year, mgnr);
|
||||||
|
Assert.Multiple(() => {
|
||||||
|
Assert.That(prices, Has.Count.EqualTo(8));
|
||||||
|
// Kabinett
|
||||||
|
Assert.That(prices[("20211001X001/1", "GV_")], Is.EqualTo(( 0, GV_ungeb)));
|
||||||
|
Assert.That(prices[("20211001X001/1", "GV")], Is.EqualTo((4_000, GV_geb)));
|
||||||
|
// ohne Attribut
|
||||||
|
Assert.That(prices[("20211001X001/2", "GV_")], Is.EqualTo((4_000, GV_ungeb)));
|
||||||
|
// Bio
|
||||||
|
Assert.That(prices[("20211001X002/1", "GV_")], Is.EqualTo(( 0, GVB_ungeb)));
|
||||||
|
Assert.That(prices[("20211001X002/1", "GV")], Is.EqualTo((4_000, GVB_geb)));
|
||||||
|
// Bio
|
||||||
|
Assert.That(prices[("20211001X002/2", "GV_")], Is.EqualTo((4_000, GVB_ungeb)));
|
||||||
|
// ohne Attribut
|
||||||
|
Assert.That(prices[("20211001X003/1", "GV_")], Is.EqualTo(( 500, WEI)));
|
||||||
|
// ohne Attribut
|
||||||
|
Assert.That(prices[("20211001X003/2", "GV_")], Is.EqualTo(( 500, GV_ungeb)));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
|||||||
@@ -0,0 +1,113 @@
|
|||||||
|
using Elwig.Helpers;
|
||||||
|
using Elwig.Helpers.Export;
|
||||||
|
using Elwig.Models.Dtos;
|
||||||
|
using Elwig.Models.Entities;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Xml;
|
||||||
|
|
||||||
|
namespace Tests.HelperTests {
|
||||||
|
// see https://www.iso20022.org/iso-20022-message-definitions
|
||||||
|
// and https://www.iso20022.org/catalogue-messages/iso-20022-messages-archive?search=pain
|
||||||
|
[TestFixture]
|
||||||
|
public class EbicsTest {
|
||||||
|
|
||||||
|
public static readonly string FileName = Path.Combine(Path.GetTempPath(), "test_ebics.xml");
|
||||||
|
public static readonly string Iban = "AT123456789012345678";
|
||||||
|
|
||||||
|
private static void ValidateSchema(string xmlPath, int version) {
|
||||||
|
XmlDocument xml = new();
|
||||||
|
xml.Load(xmlPath);
|
||||||
|
var schema = new XmlTextReader(Assembly.GetExecutingAssembly()
|
||||||
|
.GetManifestResourceStream($"Tests.Resources.Schemas.pain.001.001.{version:00}.xsd")!);
|
||||||
|
xml.Schemas.Add(null, schema);
|
||||||
|
xml.Validate(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static async Task CreateXmlFile(int version) {
|
||||||
|
var v = new PaymentVar() {
|
||||||
|
Year = 2020,
|
||||||
|
AvNr = 1,
|
||||||
|
Name = "Endauszahlung",
|
||||||
|
TransferDate = new DateOnly(2021, 6, 15),
|
||||||
|
};
|
||||||
|
using var ctx = new AppDbContext();
|
||||||
|
var members = ctx.Members.ToList();
|
||||||
|
Assert.That(members, Has.Count.GreaterThan(0));
|
||||||
|
using var exporter = new Ebics(v, FileName, version);
|
||||||
|
await exporter.ExportAsync(members.Select(m => new Transaction(m, 1234.56m, "EUR", m.MgNr % 100)));
|
||||||
|
}
|
||||||
|
|
||||||
|
[TearDown]
|
||||||
|
public static void RemoveXmlFile() {
|
||||||
|
File.Delete(FileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
[Ignore("Version has no need to be supported")]
|
||||||
|
public async Task Test_CustomerCreditTransferInitiationV01() {
|
||||||
|
await CreateXmlFile(1);
|
||||||
|
Assert.DoesNotThrow(() => ValidateSchema(FileName, 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
[Ignore("Version has no need to be supported")]
|
||||||
|
public async Task Test_CustomerCreditTransferInitiationV02() {
|
||||||
|
await CreateXmlFile(2);
|
||||||
|
Assert.DoesNotThrow(() => ValidateSchema(FileName, 2));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public async Task Test_CustomerCreditTransferInitiationV03() {
|
||||||
|
await CreateXmlFile(3);
|
||||||
|
Assert.DoesNotThrow(() => ValidateSchema(FileName, 3));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public async Task Test_CustomerCreditTransferInitiationV04() {
|
||||||
|
await CreateXmlFile(4);
|
||||||
|
Assert.DoesNotThrow(() => ValidateSchema(FileName, 4));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public async Task Test_CustomerCreditTransferInitiationV05() {
|
||||||
|
await CreateXmlFile(5);
|
||||||
|
Assert.DoesNotThrow(() => ValidateSchema(FileName, 5));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public async Task Test_CustomerCreditTransferInitiationV06() {
|
||||||
|
await CreateXmlFile(6);
|
||||||
|
Assert.DoesNotThrow(() => ValidateSchema(FileName, 6));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public async Task Test_CustomerCreditTransferInitiationV07() {
|
||||||
|
await CreateXmlFile(7);
|
||||||
|
Assert.DoesNotThrow(() => ValidateSchema(FileName, 7));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public async Task Test_CustomerCreditTransferInitiationV08() {
|
||||||
|
await CreateXmlFile(8);
|
||||||
|
Assert.DoesNotThrow(() => ValidateSchema(FileName, 8));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public async Task Test_CustomerCreditTransferInitiationV09() {
|
||||||
|
await CreateXmlFile(9);
|
||||||
|
Assert.DoesNotThrow(() => ValidateSchema(FileName, 9));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public async Task Test_CustomerCreditTransferInitiationV10() {
|
||||||
|
await CreateXmlFile(10);
|
||||||
|
Assert.DoesNotThrow(() => ValidateSchema(FileName, 10));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public async Task Test_CustomerCreditTransferInitiationV11() {
|
||||||
|
await CreateXmlFile(11);
|
||||||
|
Assert.DoesNotThrow(() => ValidateSchema(FileName, 11));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
-- deletes for HelperTests.BillingTest
|
-- deletes for HelperTests.BillingTest
|
||||||
|
|
||||||
DELETE FROM credit;
|
DELETE FROM credit;
|
||||||
DELETE FROM payment_variant
|
DELETE FROM payment_variant;
|
||||||
DELETE FROM delivery;
|
DELETE FROM delivery;
|
||||||
DELETE FROM area_commitment;
|
DELETE FROM area_commitment;
|
||||||
DELETE FROM area_commitment_type;
|
DELETE FROM area_commitment_type;
|
||||||
|
|||||||
@@ -16,17 +16,18 @@ INSERT INTO wine_attribute (attrid, name, active, max_kg_per_ha, strict, fill_lo
|
|||||||
('R', 'Vertrag R', TRUE, NULL, TRUE, 2);
|
('R', 'Vertrag R', TRUE, NULL, TRUE, 2);
|
||||||
|
|
||||||
INSERT INTO area_commitment_type (vtrgid, sortid, attrid, disc, min_kg_per_ha, penalty_per_kg, penalty_amount, penalty_none) VALUES
|
INSERT INTO area_commitment_type (vtrgid, sortid, attrid, disc, min_kg_per_ha, penalty_per_kg, penalty_amount, penalty_none) VALUES
|
||||||
('ZW', 'ZW', NULL, NULL, 2500, 600, NULL, NULL),
|
('ZW', 'ZW', NULL, NULL, 2500, 600, NULL, NULL),
|
||||||
('GV', 'GV', NULL, NULL, 5000, 500, NULL, NULL),
|
('GV', 'GV', NULL, NULL, 5000, 500, NULL, NULL),
|
||||||
('GVK', 'GV', 'K', NULL, 5000, 500, NULL, NULL),
|
('GVK', 'GV', 'K', NULL, 5000, 500, NULL, NULL),
|
||||||
('GVD', 'GV', 'D', NULL, 5000, 1000, NULL, NULL),
|
('GVD', 'GV', 'D', NULL, 5000, 1000, NULL, NULL),
|
||||||
('GVP', 'GV', 'P', NULL, 5000, 1000, 1000000, NULL),
|
('GVP', 'GV', 'P', NULL, 5000, 1000, 1000000, NULL),
|
||||||
('GVQ', 'GV', 'Q', NULL, 5000, 1000, 1000000, NULL),
|
('GVQ', 'GV', 'Q', NULL, 5000, 1000, 1000000, NULL),
|
||||||
('GVR', 'GV', 'R', NULL, 5000, 1000, 1000000, NULL);
|
('GVR', 'GV', 'R', NULL, 5000, 1000, 1000000, NULL);
|
||||||
|
|
||||||
INSERT INTO area_commitment (fbnr, mgnr, vtrgid, cultid, area, kgnr, gstnr, rdnr, year_from, year_to) VALUES
|
INSERT INTO area_commitment (fbnr, mgnr, vtrgid, cultid, area, kgnr, gstnr, rdnr, year_from, year_to) VALUES
|
||||||
( 1, 101, 'GV', 'K', 10000, 06109, '123/4', NULL, 2000, 2019),
|
( 1, 101, 'GV', 'K', 10000, 06109, '123/4', NULL, 2000, 2019),
|
||||||
( 2, 101, 'GV', 'B', 10000, 06109, '123/5', NULL, 2025, 2030);
|
( 2, 101, 'GV', 'K', 10000, 06109, '123/5', NULL, 2025, 2030),
|
||||||
|
( 3, 101, 'GV', 'K', 10000, 06109, '123/6', NULL, 2021, 2031);
|
||||||
|
|
||||||
INSERT INTO season (year, currency, min_kg_per_bs, max_kg_per_bs, penalty_per_kg, penalty_amount, penalty_none, start_date, end_date) VALUES
|
INSERT INTO season (year, currency, min_kg_per_bs, max_kg_per_bs, penalty_per_kg, penalty_amount, penalty_none, start_date, end_date) VALUES
|
||||||
(2020, 'EUR', 1000, 2000, NULL, NULL, NULL, NULL, NULL),
|
(2020, 'EUR', 1000, 2000, NULL, NULL, NULL, NULL, NULL),
|
||||||
@@ -36,18 +37,30 @@ INSERT INTO modifier (year, modid, ordering, name, abs, rel, standard, quick_sel
|
|||||||
(2020, 'S', 0, 'Geschädigte Trauben', NULL, -0.1, FALSE, FALSE),
|
(2020, 'S', 0, 'Geschädigte Trauben', NULL, -0.1, FALSE, FALSE),
|
||||||
(2020, 'A', 0, 'Keine Voranmeldung', -1000, NULL, FALSE, FALSE);
|
(2020, 'A', 0, 'Keine Voranmeldung', -1000, NULL, FALSE, FALSE);
|
||||||
|
|
||||||
|
-- Test 01
|
||||||
INSERT INTO delivery (mgnr, year, did, date, time, zwstid, lnr) VALUES
|
INSERT INTO delivery (mgnr, year, did, date, time, zwstid, lnr) VALUES
|
||||||
(101, 2020, 1, '2020-10-01', NULL, 'X', 1),
|
(101, 2020, 1, '2020-10-01', NULL, 'X', 1),
|
||||||
(101, 2020, 2, '2020-10-01', NULL, 'X', 2),
|
(101, 2020, 2, '2020-10-01', NULL, 'X', 2),
|
||||||
(101, 2020, 3, '2020-10-01', NULL, 'X', 3);
|
(101, 2020, 3, '2020-10-01', NULL, 'X', 3);
|
||||||
|
|
||||||
INSERT INTO delivery_part (year, did, dpnr, sortid, attrid, weight, kmw, qualid, hkid, kgnr, gerebelt, manual_weighing, spl_check, scale_id, weighing_id, weighing_reason) VALUES
|
INSERT INTO delivery_part (year, did, dpnr, sortid, attrid, weight, kmw, qualid, hkid, kgnr, gerebelt, manual_weighing, spl_check, scale_id, weighing_id, weighing_reason) VALUES
|
||||||
(2020, 1, 1, 'GV', 'K', 4000, 17, 'KAB', 'WLNO', 06109, TRUE, FALSE, FALSE, NULL, NULL, NULL),
|
(2020, 1, 1, 'GV', 'K', 4000, 17, 'KAB', 'WLNO', 06109, TRUE, FALSE, FALSE, NULL, NULL, NULL),
|
||||||
(2020, 1, 2, 'GV', NULL, 4000, 16, 'QUW', 'WLNO', 06109, TRUE, FALSE, FALSE, NULL, NULL, NULL),
|
(2020, 1, 2, 'GV', NULL, 4000, 16, 'QUW', 'WLNO', 06109, TRUE, FALSE, FALSE, NULL, NULL, NULL),
|
||||||
(2020, 2, 1, 'GV', 'B', 4000, 15, 'QUW', 'WLNO', 06109, TRUE, FALSE, FALSE, NULL, NULL, NULL),
|
(2020, 2, 1, 'GV', 'B', 4000, 15, 'QUW', 'WLNO', 06109, TRUE, FALSE, FALSE, NULL, NULL, NULL),
|
||||||
(2020, 2, 2, 'GV', 'B', 4000, 16, 'QUW', 'WLNO', 06109, TRUE, FALSE, FALSE, NULL, NULL, NULL),
|
(2020, 2, 2, 'GV', 'B', 4000, 16, 'QUW', 'WLNO', 06109, TRUE, FALSE, FALSE, NULL, NULL, NULL),
|
||||||
(2020, 3, 1, 'GV', NULL, 500, 15, 'WEI', 'OEST', 06109, TRUE, FALSE, FALSE, NULL, NULL, NULL),
|
(2020, 3, 1, 'GV', NULL, 500, 15, 'WEI', 'OEST', 06109, TRUE, FALSE, FALSE, NULL, NULL, NULL),
|
||||||
(2020, 3, 2, 'GV', NULL, 500, 14, 'LDW', 'WLXX', 06109, TRUE, FALSE, FALSE, NULL, NULL, NULL);
|
(2020, 3, 2, 'GV', NULL, 500, 14, 'LDW', 'WLXX', 06109, TRUE, FALSE, FALSE, NULL, NULL, NULL);
|
||||||
|
|
||||||
INSERT INTO delivery_part_modifier (year, did, dpnr, modid) VALUES
|
INSERT INTO delivery_part_modifier (year, did, dpnr, modid) VALUES
|
||||||
(2020, 1, 2, 'S');
|
(2020, 1, 2, 'S');
|
||||||
|
|
||||||
|
-- Test 02 + 03
|
||||||
|
INSERT INTO delivery (mgnr, year, did, date, time, zwstid, lnr) VALUES
|
||||||
|
(101, 2021, 1, '2021-10-01', NULL, 'X', 1),
|
||||||
|
(101, 2021, 2, '2021-10-01', NULL, 'X', 2),
|
||||||
|
(101, 2021, 3, '2021-10-01', NULL, 'X', 3);
|
||||||
|
INSERT INTO delivery_part (year, did, dpnr, sortid, attrid, weight, kmw, qualid, hkid, kgnr, gebunden, gerebelt, manual_weighing, spl_check, scale_id, weighing_id, weighing_reason) VALUES
|
||||||
|
(2021, 1, 1, 'GV', 'K', 4000, 17, 'KAB', 'WLNO', 06109, TRUE, TRUE, FALSE, FALSE, NULL, NULL, NULL),
|
||||||
|
(2021, 1, 2, 'GV', NULL, 4000, 16, 'QUW', 'WLNO', 06109, FALSE, TRUE, FALSE, FALSE, NULL, NULL, NULL),
|
||||||
|
(2021, 2, 1, 'GV', 'B', 4000, 15, 'QUW', 'WLNO', 06109, TRUE, TRUE, FALSE, FALSE, NULL, NULL, NULL),
|
||||||
|
(2021, 2, 2, 'GV', 'B', 4000, 16, 'QUW', 'WLNO', 06109, FALSE, TRUE, FALSE, FALSE, NULL, NULL, NULL),
|
||||||
|
(2021, 3, 1, 'GV', NULL, 500, 15, 'WEI', 'OEST', 06109, NULL, TRUE, FALSE, FALSE, NULL, NULL, NULL),
|
||||||
|
(2021, 3, 2, 'GV', NULL, 500, 14, 'LDW', 'WLXX', 06109, NULL, TRUE, FALSE, FALSE, NULL, NULL, NULL);
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
-- deletes for DocumentTests
|
||||||
|
|
||||||
|
DELETE FROM delivery;
|
||||||
|
DELETE FROM season;
|
||||||
|
DELETE FROM wine_attribute;
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
-- inserts for DocumentTests
|
||||||
|
|
||||||
|
INSERT INTO wine_attribute (attrid, name, active, max_kg_per_ha, strict, fill_lower) VALUES
|
||||||
|
('B', 'Bio', TRUE, NULL, FALSE, 0),
|
||||||
|
('K', 'Kabinett', TRUE, NULL, FALSE, 0);
|
||||||
|
|
||||||
|
INSERT INTO season (year, currency, min_kg_per_bs, max_kg_per_bs, penalty_per_kg, penalty_amount, penalty_none, start_date, end_date) VALUES
|
||||||
|
(2020, 'EUR', 1000, 2000, NULL, NULL, NULL, NULL, NULL);
|
||||||
|
|
||||||
|
INSERT INTO modifier (year, modid, ordering, name, abs, rel, standard, quick_select) VALUES
|
||||||
|
(2020, 'S', 0, 'Geschädigte Trauben', NULL, -0.1, FALSE, FALSE),
|
||||||
|
(2020, 'A', 0, 'Keine Voranmeldung', -1000, NULL, FALSE, FALSE);
|
||||||
|
|
||||||
|
INSERT INTO delivery (mgnr, year, did, date, time, zwstid, lnr) VALUES
|
||||||
|
(101, 2020, 1, '2020-10-01', NULL, 'X', 1),
|
||||||
|
(101, 2020, 2, '2020-10-01', NULL, 'X', 2),
|
||||||
|
(101, 2020, 3, '2020-10-01', NULL, 'X', 3);
|
||||||
|
|
||||||
|
INSERT INTO delivery_part (year, did, dpnr, sortid, attrid, weight, kmw, qualid, hkid, kgnr, gerebelt, manual_weighing, spl_check, scale_id, weighing_id, weighing_reason) VALUES
|
||||||
|
(2020, 1, 1, 'GV', NULL, 4000, 17, 'KAB', 'WLNO', 06109, TRUE, FALSE, FALSE, NULL, NULL, NULL);
|
||||||
@@ -1,31 +1,9 @@
|
|||||||
-- inserts for DatabaseSetup
|
-- inserts for DatabaseSetup
|
||||||
|
|
||||||
INSERT INTO client_parameter (param, value) VALUES
|
|
||||||
('CLIENT_NAME_TOKEN', 'WGT'),
|
|
||||||
('CLIENT_NAME_SHORT', 'WG Test'),
|
|
||||||
('CLIENT_NAME', 'Winzergenossenschaft Test'),
|
|
||||||
('CLIENT_NAME_SUFFIX', NULL),
|
|
||||||
('CLIENT_NAME_TYPE', 'reg.Gen.m.b.H.'),
|
|
||||||
('CLIENT_PLZ', '1234'),
|
|
||||||
('CLIENT_ORT', 'Musterstadt'),
|
|
||||||
('CLIENT_ADDRESS', 'Musterstraße 1'),
|
|
||||||
('CLIENT_IBAN', 'AT12 3456 7890 1234 5678');
|
|
||||||
|
|
||||||
INSERT INTO branch (zwstid, name) VALUES
|
|
||||||
('X', 'Test');
|
|
||||||
|
|
||||||
INSERT INTO wb_gl (glnr, name) VALUES
|
|
||||||
(1, 'Matzner Hügel'),
|
|
||||||
(2, 'Wolkersdorfer Hochleithen');
|
|
||||||
|
|
||||||
INSERT INTO AT_gem (gkz, name) VALUES
|
INSERT INTO AT_gem (gkz, name) VALUES
|
||||||
(30828, 'Hohenruppersdorf'),
|
(30828, 'Hohenruppersdorf'),
|
||||||
(31655, 'Wolkersdorf im Weinviertel');
|
(31655, 'Wolkersdorf im Weinviertel');
|
||||||
|
|
||||||
INSERT INTO wb_gem (gkz, hkid) VALUES
|
|
||||||
(30828, 'WLWV'),
|
|
||||||
(31655, 'WLWV');
|
|
||||||
|
|
||||||
INSERT INTO AT_kg (kgnr, gkz, name) VALUES
|
INSERT INTO AT_kg (kgnr, gkz, name) VALUES
|
||||||
(06109, 30828, 'Hohenruppersdorf'),
|
(06109, 30828, 'Hohenruppersdorf'),
|
||||||
(15209, 31655, 'Münichsthal'),
|
(15209, 31655, 'Münichsthal'),
|
||||||
@@ -34,14 +12,6 @@ INSERT INTO AT_kg (kgnr, gkz, name) VALUES
|
|||||||
(15216, 31655, 'Riedentahl'),
|
(15216, 31655, 'Riedentahl'),
|
||||||
(15224, 31655, 'Wolkersdorf');
|
(15224, 31655, 'Wolkersdorf');
|
||||||
|
|
||||||
INSERT INTO wb_kg (kgnr, glnr) VALUES
|
|
||||||
(06109, 1),
|
|
||||||
(15209, 2),
|
|
||||||
(15211, 2),
|
|
||||||
(15212, 2),
|
|
||||||
(15216, 2),
|
|
||||||
(15224, 2);
|
|
||||||
|
|
||||||
INSERT INTO AT_ort (okz, gkz, kgnr, name) VALUES
|
INSERT INTO AT_ort (okz, gkz, kgnr, name) VALUES
|
||||||
(03524, 30828, 06109, 'Hohenruppersdorf'),
|
(03524, 30828, 06109, 'Hohenruppersdorf'),
|
||||||
(05092, 31655, 15211, 'Obersdorf'),
|
(05092, 31655, 15211, 'Obersdorf'),
|
||||||
@@ -63,8 +33,43 @@ INSERT INTO AT_plz_dest (plz, okz, dest) VALUES
|
|||||||
(2122, 05136, 'Pfösing'),
|
(2122, 05136, 'Pfösing'),
|
||||||
(2122, 05137, 'Riedenthal');
|
(2122, 05137, 'Riedenthal');
|
||||||
|
|
||||||
INSERT INTO member (mgnr, given_name, family_name, zwstid, volllieferant, buchführend, country, postal_dest, address, default_kgnr, iban) VALUES
|
INSERT INTO client_parameter (param, value) VALUES
|
||||||
(101, 'Max', 'Mustermann', 'X', FALSE, FALSE, 40, 222303524, 'Winzerstraße 1', 06109, 'AT123456789012345678'),
|
('CLIENT_NAME_TOKEN', 'WGT'),
|
||||||
(102, 'Wernhardt', 'Weinbauer', 'X', FALSE, FALSE, 40, 222303524, 'Winzerstraße 2', 06109, 'AT123456789012345678'),
|
('CLIENT_NAME_SHORT', 'WG Test'),
|
||||||
(103, 'Matthäus', 'Musterbauer', 'X', FALSE, FALSE, 40, 212005138, 'Brünner Straße 10', 15224, 'AT123456789012345678'),
|
('CLIENT_NAME', 'Winzergenossenschaft Test'),
|
||||||
(104, 'Waltraud', 'Winzer', 'X', FALSE, FALSE, 40, 212005138, 'Wiener Straße 15', 15224, 'AT123456789012345678');
|
('CLIENT_NAME_SUFFIX', NULL),
|
||||||
|
('CLIENT_NAME_TYPE', 'reg.Gen.m.b.H.'),
|
||||||
|
('CLIENT_PLZ', '2120'),
|
||||||
|
('CLIENT_ORT', 'Wolkersdorf'),
|
||||||
|
('CLIENT_ADDRESS', 'Genossenschaftsstraße 1'),
|
||||||
|
('CLIENT_IBAN', 'AT12 3456 7890 1234 5678'),
|
||||||
|
('TEXT_DELIVERYNOTE', 'Ich bin der Text, der auf einem Traubenübernahmeschein steht!');
|
||||||
|
|
||||||
|
INSERT INTO branch (zwstid, name, country, postal_dest, address) VALUES
|
||||||
|
('X', 'Test', 40, 212005138, 'Genossenschaftsstraße 1');
|
||||||
|
|
||||||
|
INSERT INTO wb_gl (glnr, name) VALUES
|
||||||
|
(1, 'Matzner Hügel'),
|
||||||
|
(2, 'Wolkersdorfer Hochleithen');
|
||||||
|
|
||||||
|
INSERT INTO wb_gem (gkz, hkid) VALUES
|
||||||
|
(30828, 'WLWV'),
|
||||||
|
(31655, 'WLWV');
|
||||||
|
|
||||||
|
INSERT INTO wb_kg (kgnr, glnr) VALUES
|
||||||
|
(06109, 1),
|
||||||
|
(15209, 2),
|
||||||
|
(15211, 2),
|
||||||
|
(15212, 2),
|
||||||
|
(15216, 2),
|
||||||
|
(15224, 2);
|
||||||
|
|
||||||
|
INSERT INTO member (mgnr, given_name, family_name, zwstid, volllieferant, buchführend, country, postal_dest, address, default_kgnr, iban, lfbis_nr) VALUES
|
||||||
|
(101, 'Max', 'Mustermann', 'X', FALSE, FALSE, 40, 222303524, 'Winzerstraße 1', 06109, 'AT123456789012345678', '1472583'),
|
||||||
|
(102, 'Wernhardt', 'Weinbauer', 'X', FALSE, FALSE, 40, 222303524, 'Winzerstraße 2', 06109, 'AT123456789012345678', '4725836'),
|
||||||
|
(103, 'Matthäus', 'Musterbauer', 'X', FALSE, FALSE, 40, 212005138, 'Brünner Straße 10', 15224, 'AT123456789012345678', '7258369'),
|
||||||
|
(104, 'Waltraud', 'Winzer', 'X', FALSE, FALSE, 40, 212005138, 'Wiener Straße 15', 15224, 'AT123456789012345678', '2583691');
|
||||||
|
|
||||||
|
INSERT INTO member_billing_address (mgnr, name, country, postal_dest, address) VALUES
|
||||||
|
(102, 'W&B Weinbauer GesbR', 40, 222303524, 'Winzerstraße 2'),
|
||||||
|
(104, 'Weinbau Waltraud Winzer GmbH', 40, 212205137, 'Hauptstraße 1');
|
||||||
|
|||||||
+4
-3
@@ -4,9 +4,9 @@
|
|||||||
<TargetFramework>net8.0-windows</TargetFramework>
|
<TargetFramework>net8.0-windows</TargetFramework>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
|
|
||||||
<IsPackable>false</IsPackable>
|
<IsPackable>false</IsPackable>
|
||||||
<IsTestProject>true</IsTestProject>
|
<IsTestProject>true</IsTestProject>
|
||||||
|
<PreserveCompilationContext>true</PreserveCompilationContext>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@@ -19,10 +19,11 @@
|
|||||||
</Target>
|
</Target>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
|
||||||
|
<PackageReference Include="NReco.PdfRenderer" Version="1.5.3" />
|
||||||
<PackageReference Include="NUnit" Version="4.0.1" />
|
<PackageReference Include="NUnit" Version="4.0.1" />
|
||||||
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
|
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
|
||||||
<PackageReference Include="NUnit.Analyzers" Version="3.10.0">
|
<PackageReference Include="NUnit.Analyzers" Version="4.0.1">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
curl -s -L "https://www.necronda.net/elwig/files/create.sql?v=15" -u "elwig:ganzGeheim123!" -o "Resources\Sql\Create.sql"
|
curl -s -L "https://www.necronda.net/elwig/files/create.sql?v=16" -u "elwig:ganzGeheim123!" -o "Resources\Sql\Create.sql"
|
||||||
|
|||||||
Reference in New Issue
Block a user