private void cmb_rubro_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (cmb_rubro.SelectedIndex >= 0)
     {
         var BL = new tb_pp_rubrocostoBL();
         var BE = new tb_pp_rubrocosto();
         var dt = new DataTable();
         BE.rubroid = cmb_rubro.SelectedValue.ToString();
         dt = BL.GetAll(EmpresaID, BE).Tables[0];
         if (dt.Rows.Count > 0)
         {
             cboModuloID.SelectedValue = dt.Rows[0]["moduloid"].ToString();
         }
         familiaid.Focus();
     }
 }
 private void get_cbo_rubro()
 {
     var BL = new tb_pp_rubrocostoBL();
     var BE = new tb_pp_rubrocosto();
     var dt = new DataTable();
     try
     {
         dt = BL.GetAll(EmpresaID, BE).Tables[0];
         cmb_rubro.DataSource = dt;
         cmb_rubro.ValueMember = "rubroid";
         cmb_rubro.DisplayMember = "rubroname";
         cmb_rubro.SelectedIndex = -1;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
        private void CargarFilasdeHojadeRubro()
        {
            if (TablaCostoRubro.Rows.Count > 0)
            {
                TablaCostoRubro.Rows.Clear();
                dgb_hojacostorubro.DataSource = TablaCostoRubro;
            }

            var BL = new tb_pp_rubrocostoBL();
            var BE = new tb_pp_rubrocosto();
            var dt = new DataTable();
            dt = BL.GetAll(EmpresaID, BE).Tables[0];

            var xxrubroname = string.Empty;
            foreach (DataRow fila in dt.Rows)
            {
                var xxrubroid = fila["rubroid"].ToString();
                var xxmoduloid = fila["moduloid"].ToString();
                Decimal AcumImporte = 0;
                var result = TablaprecioslistDet.Select("rubroid = '" + xxrubroid.ToString() + "' AND moduloid = '" + xxmoduloid.ToString() + "' ");

                foreach (DataRow list in result)
                {
                    AcumImporte = AcumImporte + Convert.ToDecimal(list["importe"]);
                    xxrubroname = list["rubroname"].ToString();
                }

                if (AcumImporte > 0)
                {
                    row = TablaCostoRubro.NewRow();
                    row["articid"] = articid.Text.ToString();
                    row["version"] = version.Text.ToString();
                    row["rubroid"] = fila["rubroid"].ToString();
                    row["rubroname"] = xxrubroname.ToString();
                    row["moduloid"] = cboModuloID.SelectedValue.ToString();
                    row["importe"] = AcumImporte.ToString();
                    row["usuar"] = VariablesPublicas.Usuar.ToString();
                    TablaCostoRubro.Rows.Add(row);
                }
            }

            dgb_hojacostorubro.DataSource = TablaCostoRubro;
            _CalculoGastosCostos();
        }
        private void Data_TablaConstantes()
        {
            try
            {
                if (cboModuloID.SelectedIndex != -1)
                {
                    if (TablaRubroCosto.Rows.Count > 0)
                    {
                        TablaRubroCosto.Rows.Clear();
                    }
                    var BL = new tb_pp_rubrocostoBL();
                    var BE = new tb_pp_rubrocosto();

                    BE.moduloid = cboModuloID.SelectedValue.ToString();

                    TablaRubroCosto = BL.GetAll(EmpresaID, BE).Tables[0];
                    if (TablaRubroCosto.Rows.Count > 0)
                    {
                        btn_imprimir.Enabled = true;
                        MDI_dgb_rubrocosto.DataSource = TablaRubroCosto;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }