Public Function obtenerCodigoCajaApertura(xCriterio As String)
        Try
            Dim campo As Integer = 0

            conectado()
            cmd = New SqlCommand("[paAviPedidosConsultar]")
            cmd.CommandType = CommandType.StoredProcedure
            cmd.Connection = cnn

            With cmd
                .Parameters.AddWithValue("@xFlag", 16)
                .Parameters.AddWithValue("@xCriterio", xCriterio)
            End With

            Dim dr As SqlDataReader

            dr = cmd.ExecuteReader

            If dr.Read Then
                campo = CInt(dr.Item("Apertura"))
            End If

            Return campo

        Catch ex As Exception
            Return False
        Finally
            desconectado()
        End Try
    End Function