public DataTable GetGeneraAsientoRetencionesIGV_Consulta(string empresaid, tb_co_retencionCAb BE)
 {
     DataTable xreturn = null;
     xreturn = tablaDA.GetGeneraAsientoRetencionesIGV_Consulta(empresaid, BE);
     Sql_Error = tablaDA.Sql_Error;
     return xreturn;
 }
 public DataSet GetAsientoNume(string empresaid, tb_co_retencionCAb BE)
 {
     //return tablaDA.GetAsientoNume(empresaid, BE);
     DataSet xreturn = null;
     xreturn = tablaDA.GetAsientoNume(empresaid, BE);
     Sql_Error = tablaDA.Sql_Error;
     return xreturn;
 }
 public DataSet FormatoRegistroRegistroRetencion(string empresaid, tb_co_retencionCAb BE)
 {
     //return tablaDA.FormatoRegistroRegistroRetencion(empresaid, BE);
     DataSet xreturn = null;
     xreturn = tablaDA.FormatoRegistroRegistroRetencion(empresaid, BE);
     Sql_Error = tablaDA.Sql_Error;
     return xreturn;
 }
 public DataSet GetMaxNumComprobRetencion(string empresaid, tb_co_retencionCAb BE)
 {
     using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid)))
     {
         using (SqlCommand cmd = new SqlCommand("gspTbCoRetencionCAb_MaxNumComprobRetencion", cnx))
         {
             DataSet ds = new DataSet();
             {
                 cmd.CommandTimeout = 0;
                 cmd.CommandType = CommandType.StoredProcedure;
                 cmd.Parameters.Add("@serdoc", SqlDbType.Char, 4).Value = BE.serdoc;
                 cmd.Parameters.Add("@generar_ultimo", SqlDbType.Bit).Value = true;
             }
             try
             {
                 cnx.Open();
                 using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                 {
                     da.Fill(ds);
                 }
                 return ds;
             }
             catch (Exception ex)
             {
                 Sql_Error = ex.Message;
                 throw new Exception(ex.Message);
             }
         }
     }
 }
 public DataSet GetGenerarRetencionesCompras(string empresaid, tb_co_retencionCAb BE)
 {
     using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid)))
     {
         using (SqlCommand cmd = new SqlCommand("gspTbCoRetencion_GenerarRetencionesCompras", cnx))
         {
             DataSet ds = new DataSet();
             {
                 cmd.CommandTimeout = 0;
                 cmd.CommandType = CommandType.StoredProcedure;
                 cmd.Parameters.AddWithValue("@perianio", string.IsNullOrEmpty(BE.perianio) ? (object)DBNull.Value : BE.perianio);
                 cmd.Parameters.AddWithValue("@nmruc", string.IsNullOrEmpty(BE.nmruc) ? (object)DBNull.Value : BE.nmruc);
                 cmd.Parameters.AddWithValue("@fechaini", SqlDbType.DateTime).Value = BE.fechaini;
                 cmd.Parameters.AddWithValue("@fechafin", SqlDbType.DateTime).Value = BE.fechafin;
                 cmd.Parameters.AddWithValue("@porcretencion", SqlDbType.Decimal).Value = BE.porcretencion;
                 cmd.Parameters.AddWithValue("@tipdoc", string.IsNullOrEmpty(BE.tipdoc) ? (object)DBNull.Value : BE.tipdoc);
                 cmd.Parameters.AddWithValue("@serdoc", string.IsNullOrEmpty(BE.serdoc) ? (object)DBNull.Value : BE.serdoc);
                 cmd.Parameters.AddWithValue("@numdoc", string.IsNullOrEmpty(BE.numdoc) ? (object)DBNull.Value : BE.numdoc);
                 cmd.Parameters.AddWithValue("@tipcamb", SqlDbType.Decimal).Value = BE.tipcamb;
             }
             try
             {
                 cnx.Open();
                 using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                 {
                     da.Fill(ds);
                 }
                 return ds;
             }
             catch (Exception ex)
             {
                 Sql_Error = ex.Message;
                 throw new Exception(ex.Message);
             }
         }
     }
 }
 public bool GetGeneraAsientoRetencionesIGV_Update(string empresaid, tb_co_retencionCAb BE)
 {
     using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid)))
     {
         using (SqlCommand cmd = new SqlCommand("gspTbCoRetencion_GeneraAsientoRetencionIGV", cnx))
         {
             cmd.CommandTimeout = 0;
             cmd.CommandType = CommandType.StoredProcedure;
             cmd.Parameters.AddWithValue("@perianio", string.IsNullOrEmpty(BE.perianio) ? (object)DBNull.Value : BE.perianio);
             cmd.Parameters.AddWithValue("@perimes", string.IsNullOrEmpty(BE.perimes) ? (object)DBNull.Value : BE.perimes);
             cmd.Parameters.AddWithValue("@asientoini", string.IsNullOrEmpty(BE.asientoini) ? (object)DBNull.Value : BE.asientoini);
             cmd.Parameters.AddWithValue("@asientofin", string.IsNullOrEmpty(BE.asientofin) ? (object)DBNull.Value : BE.asientofin);
             cmd.Parameters.AddWithValue("@fechaini", SqlDbType.DateTime).Value = BE.fechaini;
             cmd.Parameters.AddWithValue("@fechafin", SqlDbType.DateTime).Value = BE.fechafin;
             cmd.Parameters.AddWithValue("@usuar", string.IsNullOrEmpty(BE.usuar) ? (object)DBNull.Value : BE.usuar);
             //cmd.Parameters.AddWithValue("@moduloid", string.IsNullOrEmpty(BE.moduloid) ? (object)DBNull.Value : BE.moduloid);
             //cmd.Parameters.AddWithValue("@local", string.IsNullOrEmpty(BE.local) ? (object)DBNull.Value : BE.local);
             //cmd.Parameters.AddWithValue("@diarioid", string.IsNullOrEmpty(BE.diarioid) ? (object)DBNull.Value : BE.diarioid);
             //cmd.Parameters.AddWithValue("@asiento", string.IsNullOrEmpty(BE.asiento) ? (object)DBNull.Value : BE.asiento);
             cmd.Parameters.AddWithValue("@TipOperacion", SqlDbType.Int).Value = BE.TipOperacion;
             try
             {
                 cnx.Open();
                 if (cmd.ExecuteNonQuery() > 0)
                 {
                     return true;
                 }
                 else
                 {
                     return false;
                 }
             }
             catch (Exception ex)
             {
                 Sql_Error = ex.Message;
                 throw new Exception(ex.Message);
             }
         }
     }
 }
 public DataTable GetGeneraAsientoRetencionesIGV_Consulta(string empresaid, tb_co_retencionCAb BE)
 {
     DataTable DT = new DataTable();
     int lcont = 0;
     using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid)))
     {
         using (SqlCommand cmd = new SqlCommand("gspTbCoRetencion_GeneraAsientoRetencionIGV", cnx))
         {
             cmd.CommandTimeout = 0;
             cmd.CommandType = CommandType.StoredProcedure;
             cmd.Parameters.AddWithValue("@perianio", string.IsNullOrEmpty(BE.perianio) ? (object)DBNull.Value : BE.perianio);
             cmd.Parameters.AddWithValue("@perimes", string.IsNullOrEmpty(BE.perimes) ? (object)DBNull.Value : BE.perimes);
             cmd.Parameters.AddWithValue("@asientoini", string.IsNullOrEmpty(BE.asientoini) ? (object)DBNull.Value : BE.asientoini);
             cmd.Parameters.AddWithValue("@asientofin", string.IsNullOrEmpty(BE.asientofin) ? (object)DBNull.Value : BE.asientofin);
             cmd.Parameters.AddWithValue("@fechaini", SqlDbType.DateTime).Value = BE.fechaini;
             cmd.Parameters.AddWithValue("@fechafin", SqlDbType.DateTime).Value = BE.fechafin;
             cmd.Parameters.AddWithValue("@usuar", string.IsNullOrEmpty(BE.usuar) ? (object)DBNull.Value : BE.usuar);
             //cmd.Parameters.AddWithValue("@moduloid", string.IsNullOrEmpty(BE.moduloid) ? (object)DBNull.Value : BE.moduloid);
             //cmd.Parameters.AddWithValue("@local", string.IsNullOrEmpty(BE.local) ? (object)DBNull.Value : BE.local);
             //cmd.Parameters.AddWithValue("@diarioid", string.IsNullOrEmpty(BE.diarioid) ? (object)DBNull.Value : BE.diarioid);
             //cmd.Parameters.AddWithValue("@asiento", string.IsNullOrEmpty(BE.asiento) ? (object)DBNull.Value : BE.asiento);
             cmd.Parameters.AddWithValue("@TipOperacion", SqlDbType.Int).Value = BE.TipOperacion;
             try
             {
                 cnx.Open();
                 using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                 {
                     da.Fill(DT);
                     for (lcont = 0; lcont <= DT.Columns.Count - 1; lcont++)
                     {
                         DT.Columns[lcont].ReadOnly = false;
                     }
                 }
             }
             catch (Exception ex)
             {
                 Sql_Error = ex.Message;
             }
             cnx.Close();
         }
     }
     return DT;
 }
 public DataSet GetAsientoRoleo(string empresaid, tb_co_retencionCAb BE)
 {
     using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid)))
     {
         using (SqlCommand cmd = new SqlCommand("gspTbCoRetencionCAb_SEARCH_roleo", cnx))
         {
             DataSet ds = new DataSet();
             {
                 cmd.CommandTimeout = 0;
                 cmd.CommandType = CommandType.StoredProcedure;
                 cmd.Parameters.Add("@perianio", SqlDbType.Char, 4).Value = BE.perianio;
                 cmd.Parameters.Add("@perimes", SqlDbType.Char, 2).Value = BE.perimes;
                 cmd.Parameters.Add("@moduloid", SqlDbType.Char, 4).Value = BE.moduloid;
                 cmd.Parameters.Add("@local", SqlDbType.Char, 3).Value = BE.local;
                 cmd.Parameters.Add("@diarioid", SqlDbType.Char, 4).Value = BE.diarioid;
                 cmd.Parameters.Add("@asiento", SqlDbType.Char, 6).Value = BE.asiento;
                 cmd.Parameters.Add("@tipo", SqlDbType.Char, 10).Value = BE.tipo;
             }
             try
             {
                 cnx.Open();
                 using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                 {
                     da.Fill(ds);
                 }
                 return ds;
             }
             catch (Exception ex)
             {
                 Sql_Error = ex.Message;
                 throw new Exception(ex.Message);
             }
         }
     }
 }
 public DataSet GetAll(string empresaid, tb_co_retencionCAb BE)
 {
     using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid)))
     {
         using (SqlCommand cmd = new SqlCommand("gspTbCoRetencionCAb_consulta", cnx))
         {
             DataSet ds = new DataSet();
             {
                 cmd.CommandTimeout = 0;
                 cmd.CommandType = CommandType.StoredProcedure;
                 cmd.Parameters.Add("@perianio", SqlDbType.Char, 4).Value = BE.perianio;
                 cmd.Parameters.Add("@perimes", SqlDbType.Char, 2).Value = BE.perimes;
                 cmd.Parameters.Add("@moduloid", SqlDbType.Char, 4).Value = BE.moduloid;
                 cmd.Parameters.Add("@local", SqlDbType.Char, 3).Value = BE.local;
                 cmd.Parameters.Add("@diarioid", SqlDbType.Char, 4).Value = BE.diarioid;
                 cmd.Parameters.Add("@asiento", SqlDbType.Char, 6).Value = BE.asiento;
                 //cmd.Parameters.AddWithValue("@ctacte", string.IsNullOrEmpty(BE.ctacte) ? (object)DBNull.Value : BE.ctacte);
                 cmd.Parameters.AddWithValue("@nmruc", string.IsNullOrEmpty(BE.nmruc) ? (object)DBNull.Value : BE.nmruc);
                 //cmd.Parameters.AddWithValue("@ctactename", string.IsNullOrEmpty(BE.ctactename) ? (object)DBNull.Value : BE.ctactename);
                 cmd.Parameters.AddWithValue("@tipdoc", string.IsNullOrEmpty(BE.tipdoc) ? (object)DBNull.Value : BE.tipdoc);
                 cmd.Parameters.AddWithValue("@serdoc", string.IsNullOrEmpty(BE.serdoc) ? (object)DBNull.Value : BE.serdoc);
                 cmd.Parameters.AddWithValue("@numdoc", string.IsNullOrEmpty(BE.numdoc) ? (object)DBNull.Value : BE.numdoc);
                 //cmd.Parameters.AddWithValue("@fechregistro", SqlDbType.DateTime).Value = BE.fechregistro;
                 //cmd.Parameters.AddWithValue("@fechdoc", SqlDbType.DateTime).Value = BE.fechdoc;
                 cmd.Parameters.AddWithValue("@fechaini", SqlDbType.DateTime).Value = BE.fechaini;
                 cmd.Parameters.AddWithValue("@fechafin", SqlDbType.DateTime).Value = BE.fechafin;
                 //cmd.Parameters.AddWithValue("@moneda", string.IsNullOrEmpty(BE.moneda) ? (object)DBNull.Value : BE.moneda);
                 //cmd.Parameters.AddWithValue("@tipcamb", SqlDbType.Decimal).Value = BE.tipcamb;
                 //cmd.Parameters.AddWithValue("@glosa", string.IsNullOrEmpty(BE.glosa) ? (object)DBNull.Value : BE.glosa);
                 //cmd.Parameters.AddWithValue("@montopago1", SqlDbType.Decimal).Value = BE.montopago1;
                 //cmd.Parameters.AddWithValue("@impretencion1", SqlDbType.Decimal).Value = BE.impretencion1;
                 //cmd.Parameters.AddWithValue("@montopago2", SqlDbType.Decimal).Value = BE.montopago2;
                 //cmd.Parameters.AddWithValue("@impretencion2", SqlDbType.Decimal).Value = BE.montopago1;
                 //cmd.Parameters.AddWithValue("@porcretencion", SqlDbType.Decimal).Value = BE.porcretencion;
                 //cmd.Parameters.Add("@status", SqlDbType.Char, 1).Value = BE.status;
                 //cmd.Parameters.AddWithValue("@usuar", string.IsNullOrEmpty(BE.usuar) ? (object)DBNull.Value : BE.usuar);
             }
             try
             {
                 cnx.Open();
                 using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                 {
                     da.Fill(ds);
                 }
                 return ds;
             }
             catch (Exception ex)
             {
                 Sql_Error = ex.Message;
                 throw new Exception(ex.Message);
             }
         }
     }
 }
 public DataSet FormatoRegistroRegistroRetencion(string empresaid, tb_co_retencionCAb BE)
 {
     using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid)))
     {
         using (SqlCommand cmd = new SqlCommand("gspTbCoRetencion_FormatoRetencionImpr", cnx))
         {
             DataSet ds = new DataSet();
             {
                 cmd.CommandTimeout = 0;
                 cmd.CommandType = CommandType.StoredProcedure;
                 cmd.Parameters.AddWithValue("@perianio", string.IsNullOrEmpty(BE.perianio) ? (object)DBNull.Value : BE.perianio);
                 cmd.Parameters.AddWithValue("@perimes", string.IsNullOrEmpty(BE.perimes) ? (object)DBNull.Value : BE.perimes);
                 cmd.Parameters.AddWithValue("@moduloid", string.IsNullOrEmpty(BE.moduloid) ? (object)DBNull.Value : BE.moduloid);
                 cmd.Parameters.AddWithValue("@local", string.IsNullOrEmpty(BE.local) ? (object)DBNull.Value : BE.local);
                 cmd.Parameters.AddWithValue("@diarioid", string.IsNullOrEmpty(BE.diarioid) ? (object)DBNull.Value : BE.diarioid);
                 cmd.Parameters.AddWithValue("@asiento", string.IsNullOrEmpty(BE.asiento) ? (object)DBNull.Value : BE.asiento);
                 cmd.Parameters.AddWithValue("@fechaini", SqlDbType.DateTime).Value = BE.fechaini;
                 cmd.Parameters.AddWithValue("@fechafin", SqlDbType.DateTime).Value = BE.fechafin;
                 cmd.Parameters.AddWithValue("@tipdoc", string.IsNullOrEmpty(BE.tipdoc) ? (object)DBNull.Value : BE.tipdoc);
                 cmd.Parameters.AddWithValue("@serdoc", string.IsNullOrEmpty(BE.serdoc) ? (object)DBNull.Value : BE.serdoc);
                 cmd.Parameters.AddWithValue("@numdoc", string.IsNullOrEmpty(BE.numdoc) ? (object)DBNull.Value : BE.numdoc);
             }
             try
             {
                 cnx.Open();
                 using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                 {
                     da.Fill(ds);
                 }
                 return ds;
             }
             catch (Exception ex)
             {
                 Sql_Error = ex.Message;
                 throw new Exception(ex.Message);
             }
         }
     }
 }
 public DataSet GetMaxNumComprobRetencion(string empresaid, tb_co_retencionCAb BE)
 {
     //return tablaDA.GetMaxNumComprobRetencion(empresaid, BE);
     DataSet xreturn = null;
     xreturn = tablaDA.GetMaxNumComprobRetencion(empresaid, BE);
     Sql_Error = tablaDA.Sql_Error;
     return xreturn;
 }
 public DataSet GetGenerarRetencionesCompras(string empresaid, tb_co_retencionCAb BE)
 {
     //return tablaDA.GetGenerarRetencionesCompras(empresaid, BE);
     DataSet xreturn = null;
     xreturn = tablaDA.GetGenerarRetencionesCompras(empresaid, BE);
     Sql_Error = tablaDA.Sql_Error;
     return xreturn;
 }
 public bool GetGeneraAsientoRetencionesIGV_Update(string empresaid, tb_co_retencionCAb BE)
 {
     bool zreturn = tablaDA.GetGeneraAsientoRetencionesIGV_Update(empresaid, BE);
     Sql_Error = tablaDA.Sql_Error;
     return zreturn;
 }
 public DataSet GetAsientoRoleo(string empresaid, tb_co_retencionCAb BE)
 {
     return tablaDA.GetAsientoRoleo(empresaid, BE);
 }