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") diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb index d0bc9751f..950682e27 100644 --- a/Compras/Compras.aspx.vb +++ b/Compras/Compras.aspx.vb @@ -14243,11 +14243,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 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)