private void Impresion_Automatica_Load(object sender, EventArgs e) { //Form1 parent = (Form1)this.Owner; //Deberia crear una tabla que relacione Nro de practica y subpractica, con un una lista de cantidad de tubos necesarios, //Como del tipo de tubo, si este tubo o tubos se pueden mezclar o si son tubos separados, ejemplo //Hemograma 1 tubo EDTA (Se puede juntar) //Electroforesis de hg 4 tubos EDTA (No se pueden juntar) //Hematocrito 1 tubo EDTA (Se puede juntar) //Glucosa 1 tubo suero (Se puede juntar) //Glocusa Curva 4 tubos (El primero se puede juntar pero los otros 3 NO) pacientes paciente = new pacientes(); lbl_PacienteOculto.Text = parent.lbl_PacienteOculto.Text; lbl_Numero.Text = parent.lbl_CodigoBarra.Text; lbl_cama.Text = parent.cbo_Cama.Text; lbl_edad.Text = parent.lbl_edad.Text; lbl_resumen.Text = parent.lbl_resumen.Text; if (parent.txt_Observacion.Text.Length > 8) { lbl_observaciones.Text = parent.txt_Observacion.Text.Substring(0, 8); } else { lbl_observaciones.Text = parent.txt_Observacion.Text; } lbl_TMuestra.Text = parent.cbo_TipoOrden.SelectedValue.ToString(); lb_fingreso.Text = parent.fechaDia.Text + " " + parent.horaDia.Text; //lbl_PacienteOculto.Text = "IMPRESION DE PRUEBA"; //lbl_Numero.Text = "*0100030109*"; //lbl_cama.Text = "1"; //lbl_edad.Text = "30"; //lbl_resumen.Text = "SIN RESUMEN"; //lbl_observaciones.Text = "OBS..."; //lbl_TMuestra.Text = "D"; //lb_fingreso.Text = "29/10/2014 15:41"; DAL.Impresion_AutomaticaDALTableAdapters.H2_Laboratorio_Impresion_Grupo_etiquetasTableAdapter adapter = new DAL.Impresion_AutomaticaDALTableAdapters.H2_Laboratorio_Impresion_Grupo_etiquetasTableAdapter(); DAL.Impresion_AutomaticaDAL.H2_Laboratorio_Impresion_Grupo_etiquetasDataTable aTable = adapter.GetData(lbl_Numero.Text.Replace("*", "")); foreach (DAL.Impresion_AutomaticaDAL.H2_Laboratorio_Impresion_Grupo_etiquetasRow row in aTable) { etiquetas_laboratorio el = new etiquetas_laboratorio(); el.cant_etiquetas = row.grupo_cant_etiqueta; el.grupo = row.grupo_nombre; lista.Add(el); string[] rows = new string[] { el.grupo.ToString(), el.cant_etiquetas.ToString(), "Más", "Menos", "Borrar" }; gv.Rows.Add(rows); } //gv.DataSource = lista; }
public void Imprimir() { foreach (DataGridViewRow dr in gv.Rows) { for (int i = 1; i <= Convert.ToInt32(dr.Cells[1].Value); i++) { etiquetas_laboratorio et = new etiquetas_laboratorio(); et.grupo = (dr.Cells[0].Value + " ").Substring(0, 4) + " - " + i.ToString(); lista_impresion.Add(et); } } //for (int i = 0; i <= lista_impresion.Count-1; i++) //{ // MessageBox.Show(lista_impresion[i].grupo); //} //return; string ImpresoraCodigoBarra = ConfigurationManager.AppSettings["ImpresoraCodBarra"]; printFont = new Font("Arial", 8); printFont2 = new Font("IDAutomationHC39M", 12); printFont3 = new Font("Arial", 10, FontStyle.Bold); PrintDocument pd = new PrintDocument(); pd.DefaultPageSettings.PrinterSettings.PrinterName = ImpresoraCodigoBarra; //pd.DefaultPageSettings.PrinterSettings.Copies = Copias; //Esto estaba antes del pd.print() 11/02/2014 Margins margins = new Margins(0, 0, 0, 0); pd.DefaultPageSettings.Margins = margins; pd.PrintPage += new PrintPageEventHandler (this.pd_PrintPage); pd.Print(); Actualizar_Log(); this.Close(); }