Ejemplo n.º 1
0
        public void ConsultaDatosInsumos()

        {
            Clases.clsUtilidades ut = new Clases.clsUtilidades();
            ds = pd.ConsultasCombos("paConsultas", "1");

            if (TipoConsulta_ == "Insumos")
            {
                dgvMaestros.DataSource = ds.Tables[0];

                ut.FormatearGrid(dgvMaestros, "Precio", "C");
            }
            else if (TipoConsulta_ == "Clientes")
            {
                gbppal.Text                       = "Clientes";
                dgvMaestros.DataSource            = ds.Tables[1];
                dgvMaestros.Columns["Id"].Visible = false;
            }
            else if (TipoConsulta_ == "Compañias")
            {
                gbppal.Text            = "Compañias";
                dgvMaestros.DataSource = ds.Tables[2];
                dgvMaestros.Columns["IdCompañia"].Visible = false;
                dgvMaestros.Columns["Logo"].Visible       = false;
            }
            ut.AlinearContenidoColumna(dgvMaestros);
            dgvMaestros.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.DisplayedCells;
        }
Ejemplo n.º 2
0
        private void CargarCombos()
        {
            try
            {
                ds = pd.ConsultasCombos("paConsultas", "0");
                //string[] s = ds.Tables[1].Rows.OfType<DataRow>().Select(k => k[2].ToString()).ToArray();

                cbbResolucion.DataSource  = ds.Tables[0];
                cbbResolucion.ValueMember = "NumeroResolucion";
                this.cbbResolucion.AutoCompleteCustomSource.AddRange(ds.Tables[0].Rows.OfType <DataRow>().Select(k => k[0].ToString()).ToArray());
                this.cbbResolucion.AutoCompleteMode   = AutoCompleteMode.Suggest;
                this.cbbResolucion.AutoCompleteSource = AutoCompleteSource.CustomSource;



                //this.cbbCliente.AutoCompleteCustomSource.AddRange(ds.Tables[1].Rows.OfType<DataRow>().Select(k => k[2].ToString()).ToArray());
                //autocompleta combox
                //this.cbbCliente.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
                //this.cbbCliente.AutoCompleteSource = AutoCompleteSource.ListItems;
                //DataView dtv = new DataView(ds.Tables[1]);
                //dtv.Sort = "RazonSocial ASC";
                //DataTable dt = dtv.ToTable();
                cbbCliente.DataSource    = ds.Tables[1];
                cbbCliente.DisplayMember = "RazonSocial";
                cbbCliente.ValueMember   = "IdCliente";
                cbbCliente.Text          = "Seleccione un cliente";



                //listBox1.DataSource = dt;
                //listBox1.DisplayMember = "RazonSocial";
                //listBox1.ValueMember = "Nit";


                txtNumFac.Text                 = ds.Tables[2].Rows[0]["NumFac"].ToString();
                dgvInsumos.DataSource          = ds.Tables[3];
                dgvInsumos.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.DisplayedCells;
                //dgvInsumos.Columns["Precio"].DefaultCellStyle.FormatProvider= System.Globalization.CultureInfo.GetCultureInfo("en-us");
                //dgvInsumos.Columns["Precio"].DefaultCellStyle.Format =string.Format( "C");
                Utilidades.FormatearGrid(dgvInsumos, "Precio", "C");
                Utilidades.AlinearContenidoColumna(dgvInsumos);

                //DataGridViewComboBoxColumn cmb = new DataGridViewComboBoxColumn();
                //BindingSource bs1 = new BindingSource();
                //bs1.DataSource = ds.Tables[6];
                //cmb.DataPropertyName = "NombreUM";
                //cmb.HeaderText = "UnidadMedida";
                //cmb.Width = 120;
                //cmb.DataSource = bs1;
                //cmb.ValueMember = "NombreUM";
                //cmb.DisplayMember = "NombreUM";

                //dgvInsumos.Columns.Insert(2, cmb);
                dgvInsumosFacturar.DataSource = ds.Tables[4];


                cbbCompania.DataSource    = ds.Tables[5];
                cbbCompania.DisplayMember = "RazonSocial";
                cbbCompania.ValueMember   = "IdCompañia";

                cbbSede.DataSource = null;

                //dgvInsumosFacturar.Columns.Add("CodigoInsumo", "CodigoInsumo");
                //dgvInsumosFacturar.Columns.Add("Descripcion", "Descripcion");
                //dgvInsumosFacturar.Columns.Add("Iva", "Iva");
                //dgvInsumosFacturar.Columns.Add("Cantidad", "Cantidad");
                //dgvInsumosFacturar.Columns.Add("VlrUnitario", "VlrUnitario");
                //dgvInsumosFacturar.Columns.Add("VlrIva", "VlrIva");
                //dgvInsumosFacturar.Columns.Add("VlrBruto", "VlrBruto");
                //dgvInsumosFacturar.Columns.Add("VlrTotal", "VlrTotal");
                txtDescuento.Text   = "0";
                rtxComentarios.Text = "";
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }