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

View File

@ -26,7 +26,7 @@ public class PcmService
.ThenInclude(x => x.Dok)
.Include(x => x.DokKasa)
.ThenInclude(x => x.Kasa)
.Where(x => typdok.Contains(x.TypDok)
.Where(x => typdok.Contains(x.TypDok)
&& x.Data >= dataOd && x.Data <= dataDo
&& x.Aktywny == 1)
.ToListAsync();
@ -43,7 +43,7 @@ public class PcmService
.ThenInclude(x => x.Kontr)
.Include(x => x.TekstDok)
.Include(x => x.RozbicieDok)
.Where(x => typdok.Contains(x.TypDok)
.Where(x => typdok.Contains(x.TypDok)
&& x.Data >= dataOd && x.Data <= dataDo
&& x.Aktywny == 1)
.ToListAsync();
@ -75,16 +75,40 @@ public class PcmService
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()
{
await using var context = await _dbContextFactory.CreateDbContextAsync();
context.ChangeTracker.QueryTrackingBehavior = QueryTrackingBehavior.NoTracking;
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 = 1, Tekst = "Przelew"});
fplat.Add(new FormaPlatnosci{ FormaPlat = 2, Tekst = "Czek potwierdzony"});
fplat.Add(new FormaPlatnosci{ FormaPlat = 3, Tekst = "Karta płatnicza"});
fplat.Add(new FormaPlatnosci{ FormaPlat = 4, Tekst = "Inna"});
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 = 1, Tekst = "Przelew"});
fplat.Add(new FormaPlatnosci {FormaPlat = 2, Tekst = "Czek potwierdzony"});
fplat.Add(new FormaPlatnosci {FormaPlat = 3, Tekst = "Karta płatnicza"});
fplat.Add(new FormaPlatnosci {FormaPlat = 4, Tekst = "Inna"});
return fplat;
}
}