From 920d387c6ced18e0933b724e07e649326a716c93 Mon Sep 17 00:00:00 2001 From: Adriano Serighelli Date: Mon, 12 Jun 2023 17:41:54 -0300 Subject: [PATCH] =?UTF-8?q?Unidades=20da=20Light=20com=20ultrapassagem=20d?= =?UTF-8?q?e=20demanda=20n=C3=A3o=20estava=20sendo=20registrado=20corretam?= =?UTF-8?q?ente=20o=20valor=20faturado.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Download Faturas/Fatura.cs | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/Download Faturas/Fatura.cs b/Download Faturas/Fatura.cs index 90789e7..39e4c57 100644 --- a/Download Faturas/Fatura.cs +++ b/Download Faturas/Fatura.cs @@ -184,7 +184,7 @@ int j = 0; float? dem_Reg_P = null; float? dem_Reg_FP = null; - float? dem_Fat_P = null; + float? consumo_Reg_FP = null; List insertOthers = new List(); foreach (Item item in parsedResult.items) @@ -201,10 +201,15 @@ dadosTusd.Consumo_FP = item.billed / 1000; break; + // Energia Fora de Ponta + case ("energy", "off-peak inductive"): + dadosTusd.Consumo_FP = item.billed / 1000; + break; + // Demanda Ponta case ("demand", "peak"): dadosTusd.Dem_Cont_P = item.contract == 0 ? dadosTusd.Dem_Cont_P : item.contract; - dem_Fat_P = item.billed; + dadosTusd.Dem_Reg_P = item.billed; break; // Demanda Fora de Ponta @@ -262,20 +267,28 @@ case ("demand", "off-peak"): dem_Reg_FP = measuredItem.measured; break; + case ("energy", "off-peak"): + consumo_Reg_FP = measuredItem.measured; + break; } } - if (dem_Fat_P == null && dem_Reg_P != null && ((decimal)dadosTusd.Dem_Reg_FP == Math.Round((decimal)(dem_Reg_FP * 1.025)!, 2))) + if (dem_Reg_P != null && (Math.Round((decimal)dadosTusd.Consumo_FP, 2) == Math.Round((decimal)(consumo_Reg_FP * 1.025 / 1000) !, 2))) { dadosTusd.Dem_Reg_P = (float)(dem_Reg_P * 1.025); } - else if (dem_Fat_P != null) + else if (dem_Reg_P != null) { - dadosTusd.Dem_Reg_P = dem_Fat_P ?? 0; + dadosTusd.Dem_Reg_P = (float)dem_Reg_P; } - else + + if (dem_Reg_FP != null && (Math.Round((decimal)dadosTusd.Consumo_FP, 2) == Math.Round((decimal)(consumo_Reg_FP * 1.025 / 1000) !, 2))) { - dadosTusd.Dem_Reg_P = dem_Reg_P ?? 0; + dadosTusd.Dem_Reg_FP = (float)(dem_Reg_FP * 1.025); + } + else if (dem_Reg_FP != null) + { + dadosTusd.Dem_Reg_FP = dem_Reg_FP ?? 0; } var dados = dadosTusd.GetType().GetProperties();