Carry forward valor unit in controle recebidos

This commit is contained in:
Eduardo Lopes 2026-01-28 15:20:54 -03:00
parent 70f916ba19
commit d4e42177ac
1 changed files with 10 additions and 0 deletions

View File

@ -1482,6 +1482,7 @@ namespace line_gestao_api.Controllers
var lastRow = ws.LastRowUsed()?.RowNumber() ?? firstRow;
var rowIndex = firstRow;
decimal? lastValorDaNf = null;
decimal? lastValorUnit = null;
while (rowIndex <= lastRow)
{
@ -1505,6 +1506,7 @@ namespace line_gestao_api.Controllers
&& GetColAny(map, "SERIAL") == 0;
lastValorDaNf = null;
lastValorUnit = null;
rowIndex++;
for (; rowIndex <= lastRow; rowIndex++)
@ -1525,6 +1527,14 @@ namespace line_gestao_api.Controllers
var conteudo = GetCellByHeaderAny(ws, rowIndex, map, "CONTEÚDO DA NF", "CONTEUDO DA NF");
var numeroLinha = NullIfEmptyDigits(GetCellByHeaderAny(ws, rowIndex, map, "NÚMERO DA LINHA", "NUMERO DA LINHA"));
var valorUnit = TryDecimal(GetCellByHeaderAny(ws, rowIndex, map, "VALOR UNIT.", "VALOR UNIT", "VALOR UNITÁRIO", "VALOR UNITARIO"));
if (valorUnit.HasValue)
{
lastValorUnit = valorUnit;
}
else
{
valorUnit = lastValorUnit;
}
var valorDaNf = TryDecimal(GetCellByHeaderAny(ws, rowIndex, map, "VALOR DA NF", "VALOR DA N F"));
if (valorDaNf.HasValue)
{