Skip to content

Commit 1376d20

Browse files
committed
feat: 636
Merged PR 199: Fatture a zero Report Related work items: #636
1 parent 006954b commit 1376d20

File tree

2 files changed

+22
-7
lines changed

2 files changed

+22
-7
lines changed

src/Infrastructure/PortaleFatture.BE.Infrastructure/Common/SEND/Fatture/Queries/Persistence/Builder/FattureQueryRicercaBuilder.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ [pfd].[FattureTestata] FT
6262
and FT.FkIdEnte = @IdEnte
6363
and FT.FkTipologiaFattura IN @TipologiaFattura
6464
and FT.FkIdEnte <> '4a4149af-172e-4950-9cc8-63ccc9a6d865' --esclusione pagopa
65+
and FT.TotaleFattura > 0
6566
ORDER BY FT.FkTipologiaFattura, FT.Progressivo
6667
FOR JSON PATH, INCLUDE_NULL_VALUES )";
6768

@@ -321,6 +322,7 @@ [pfd].[FattureTestata] FT
321322
and FT.MeseRiferimento = @MeseRiferimento
322323
[condition_tipologiafattura]
323324
and FT.FkIdEnte <> '4a4149af-172e-4950-9cc8-63ccc9a6d865' --esclusione pagopa
325+
and FT.TotaleFattura > 0
324326
ORDER BY FT.FkTipologiaFattura, FT.Progressivo
325327
FOR JSON PATH, INCLUDE_NULL_VALUES )";
326328

src/Presentation/PortaleFatture.BE.Api/Modules/SEND/Fatture/Extensions/FattureExtensions.cs

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,16 @@ public static FattureQueryRicercaByEnte Map(this FatturaRicercaEnteRequest req,
4040
Mese = req.Mese,
4141
TipologiaFattura = req.TipologiaFattura
4242
};
43-
}
43+
}
4444

4545
public static FatturaRiptristinoSAPCommandList Map2(this List<FatturaPipelineSapRequest> request, AuthenticationInfo authInfo, bool invio)
4646
{
4747
return new FatturaRiptristinoSAPCommandList(
4848
request.Select(x => new FatturaRiptristinoSAPCommand(authInfo, x.AnnoRiferimento!.Value, x.MeseRiferimento!.Value, x.TipologiaFattura)
49-
{
50-
Invio = invio
51-
})
52-
.ToList());
49+
{
50+
Invio = invio
51+
})
52+
.ToList());
5353
}
5454

5555
public static FatturaInvioSap Map(this FatturaPipelineSapRequest request)
@@ -176,7 +176,14 @@ public static byte[] ReportFattureAcconto(this List<IEnumerable<FattureAccontoEx
176176
{
177177
DataSet? dataSet = new();
178178
for (var i = 0; i < commesse.Count; i++)
179-
dataSet.Tables.Add(commesse[i]!.FillTableWithTotalsRel(0, $"Acconto {month}"));
179+
{
180+
var fattureNONzero = commesse[i].Where(x => x.TotaleFattura != 0);
181+
if (!fattureNONzero.IsNullNotAny())
182+
dataSet.Tables.Add(fattureNONzero!.FillTableWithTotalsRel(0, $"Acconto {month}"));
183+
var fatturezero = commesse[i].Where(x => x.TotaleFattura == 0);
184+
if (!fatturezero.IsNullNotAny())
185+
dataSet.Tables.Add(fatturezero!.FillTableWithTotalsRel(0, $"Acconto a zero {month}"));
186+
}
180187
using var memory = dataSet!.ToExcel();
181188
return memory.ToArray();
182189
}
@@ -189,7 +196,13 @@ public static byte[] ReportFattureRel(this List<IEnumerable<FattureRelExcelDto>>
189196
if (i == 0)
190197
dataSet.Tables.Add(fatture[i]!.FillTableWithTotalsRel(9, $"Regolari Esecuzioni {month}"));
191198
else if (i == 1)
192-
dataSet.Tables.Add(fatture[i]!.FillTableWithTotalsRel(9, $"Enti Fatturabili {month}"));
199+
{
200+
var fattureNONzero = fatture[i].Where(x => x.TotaleFatturaImponibile != 0);
201+
dataSet.Tables.Add(fattureNONzero!.FillTableWithTotalsRel(9, $"Enti Fatturabili {month}"));
202+
var fatturezero = fatture[i].Where(x => x.TotaleFatturaImponibile == 0);
203+
if (!fatturezero.IsNullNotAny())
204+
dataSet.Tables.Add(fatturezero!.FillTableWithTotalsRel(9, $"Enti Fatturabili a Zero {month}"));
205+
}
193206
else
194207
dataSet.Tables.Add(fatture[i]!.FillTableWithTotalsRel(9, $"Note di Credito {month}"));
195208
}

0 commit comments

Comments
 (0)