This commit is contained in:
Piotr Dudek 2024-09-23 11:15:01 +02:00
parent ec382ecbbc
commit be4ff5c9ee
11 changed files with 111 additions and 13 deletions

View File

@ -8,11 +8,11 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.7"> <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.8">
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference> </PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.7" /> <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.8" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -0,0 +1,53 @@
namespace FKGees.DocsDefinitions.Decrets;
public class DostawaPrasy : IDecretsDefinition
{
public int DocType => 81;
public string Type => "Dprs";
public List<Definition> Definitions { get; } =
[
new Definition("305-60-24", "MA", "[znr]"),
new Definition("342-0-24", "MA", "[snr]-[znr]"),
new Definition("343-0-24", "MA", "[sbr]-[snr]"),
new Definition("332-0-24", "WN", "[sbr]")
];
public Task<List<DecretsResult>> Process(IReadOnlyList<Dok> documents)
{
var result = new List<DecretsResult>();
var toProcess = documents
.Where(x => x.TypDok == DocType && x.RozliczaRozliczanyDok.Count == 0);
foreach (var dok in toProcess)
{
Definitions.ForEach(d =>
{
var item = dok.DecretKontr();
item.Data = dok.DataPom;
item.DataWplywu = dok.Data;
item.Nr = dok.NrDok;
item.Opis = d.Account == "305-60-24" ? item.k_NIP : dok.NrDok;
item.StronaKonta = d.AccountSide;
item.KontoFk = d.Account;
item.Kwota = ProcessValue(dok, d.Expression).AsString();
result.Add(item);
});
}
return Task.FromResult(result);
}
private static decimal ProcessValue(Dok doc, string expression)
{
return expression switch
{
"[znr]" => doc.Netto,
"[snr]-[znr]" => doc.NettoDet - doc.Netto,
"[sbr]-[snr]" => doc.Podatek,
"[sbr]" => doc.NettoDet + doc.PodatekDet,
_ => 0
};
}
}

View File

@ -7,7 +7,7 @@ public class KpInne : IDecretsDefinition
public List<Definition> Definitions { get; } = public List<Definition> Definitions { get; } =
[ [
new Definition("139-1-24", "WN", "[sbr]"), new Definition("139-1-24", "WN", "[sbr]"),
new Definition("100-1-24", "MA", "[sbr]") new Definition("100-1-24", "WN", "[sbr]")
]; ];
public Task<List<DecretsResult>> Process(IReadOnlyList<Dok> documents) public Task<List<DecretsResult>> Process(IReadOnlyList<Dok> documents)

View File

@ -7,7 +7,7 @@ public class KpLotto : IDecretsDefinition
public List<Definition> Definitions { get; } = public List<Definition> Definitions { get; } =
[ [
new Definition("100-1-24", "WN", "[sbr]"), new Definition("100-1-24", "WN", "[sbr]"),
new Definition("249-1-22", "MA", "[sbr]") new Definition("249-0-22", "MA", "[sbr]")
]; ];
public Task<List<DecretsResult>> Process(IReadOnlyList<Dok> documents) public Task<List<DecretsResult>> Process(IReadOnlyList<Dok> documents)

View File

@ -0,0 +1,41 @@
namespace FKGees.DocsDefinitions.Decrets;
public class KwCashback : IDecretsDefinition
{
public int DocType => 53;
public string Type => nameof(KwCashback);
public List<Definition> Definitions { get; } =
[
new Definition("249-0-19", "WN", "[sbr]")
];
public Task<List<DecretsResult>> Process(IReadOnlyList<Dok> documents)
{
var result = new List<DecretsResult>();
var toProcess = documents
.Where(x => x.TypDok == DocType && x.Kwota5 != 0)
.GroupBy(x => x.Data);
foreach (var dok in toProcess)
{
Definitions.ForEach(d =>
{
var item = new DecretsResult
{
Data = dok.Key,
DataWplywu = dok.Key,
Nr = string.Join(", ",dok.Select(z => z.NrDok)),
Opis = "CashBack",
StronaKonta = d.AccountSide,
KontoFk = d.Account,
Kwota = dok.Sum(x => x.Kwota5).AsString()
};
result.Add(item);
});
}
return Task.FromResult(result);
}
}

View File

@ -6,7 +6,7 @@ public class KwPolcard : IDecretsDefinition
public string Type => nameof(KwPolcard); public string Type => nameof(KwPolcard);
public List<Definition> Definitions { get; } = public List<Definition> Definitions { get; } =
[ [
new Definition("249-0-29", "WN", "[sbr]"), new Definition("249-0-19", "WN", "[sbr]"),
new Definition("100-1-24", "MA", "[sbr]") new Definition("100-1-24", "MA", "[sbr]")
]; ];

View File

@ -26,7 +26,7 @@ public class MmMinus : IDecretsDefinition
item.Data = dok.DataPom; item.Data = dok.DataPom;
item.DataWplywu = dok.Data; item.DataWplywu = dok.Data;
item.Nr = dok.NrDok; item.Nr = dok.NrDok;
item.Opis = dok.TekstZaCo(); item.Opis = $"{dok.NrDok} / PRZERZUT NA {item.k_Skrot}";
item.StronaKonta = d.AccountSide; item.StronaKonta = d.AccountSide;
item.KontoFk = d.Account; item.KontoFk = d.Account;
item.Kwota = ProcessValue(dok, d.Expression).AsString(); item.Kwota = ProcessValue(dok, d.Expression).AsString();

View File

@ -26,7 +26,7 @@ public class MmPlus : IDecretsDefinition
item.Data = dok.DataPom; item.Data = dok.DataPom;
item.DataWplywu = dok.Data; item.DataWplywu = dok.Data;
item.Nr = dok.NrDok; item.Nr = dok.NrDok;
item.Opis = dok.TekstZaCo(); item.Opis = $"{dok.NrDok} / PRZERZUT Z {item.k_Skrot}";
item.StronaKonta = d.AccountSide; item.StronaKonta = d.AccountSide;
item.KontoFk = d.Account; item.KontoFk = d.Account;
item.Kwota = ProcessValue(dok, d.Expression).AsString(); item.Kwota = ProcessValue(dok, d.Expression).AsString();

View File

@ -8,12 +8,13 @@ public class RapFisk : IDecretsDefinition
[ [
new Definition("737-0-24", "WN", "[sbr]"), new Definition("737-0-24", "WN", "[sbr]"),
new Definition("332-0-24", "MA", "[sbr]"), new Definition("332-0-24", "MA", "[sbr]"),
new Definition("139-1-24", "WN", "[sbr]"), new Definition("139-1-24", "WN", "[sb]"),
new Definition("732-0-24", "MA", "[sbr]"), new Definition("732-0-24", "MA", "[sbr]"),
new Definition("343-0-24", "WN", "[svr]"), new Definition("343-0-24", "WN", "[svr]"),
new Definition("737-0-24", "MA", "[svr]"), new Definition("737-0-24", "MA", "[svr]"),
new Definition("732-0-24", "WN", "[svr]"), new Definition("732-0-24", "WN", "[svr]"),
new Definition("222-0-24", "MA", "[svr]") new Definition("222-0-24", "MA", "[svr]"),
new Definition("100-1-24", "MA", "[sb]")
]; ];
public Task<List<DecretsResult>> Process(IReadOnlyList<Dok> documents) public Task<List<DecretsResult>> Process(IReadOnlyList<Dok> documents)
@ -53,6 +54,7 @@ public class RapFisk : IDecretsDefinition
{ {
"[sbr]" => doc.Razem - doc.Kwota1 + doc.Kwota2, "[sbr]" => doc.Razem - doc.Kwota1 + doc.Kwota2,
"[svr]" => doc.Podatek, "[svr]" => doc.Podatek,
"[sb]" => doc.Razem,
_ => 0 _ => 0
}; };
} }

View File

@ -34,6 +34,8 @@ internal static class ServiceCollectionExtensions
services.AddSingleton<IDecretsDefinition, Zwroty>(); services.AddSingleton<IDecretsDefinition, Zwroty>();
services.AddSingleton<IDecretsDefinition, Rozb>(); services.AddSingleton<IDecretsDefinition, Rozb>();
services.AddSingleton<IDecretsDefinition, KorCenZak>(); services.AddSingleton<IDecretsDefinition, KorCenZak>();
services.AddSingleton<IDecretsDefinition, KwCashback>();
services.AddSingleton<IDecretsDefinition, DostawaPrasy>();
return services; return services;
} }

View File

@ -9,15 +9,15 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="CsvHelper" Version="33.0.1" /> <PackageReference Include="CsvHelper" Version="33.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.7"> <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.8">
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference> </PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.7" /> <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.8" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0"/> <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0"/>
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0"/> <PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0"/>
<PackageReference Include="NLog" Version="5.3.2"/> <PackageReference Include="NLog" Version="5.3.4" />
<PackageReference Include="NLog.Extensions.Logging" Version="5.3.11"/> <PackageReference Include="NLog.Extensions.Logging" Version="5.3.13" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>