Imports System.Data.SqlClient

Public Class ConParametros
    Private funcion As New Funcion.Funcion
    Private ser As BD.ABD
    Private sqlc As SqlConnection
    Private cmd As SqlCommand
    Private myTrans As SqlTransaction
    Private sql As String

    Private dtCodigo As DataTable
    Private dtDescripcion As DataTable
    Private dr As SqlDataReader
    Private da As SqlDataAdapter

    Public Sub New()
        ser = New BD.ABD

        cmd = New SqlCommand

        sqlc = New SqlConnection
    End Sub

    Public Function BuscarParametro(ByVal Codigo_Empresa As Long) As SqlDataReader
        ser.Abrir(sqlc)

        sql = ""
        sql = " SELECT CODCONPARAMETRO, CUENTAIVADEBE, CUENTAIVAHABER, ISNULL(CUENTACOMPRA,0) AS CUENTACOMPRA, ISNULL(CUENTAVENTA,0) AS CUENTAVENTA, CUENTARESULTADO, FIN, PERIODOMES,  " & _
        "CUENTAREVALUO, CUENTADEPRECIACION, CUENTADEPREACUMULADA, ISNULL(CUENTATEMPORAL1,0) AS CUENTATEMPORAL1, ISNULL(CUENTATEMPORAL2,0) AS CUENTATEMPORAL2, ISNULL(CUENTATEMPORAL3,0) AS CUENTATEMPORAL3,  " & _
        "ISNULL(CUENTATEMPORAL4,0) AS CUENTATEMPORAL4, FORMULARIONRO, NROORDEN2, CODUSUARIO, CODEMPRESA, CODSUCURSAL, CODMODELO, RTRIM(ISNULL(NOMEMPRESA,  " & _
        "'')) AS NOMEMPRESA, RTRIM(ISNULL(NOMCONTADOR, '')) AS NOMCONTADOR, RTRIM(ISNULL(RUCREPRESENTANTE, '')) AS RUCREPRESENTANTE,  " & _
        "RTRIM(ISNULL(RUCCONTRIBUYENTE, '')) AS RUCCONTRIBUYENTE, RTRIM(ISNULL(RUCCONTADOR, '')) AS RUCCONTADOR, INICIO, MES, FECGRA,  " & _
        "ULTIMOASIENTO " & _
        "FROM CONPARAMETRO WHERE CODEMPRESA = " & Codigo_Empresa & ""

        Try
            cmd.Connection = sqlc
            cmd.CommandText = sql

            dr = cmd.ExecuteReader()

            Return dr
        Catch

        Finally

        End Try
    End Function
End Class