Ejemplo n.º 1
0
        public DataTable listaLibroXFecha(DateTime mesAno, string estado, string fechaInicial, string fechaFinal)
        {
            DataTable datatable = new DataTable();

            empresaModel = empresaModel.getEmpresa();
            try
            {
                SQLiteConnection myConn = bd.ConnectSqlite();
                string           sql    = "select TipoDTE,Folio,FchEmis,RUTEmisor,RUTRecep,RznSoc,MntNeto,MntExe,IVA, MntTotal "
                                          + "FROM documento "
                                          + "where estado='" + estado + "'"
                                          // +"and FchEmis between '"+fechaInicial+"' and '"+fechaFinal+"'"
                                          + "and RUTEmisor <> '" + empresaModel.RutEmisor + "'"
                                          + "order by TipoDTE";
                SQLiteCommand    command = new SQLiteCommand(sql, myConn);
                SQLiteDataReader reader  = command.ExecuteReader();
                datatable.Load(reader);
            }
            catch (Exception ex)
            {
                datatable = null;
                throw new Exception("Error" + ex.Message);
            }
            return(datatable);
        }
Ejemplo n.º 2
0
        public void update(EmpresaModel empresaModel)
        {
            SqlConnection sqlcon = new SqlConnection();

            try
            {
                OdbcConnection conexion = con.ConnectPostgres();

                OdbcCommand select = new OdbcCommand();
                select.Connection  = conexion;
                select.CommandText =
                    "UPDATE empresa "
                    + "SET "
                    + "\"razonsocial\"='" + empresaModel.RazonSocial + "',"
                    + "\"giroemisor\"='" + empresaModel.GiroEmisor + "',"
                    + "\"codigosiisucursal\"=" + empresaModel.CodigoSiiSucursal + ","
                    + "\"telefonoemis\"='" + empresaModel.Telefono + "',"
                    + "\"correoemis\"='" + empresaModel.Correo + "',"
                    + "\"acteco\"=" + empresaModel.Acteco + ","
                    + "\"direccionorigen\"='" + empresaModel.DireccionOrigen + "',"
                    + "\"comunaorigen\"='" + empresaModel.ComunaOrigen + "',"
                    + "\"ciudadorigen\"='" + empresaModel.CiudadOrigen + "'"
                    + "WHERE \"rutempresa\" = '" + empresaModel.Rut + "';";
                OdbcDataReader reader = select.ExecuteReader();
            }
            catch (Exception ex)
            {
                throw new Exception("Error" + ex.Message);
            }

            finally
            {
                sqlcon.Close();
            }
        }
Ejemplo n.º 3
0
        public DataTable listaDocManualXFecha(DateTime mesAno)
        {
            DataTable datatable = new DataTable();

            empresaModel = empresaModel.getEmpresa();
            try
            {
                SQLiteConnection myConn  = bd.ConnectSqlite();
                string           sql     = "select TipoDTE,Folio,FchEmis,RUTEmisor,RUTRecep,RznSoc,MntNeto,MntExe,IVA,MntTotal FROM documento where estado='PREVIO' and RUTEmisor = '" + empresaModel.RutEmisor + "' and TipoDTE in (30,60) order by TipoDTE";
                SQLiteCommand    command = new SQLiteCommand(sql, myConn);
                SQLiteDataReader reader  = command.ExecuteReader();
                datatable.Load(reader);
            }
            catch (Exception ex)
            {
                datatable = null;
                throw new Exception("Error" + ex.Message);
            }
            return(datatable);
        }
Ejemplo n.º 4
0
        public EmpresaModel getEmpresa()
        {
            EmpresaModel empresa = new EmpresaModel();

            SQLiteConnection myConn = bd.ConnectSqlite();

            string           sql     = "select * from empresa";
            SQLiteCommand    command = new SQLiteCommand(sql, myConn);
            SQLiteDataReader reader  = command.ExecuteReader();

            while (reader.Read())
            {
                empresa.RutEmisor      = reader["RutEmisor"].ToString();
                empresa.RznSoc         = reader["RznSoc"].ToString();
                empresa.GiroEmis       = reader["GiroEmis"].ToString();
                empresa.Telefono       = reader["Telefono"].ToString();
                empresa.CorreoEmisor   = reader["CorreoEmisor"].ToString();
                empresa.Acteco         = reader["Acteco"].ToString();
                empresa.CdgSIISucur    = reader["CdgSIISucur"].ToString();
                empresa.DirMatriz      = reader["DirMatriz"].ToString();
                empresa.CiudadOrigen   = reader["CiudadOrigen"].ToString();
                empresa.CmnaOrigen     = reader["CmnaOrigen"].ToString();
                empresa.DirOrigen      = reader["DirOrigen"].ToString();
                empresa.SucurSII       = reader["SucurSII"].ToString();
                empresa.NomCertificado = reader["NomCertificado"].ToString();
                empresa.SucurEmisor    = reader["SucurEmisor"].ToString();
                empresa.FchResol       = reader["FchResol"].ToString();
                empresa.RutCertificado = reader["RutCertificado"].ToString();
                empresa.NumResol       = reader["NumResol"].ToString();
                empresa.CondEntrega    = reader["CondEntrega"].ToString();
                empresa.UrlCore        = reader["UrlCore"].ToString();
                empresa.PrnTwoCopy     = reader["PrnTwoCopy"].ToString();
                empresa.PrnMtoNeto     = reader["PrnMtoNeto"].ToString();
                empresa.PrnThermal     = reader["PrnThermal"].ToString();
            }
            myConn.Close();
            return(empresa);
        }