From 51924e3db169b09f9d7da88698d51a3c8248f18a Mon Sep 17 00:00:00 2001 From: rrene Date: Wed, 13 Jan 2021 19:17:42 -0700 Subject: [PATCH 1/3] -- ajuste a decimales. --- Inventarios/RecepcionAlmacen.aspx.vb | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/Inventarios/RecepcionAlmacen.aspx.vb b/Inventarios/RecepcionAlmacen.aspx.vb index e45b5635f..fc9a9f92b 100644 --- a/Inventarios/RecepcionAlmacen.aspx.vb +++ b/Inventarios/RecepcionAlmacen.aspx.vb @@ -2398,11 +2398,16 @@ Partial Class Inventarios_RecepcionAlmacen CostoIndirecto = DtInv.Rows(gvr.RowIndex)("CostoIndirecto").ToString.ToDecimal PUExtranjero = DtInv.Rows(gvr.RowIndex)("PUExtranjero").ToString.ToDecimal + ' por redondeo + If gvr.FCTextBox("TbCantidadF").Text.ToDouble = 1 Then PU = PU.RoundAD + 'SI FUE POR SERIE LOTE DtDetalle = DtDatosDetalle.FiltraParametros(String.Format("ConsecId = {0}", gvr.DataKey("Consec").ToEntero)) DtDetalleLote = DtDatosLoteDetalle.FiltraParametros(String.Format("ConsecId = {0}", gvr.DataKey("Consec").ToEntero)) If DtDetalle.Rows.Count > 0 Then Dim ContDt As Integer = 0 + ' por redondeo + If gvr.FCTextBox("TbCantidadF").Text.ToDouble = 1 Then PU = PU.RoundAD For Each Dr As DataRow In DtDetalle.Rows SumaTotal += PU + CostoIndirecto If RecibidaCompleta AndAlso Cont + 1 = GvInv.Rows.Count AndAlso ContDt + 1 = DtDetalle.Rows.Count AndAlso Math.Round((TotalCompraOC * If(TipoCambio > 1, TipoCambio, 1)), 2) <> SumaTotal Then @@ -2418,6 +2423,8 @@ Partial Class Inventarios_RecepcionAlmacen Next ElseIf DtDetalleLote.Rows.Count > 0 Then Dim ContDt As Integer = 0 + ' por redondeo + If gvr.FCTextBox("TbCantidadF").Text.ToDouble = 1 Then PU = PU.RoundAD For Each Dr As DataRow In DtDetalleLote.Rows SumaTotal += Dr("Cantidad").ToString.ToDecimal * (PU + CostoIndirecto) If RecibidaCompleta AndAlso Cont + 1 = GvInv.Rows.Count AndAlso ContDt + 1 = DtDetalleLote.Rows.Count AndAlso Math.Round((TotalCompraOC * If(TipoCambio > 1, TipoCambio, 1)), 2) <> SumaTotal Then @@ -2433,6 +2440,9 @@ Partial Class Inventarios_RecepcionAlmacen ContDt += 1 Next Else + ' por redondeo + If gvr.FCTextBox("TbCantidadF").Text.ToDouble = 1 Then PU = PU.RoundAD + SumaTotal += gvr.FCTextBox("TbCantidadF").Text.ToDecimal * (PU + CostoIndirecto) ' considerar el costo indirecto para el ajuste If RecibidaCompleta AndAlso Cont + 1 = GvInv.Rows.Count AndAlso Math.Round((TotalCompraOC * If(TipoCambio > 1, TipoCambio, 1)), 2) <> Math.Round(SumaTotal, 2) Then Dim tTotal As Decimal = gvr.FCTextBox("TbCantidadF").Text.ToDecimal * (PU) @@ -2497,8 +2507,10 @@ Partial Class Inventarios_RecepcionAlmacen DtDetalleLote = DtDatosLoteDetalle.FiltraParametros(String.Format("ConsecId = {0}", gvr.DataKey("Consec").ToEntero)) If DtDetalle.Rows.Count > 0 Then Dim ContDt As Integer = 0 + ' por redondeo + PU = PU.RoundAD For Each Dr As DataRow In DtDetalle.Rows - SumaTotal += PU + CostoIndirecto + SumaTotal += PU.RoundAD + CostoIndirecto ' se redondea a dos decimales. por la unidad es uno If RecibidaCompleta AndAlso Cont + 1 = GvInv.Rows.Count AndAlso ContDt + 1 = DtDetalle.Rows.Count AndAlso Math.Round((TotalCompraOC * If(TipoCambio > 1, TipoCambio, 1)), 2) <> SumaTotal Then If Not UsuarioActual.Empresa.Funcionalidad(531) = "1" Then PU = Math.Round((TotalCompraOC * If(TipoCambio > 1, TipoCambio, 1)), 2).ToDecimal - (SumaTotal - (PU)) @@ -2512,6 +2524,8 @@ Partial Class Inventarios_RecepcionAlmacen Next ElseIf DtDetalleLote.Rows.Count > 0 Then Dim ContDt As Integer = 0 + ' por redondeo + If gvr.FCTextBox("TbCantidadF").Text.ToDouble = 1 Then PU = PU.RoundAD For Each Dr As DataRow In DtDetalleLote.Rows SumaTotal += Dr("Cantidad").ToString.ToDecimal * (PU + CostoIndirecto) If RecibidaCompleta AndAlso Cont + 1 = GvInv.Rows.Count AndAlso ContDt + 1 = DtDetalleLote.Rows.Count AndAlso Math.Round((TotalCompraOC * If(TipoCambio > 1, TipoCambio, 1)), 2) <> SumaTotal Then @@ -2527,6 +2541,8 @@ Partial Class Inventarios_RecepcionAlmacen ContDt += 1 Next Else + ' por redondeo + If gvr.FCTextBox("TbCantidadF").Text.ToDouble = 1 Then PU = PU.RoundAD SumaTotal += gvr.FCTextBox("TbCantidadF").Text.ToDecimal * (PU + CostoIndirecto) ' considerar el costo indirecto para el ajuste If RecibidaCompleta AndAlso Cont + 1 = GvInv.Rows.Count AndAlso Math.Round((TotalCompraOC * If(TipoCambio > 1, TipoCambio, 1)), 2) <> Math.Round(SumaTotal, 2) Then Dim tTotal As Decimal = gvr.FCTextBox("TbCantidadF").Text.ToDecimal * (PU) @@ -2563,7 +2579,7 @@ Partial Class Inventarios_RecepcionAlmacen If CveTipoCompra = 8 Then 'entrada almacen con costo indirecto cargado en la misma compra tTotalInsertado = dtt.SUMD("Total") ' está incluido el costo indirecto en la factura End If - If Math.Round(TotalCompraOC * If(TipoCambio > 1, TipoCambio, 1), 2) <> Math.Round(tTotalInsertado, 2) Then + If (TotalCompraOC * If(TipoCambio > 1, TipoCambio, 1)).RoundAD <> tTotalInsertado.RoundAD Then ErrorMovInv = True Alert("La Entrada no coincide con el valor del documento." & Math.Round(TotalCompraOC * If(TipoCambio > 1, TipoCambio, 1), 2) & " -" & tTotalInsertado, TipoMensaje.MsgError) GuardaLog("La Entrada no coincide con el valor del documento." & Math.Round(TotalCompraOC * If(TipoCambio > 1, TipoCambio, 1), 2) & " -" & tTotalInsertado) From e525416915d3c9568d71eeb8bdec0f85daaccd90 Mon Sep 17 00:00:00 2001 From: rrene Date: Thu, 14 Jan 2021 14:34:05 -0700 Subject: [PATCH 2/3] -- que se registre bitacora, en el prerender, solo al iniciar la pagina --- App_Code/ClsPaginas.vb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index b05a5614f..df2523887 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -5287,9 +5287,12 @@ Public Class ClsPaginas If sw IsNot Nothing AndAlso Not (Not User.Identity.IsAuthenticated OrElse UsuarioActual Is Nothing) Then sw.Stop() - Using ObjUsuario As New ClsSisUsuarios - ObjUsuario.AddBitacora(CveModulo, "", "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, Request.Url.PathAndQuery.ToString(), sw.ElapsedMilliseconds) - End Using + If Not Page.IsPostBack Then + Using ObjUsuario As New ClsSisUsuarios + ObjUsuario.AddBitacora(CveModulo, "", "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, Request.Url.PathAndQuery.ToString(), sw.ElapsedMilliseconds) + End Using + End If + End If If Not IsNothing(ViewState("strToastMsglargonoreplace")) AndAlso ViewState("strToastMsglargonoreplace").ToString.Length > 0 Then RegistraScript(ViewState("strToastMsglargonoreplace").ToString(), "esteseraunticklargoparaquenosesobrescribaconotro") From 1b36ab50694b49ccbdd721d6731a3ad925a69f2e Mon Sep 17 00:00:00 2001 From: rrene Date: Thu, 14 Jan 2021 17:44:07 -0700 Subject: [PATCH 3/3] cambio en redondeo de devoluciones --- Compras/Compras.aspx.vb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb index e4e1be772..f17967ba5 100644 --- a/Compras/Compras.aspx.vb +++ b/Compras/Compras.aspx.vb @@ -14235,11 +14235,20 @@ Partial Class Compras_Compras Else Dim Acumulado As Decimal = 0 Dim PU As Decimal = 0 + Dim CantidadRenglones As Integer = 0 + Dim ii As Integer = 0 + For Each Dr As GridViewRow In GVDevolucion.Rows + If Dr.FCTextBox("TxtCantidad").Text.ToDouble > 0 Then + CantidadRenglones += 1 + End If + Next + For Each Dr As GridViewRow In GVDevolucion.Rows If Dr.FCTextBox("TxtCantidad").Text.ToDouble > 0 Then Acumulado += (Dr.FCTextBox("TxtCantidad").Text.ToDecimal * Dr.DataKey("PU").ToString.ToDecimal) PU = Dr.DataKey("PU").ToString.ToDecimal - If subtotal < Acumulado Then + ii += 1 + If CantidadRenglones = ii Then Dim dif As Decimal = subtotal - Acumulado PU = (((Dr.FCTextBox("TxtCantidad").Text.ToDecimal * Dr.DataKey("PU").ToString.ToDecimal)) + dif) / Dr.FCTextBox("TxtCantidad").Text.ToDecimal End If