public DataSet GetAll2(string empresaid, tb_tributotasa BE)
 {
     using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid)))
     {
         using (SqlCommand cmd = new SqlCommand("gspTbTributotasa_SEARCH2", cnx))
         {
             DataSet ds = new DataSet();
             {
                 cmd.CommandType = CommandType.StoredProcedure;
                 cmd.Parameters.Add("@tributoid", SqlDbType.Char, 4).Value = BE.tributoid;
                 cmd.Parameters.Add("@tributofecha", SqlDbType.DateTime).Value = BE.tributofecha;
             }
             try
             {
                 cnx.Open();
                 using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                 {
                     da.Fill(ds);
                 }
                 return ds;
             }
             catch (Exception ex)
             {
                 throw new Exception(ex.Message);
             }
         }
     }
 }
 public bool Delete(string empresaid, tb_tributotasa BE)
 {
     using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid)))
     {
         using (SqlCommand cmd = new SqlCommand("gspTbTributotasa_DELETE", cnx))
         {
             {
                 cmd.CommandType = CommandType.StoredProcedure;
                 cmd.Parameters.Add("@tributoid", SqlDbType.Char, 4).Value = BE.tributoid;
                 cmd.Parameters.Add("@tributofecha", SqlDbType.DateTime).Value = BE.tributofecha;
             }
             try
             {
                 cnx.Open();
                 if (cmd.ExecuteNonQuery() > 0)
                 {
                     return true;
                 }
                 else
                 {
                     return false;
                 }
             }
             catch (Exception ex)
             {
                 throw new Exception(ex.Message);
             }
         }
     }
 }
        private Decimal TasaRretencion(DateTime xfecha)
        {
            DataTable ttributo = new DataTable();
            tributotasaBL BL = new tributotasaBL();
            tb_tributotasa BE = new tb_tributotasa();

            BE.tributoid = "1032";
            BE.tributofecha = Convert.ToDateTime(xfecha);
            //BE.tributofecha = Convert.ToDateTime(fEmision.Text);

            ttributo = BL.GetAll2(VariablesPublicas.EmpresaID.ToString(), BE).Tables[0];
            decimal xtasaigv = 0;
            if ((ttributo.Rows.Count > 0))
            {
                xtasaigv += Convert.ToDecimal(ttributo.Rows[0]["tributotasa"]);
                return xtasaigv;
            }
            else
            {
                return 0;
            }
        }
        private void tributoIgv()
        {
            DataTable ttributo = new DataTable();
            tributotasaBL BL = new tributotasaBL();
            tb_tributotasa BE = new tb_tributotasa();

            BE.tributoid = "1011";
            BE.tributofecha = Convert.ToDateTime(fRegistro.Text);

            ttributo = BL.GetAll2(VariablesPublicas.EmpresaID.ToString(), BE).Tables[0];
            decimal xtasaigv = 0;
            if ((ttributo.Rows.Count > 0))
            {
                xtasaigv += Convert.ToDecimal(ttributo.Rows[0]["tributotasa"]);
                //txtPigv.Text = ttributo.Rows[0]["tributotasa"].ToString();
                txtPigv.Text = xtasaigv.ToString("##.00");
            }
            else
            {
                txtPigv.Text = "";
            }
        }
 public bool Update(string empresaid, tb_tributotasa BE)
 {
     return tablaDA.Update(empresaid, BE);
 }
 public bool Insert(string empresaid, tb_tributotasa BE)
 {
     return tablaDA.Insert(empresaid, BE);
 }
 public DataSet GetAll2(string empresaid, tb_tributotasa BE)
 {
     return tablaDA.GetAll2(empresaid, BE);
 }
 public bool Delete(string empresaid, tb_tributotasa BE)
 {
     return tablaDA.Delete(empresaid, BE);
 }
        private Decimal TasaRretencion()
        {
            DataTable ttributo = new DataTable();
            string xfecha = null;
            //if (dpTasa.Checked)
            //{
            //    xfecha = Convert.ToDateTime(dpTasa.Text).ToString();
            //}
            //else
            //{
                xfecha = Convert.ToDateTime(fRegistro.Text).ToString();
            //}
            tributotasaBL BL = new tributotasaBL();
            tb_tributotasa BE = new tb_tributotasa();

            BE.tributoid = "1032";
            //BE.tributofecha = Convert.ToDateTime(fRegistro.Text);
            BE.tributofecha = Convert.ToDateTime(xfecha);
            ttributo = BL.GetAll2(VariablesPublicas.EmpresaID.ToString(), BE).Tables[0];
            decimal xtasaigv = 0;
            if (ttributo.Rows.Count > 0)
            {
                xtasaigv += Convert.ToDecimal(ttributo.Rows[0]["tributotasa"]);
                return xtasaigv;
            }
            else
            {
                return 0;
            }
        }