Rozb Fixes

This commit is contained in:
Piotr Dudek 2024-09-23 15:06:47 +02:00
parent be4ff5c9ee
commit 16db72e6a3
2 changed files with 34 additions and 10 deletions

View File

@ -34,7 +34,7 @@ public class Rozb : IDecretsDefinition
foreach (var dok in toProcess) foreach (var dok in toProcess)
{ {
var opis = _pcmService.RozbNrFakturyKor(dok.DokId); var opis = _pcmService.RozbNrFakturyDost(dok.DokId);
Definitions.ForEach(d => Definitions.ForEach(d =>
{ {
var item = dok.DecretKontr(); var item = dok.DecretKontr();
@ -63,7 +63,7 @@ public class Rozb : IDecretsDefinition
"[zbr]" => (doc.Netto + doc.Podatek), "[zbr]" => (doc.Netto + doc.Podatek),
"[sbr]" => doc.NettoDet + doc.PodatekDet, "[sbr]" => doc.NettoDet + doc.PodatekDet,
"[svr]" => doc.PodatekDet, "[svr]" => doc.PodatekDet,
"[sbr]-[znr]" => doc.NettoDet + doc.PodatekDet - doc.Netto, "[sbr]-[znr]" => doc.NettoDet - doc.Netto,
_ => 0 _ => 0
}; };
} }

View File

@ -75,11 +75,35 @@ public class PcmService
return dok?.Dok.NrDok ?? string.Empty; return dok?.Dok.NrDok ?? string.Empty;
} }
public string RozbNrFakturyDost(decimal dokId)
{
using var context = _dbContextFactory.CreateDbContext();
context.ChangeTracker.QueryTrackingBehavior = QueryTrackingBehavior.NoTracking;
var dok = context.Rozlicza
.Where(x => x.RozliczanyDokId == dokId)
.Include(x => x.Dok)
.FirstOrDefault();
if (dok == null)
return string.Empty;
var dok2 = context.Rozlicza
.Where(x => x.DokId == dok.DokId)
.Include(x => x.RozliczanyDok)
.Include(rozlicza => rozlicza.Dok)
.ToList();
return dok2.FirstOrDefault(x => x.RozliczanyDok is {TypDok: 31, Aktywny: 1})
?.RozliczanyDok.NrDok ?? string.Empty;
}
public async Task<List<FormaPlatnosci>> FormyPlatnosci() public async Task<List<FormaPlatnosci>> FormyPlatnosci()
{ {
await using var context = await _dbContextFactory.CreateDbContextAsync(); await using var context = await _dbContextFactory.CreateDbContextAsync();
context.ChangeTracker.QueryTrackingBehavior = QueryTrackingBehavior.NoTracking; context.ChangeTracker.QueryTrackingBehavior = QueryTrackingBehavior.NoTracking;
var fplat = await context.FormaPlatnosci.Where(x => x.FormaPlat > 4).ToListAsync(); var fplat = await context.FormaPlatnosci.Where(x => x.FormaPlat > 4)
.ToListAsync();
fplat.Add(new FormaPlatnosci {FormaPlat = 0, Tekst = "Gotówka"}); fplat.Add(new FormaPlatnosci {FormaPlat = 0, Tekst = "Gotówka"});
fplat.Add(new FormaPlatnosci {FormaPlat = 1, Tekst = "Przelew"}); fplat.Add(new FormaPlatnosci {FormaPlat = 1, Tekst = "Przelew"});
fplat.Add(new FormaPlatnosci {FormaPlat = 2, Tekst = "Czek potwierdzony"}); fplat.Add(new FormaPlatnosci {FormaPlat = 2, Tekst = "Czek potwierdzony"});