Zwroty + rozb.
This commit is contained in:
parent
10210abe89
commit
9dfaad971c
@ -8,11 +8,11 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.6">
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.7">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.6" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.7" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
71
FKGees/DocsDefinitions/Decrets/Rozb.cs
Normal file
71
FKGees/DocsDefinitions/Decrets/Rozb.cs
Normal file
@ -0,0 +1,71 @@
|
||||
using FKGees.Services;
|
||||
|
||||
namespace FKGees.DocsDefinitions.Decrets;
|
||||
|
||||
public class Rozb : IDecretsDefinition
|
||||
{
|
||||
public int DocType => 26;
|
||||
public string Type => "Rozb";
|
||||
public List<Definition> Definitions { get; } =
|
||||
[
|
||||
new Definition("301-0-24", "WN", "[znr]"), new Definition("221-0-24", "WN", "[zvr]"), new Definition("210-1", "MA", "[zbr]"),
|
||||
new Definition("301-0-24", "MA", "[zbr]"), new Definition("332-0-24", "WN", "[sbr]"), new Definition("343-0-24", "MA", "[svr]"),
|
||||
new Definition("342-0-24", "MA", "[sbr]-[znr]"),
|
||||
];
|
||||
|
||||
private readonly PcmService _pcmService;
|
||||
|
||||
public Rozb(PcmService pcmService)
|
||||
{
|
||||
_pcmService = pcmService;
|
||||
}
|
||||
|
||||
public Task<List<DecretsResult>> Process(IReadOnlyList<Dok> documents)
|
||||
{
|
||||
var result = new List<DecretsResult>();
|
||||
|
||||
var toProcess = documents
|
||||
.Where(x => x.TypDok == DocType);
|
||||
|
||||
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 = _pcmService.WzNrFaktury(dok.DokId);
|
||||
item.StronaKonta = d.AccountSide;
|
||||
item.KontoFk = d.Account;
|
||||
item.Kwota = Processvalue(dok, d.Expression)
|
||||
.AsString();
|
||||
|
||||
result.Add(item);
|
||||
});
|
||||
}
|
||||
|
||||
return Task.FromResult(result);
|
||||
}
|
||||
|
||||
private decimal Processvalue(Dok doc, string expression)
|
||||
{
|
||||
switch (expression)
|
||||
{
|
||||
case "[znr]":
|
||||
return Math.Abs(doc.Netto);
|
||||
case "[zvr]":
|
||||
return Math.Abs(doc.Podatek);
|
||||
case "[zbr]":
|
||||
return Math.Abs(doc.Netto + doc.Podatek);
|
||||
case "[sbr]":
|
||||
return Math.Abs(doc.Razem);
|
||||
case "[svr]":
|
||||
return Math.Abs(doc.Netto - doc.NettoDet);
|
||||
case "[sbr]-[snr]":
|
||||
return Math.Abs(doc.Razem - doc.Netto);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
75
FKGees/DocsDefinitions/Decrets/Zwroty.cs
Normal file
75
FKGees/DocsDefinitions/Decrets/Zwroty.cs
Normal file
@ -0,0 +1,75 @@
|
||||
using FKGees.Services;
|
||||
|
||||
namespace FKGees.DocsDefinitions.Decrets;
|
||||
|
||||
public class Zwroty : IDecretsDefinition
|
||||
{
|
||||
public int DocType => 4;
|
||||
public string Type => "Zwroty";
|
||||
public List<Definition> Definitions { get; } =
|
||||
[
|
||||
new Definition("301-0-24", "WN", "[znr]"),
|
||||
new Definition("221-0-24", "WN", "[zvr]"),
|
||||
new Definition("210-1", "MA", "[zbr]"),
|
||||
new Definition("301-0-24", "MA", "[zbr]"),
|
||||
new Definition("332-0-24", "WN", "[sbr]"),
|
||||
new Definition("343-0-24", "MA", "[svr]"),
|
||||
new Definition("342-0-24", "MA", "[sbr]-[znr]")
|
||||
];
|
||||
|
||||
private readonly PcmService _pcmService;
|
||||
|
||||
public Zwroty(PcmService pcmService)
|
||||
{
|
||||
_pcmService = pcmService;
|
||||
}
|
||||
|
||||
public Task<List<DecretsResult>> Process(IReadOnlyList<Dok> documents)
|
||||
{
|
||||
var result = new List<DecretsResult>();
|
||||
|
||||
var toProcess = documents
|
||||
.Where(x => x.TypDok == DocType);
|
||||
|
||||
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 = _pcmService.WzNrFaktury(dok.DokId);
|
||||
item.StronaKonta = d.AccountSide;
|
||||
item.KontoFk = d.Account;
|
||||
item.Kwota = Processvalue(dok, d.Expression)
|
||||
.AsString();
|
||||
|
||||
result.Add(item);
|
||||
});
|
||||
}
|
||||
|
||||
return Task.FromResult(result);
|
||||
}
|
||||
|
||||
private decimal Processvalue(Dok doc, string expression)
|
||||
{
|
||||
switch (expression)
|
||||
{
|
||||
case "[znr]":
|
||||
return Math.Abs(doc.Netto);
|
||||
case "[zvr]":
|
||||
return Math.Abs(doc.Podatek);
|
||||
case "[zbr]":
|
||||
return Math.Abs(doc.Netto + doc.Podatek);
|
||||
case "[sbr]":
|
||||
return Math.Abs(doc.Razem);
|
||||
case "[svr]":
|
||||
return Math.Abs(doc.Netto - doc.NettoDet);
|
||||
case "[sbr]-[snr]":
|
||||
return Math.Abs(doc.Razem - doc.Netto);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@ -31,6 +31,8 @@ internal static class ServiceCollectionExtensions
|
||||
services.AddSingleton<IDecretsDefinition, KpLotto>();
|
||||
services.AddSingleton<IDecretsDefinition, KpPaysafe>();
|
||||
services.AddSingleton<IDecretsDefinition, KpRachunki>();
|
||||
services.AddSingleton<IDecretsDefinition, Rozb>();
|
||||
services.AddSingleton<IDecretsDefinition, Zwroty>();
|
||||
return services;
|
||||
}
|
||||
|
||||
|
||||
@ -8,12 +8,12 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="CsvHelper" Version="32.0.3" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.6">
|
||||
<PackageReference Include="CsvHelper" Version="33.0.1" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.7">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.6" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.7" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0"/>
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0"/>
|
||||
<PackageReference Include="NLog" Version="5.3.2"/>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user