private void CargarConstantes() { var BE = new tb_pp_constantes(); var BL = new tb_pp_constantesBL(); var dt = new DataTable(); BE.perianio = DateTime.Today.Year.ToString(); dt = BL.GetAll(EmpresaID, BE).Tables[0]; if (dt.Rows.Count > 0) { gastoadm.Text = Math.Round(Convert.ToDecimal(dt.Rows[0]["percgadm"]), 2).ToString(); gastovta.Text = Math.Round(Convert.ToDecimal(dt.Rows[0]["percgvta"]), 2).ToString(); gastofin.Text = Math.Round(Convert.ToDecimal(dt.Rows[0]["percgfin"]), 2).ToString(); } else { gastoadm.Text = "0.00"; gastovta.Text = "0.00"; gastofin.Text = "0.00"; } }
private void Data_TablaConstantes() { try { if (cbo_perianio.SelectedIndex != -1) { if (TablaConstantes.Rows.Count > 0) TablaConstantes.Rows.Clear(); tb_pp_constantesBL BL = new tb_pp_constantesBL(); tb_pp_constantes BE = new tb_pp_constantes(); BE.perianio = cbo_perianio.SelectedValue.ToString(); TablaConstantes = BL.GetAll(EmpresaID, BE).Tables[0]; if (TablaConstantes.Rows.Count > 0) { btn_imprimir.Enabled = true; MDI_dgb_constantes.DataSource = TablaConstantes; } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }