private void btnImprimir_Click(object sender, EventArgs e) { MyTicket(); Interfaz_1 mainMenu = new Interfaz_1(); mainMenu.Show(); try { numero_letra = totalText.Text; CrearImpresion.lineasSeparacion(); Ticket.TextLeft("N° articulos: " + numProd.Text); Ticket.TextoDerecha(" Total: $" + totalText.Text); Ticket.TextoDerecha("Pago: $" + importeText.Text); Ticket.TextoDerecha("Cambio: " + cambioText.Text); Ticket.TextLeft("(" + con.enletras(numero_letra).ToLower()); CrearImpresion.lineasSeparacion(); //----------------------------------------- Ticket.TextoCentro("¡Gracias por su compra!"); CrearImpresion.lineasSeparacion(); //----------------------------------------- Ticket.ImprimirTiket(); } catch (Exception ex) { MessageBox.Show(ex.Message); } this.Close(); }
public void MyTicket() { try { SqlCommand ticke = new SqlCommand("tick", connect_BD); ticke.CommandType = CommandType.StoredProcedure; ticke.Parameters.AddWithValue("@hora", Convert.ToDateTime(horaText.Text)); ticke.Parameters.AddWithValue("@fecha", Convert.ToDateTime(dateTimePicker1.Text)); ticke.ExecuteNonQuery(); SqlDataAdapter adaptador = new SqlDataAdapter(); DataTable tabla = new DataTable(); adaptador.SelectCommand = ticke; adaptador.Fill(tabla); dataGridView1.DataSource = tabla; Ticket.TextLeft(" "); Ticket.TextLeft(" "); Ticket.TextoCentro("Velia Perez Zavala"); Ticket.TextLeft(" R.F.C. PEZV-690103-270"); Ticket.TextLeft(" Aquiles Serdan #105 OTE"); Ticket.TextLeft(" Colonia Centro"); Ticket.TextLeft(" Gpe. Victoria,DGO C.P 34700"); Ticket.TextLeft("Folio: " + folioTick.Text); CrearImpresion.lineasSeparacion();//----------------------------------------- Ticket.TextoCentro("Fecha: " + DateTime.Today.Day + "/" + DateTime.Today.Month + "/" + DateTime.Today.Year); Ticket.TextLeft(" Hora: " + horaText.Text); Ticket.TextLeft(" Le atendio: " + "Fam: Rocha Pérez"); CrearImpresion.lineasSeparacion();//----------------------------------------- CrearImpresion.EncabezadoTicket(); foreach (DataGridViewRow fila in dataGridView1.Rows) { int desc = Convert.ToInt32(fila.Cells[5].Value); if (desc == 0) { Ticket.TextLeft(fila.Cells[0].Value.ToString()); Ticket.TextLeft(fila.Cells[1].Value.ToString()); Ticket.TextLeft(" " + " " + fila.Cells[3].Value.ToString() + " " + fila.Cells[4].Value.ToString() + " " + fila.Cells[7].Value.ToString()); } else { Ticket.TextLeft(fila.Cells[0].Value.ToString()); Ticket.TextLeft(fila.Cells[1].Value.ToString() + " -" + fila.Cells[5].Value.ToString() + " %"); Ticket.TextLeft(" " + "p.u $" + fila.Cells[4].Value.ToString() + " -" + fila.Cells[6].Value.ToString());//total-descuento Ticket.TextLeft(" " + " " + fila.Cells[3].Value.ToString() + " " + fila.Cells[4].Value.ToString() + " " + fila.Cells[7].Value.ToString()); } } } catch {} finally { connect_BD.Close(); } }
private void imprimir_Click(object sender, EventArgs e) { CrearImpresion Ticket = new CrearImpresion(); Conversion letras = new Conversion(); Ticket.TextLeft(" "); Ticket.TextLeft(" "); Ticket.TextoCentro("Velia Perez Zavala"); Ticket.TextLeft(" R.F.C. PEZV-690103-270"); Ticket.TextLeft(" Aquiles Serdan #105 OTE"); Ticket.TextLeft(" Colonia Centro"); Ticket.TextLeft(" Gpe. Victoria,DGO C.P 34700"); CrearImpresion.lineasSeparacion(); //----------------------------------------- Ticket.TextoCentro("Corte del día"); Ticket.TextLeft("Fecha: " + dateTimePicker1.Value.ToString()); //DateTime.Today.Day + "/" + DateTime.Today.Month + "/" + DateTime.Today.Year); CrearImpresion.lineasSeparacion(); //----------------------------------------- CrearImpresion.EncabezadoTicket(); foreach (DataGridViewRow fila in dataGridView1.Rows) { int desc = Convert.ToInt32(fila.Cells[6].Value); if (desc == 0) { Ticket.TextLeft(fila.Cells[3].Value.ToString()); //Codigo producto Ticket.TextLeft(fila.Cells[4].Value.ToString()); // Nombre producto // cantidad Precio unitario Precio*cantidad Ticket.TextLeft(" " + " " + fila.Cells[8].Value.ToString() + " " + fila.Cells[5].Value.ToString() + " " + fila.Cells[9].Value.ToString()); } else { Ticket.TextLeft(fila.Cells[3].Value.ToString()); // codigo producto // Nombre producto MENOS tanto porciento Ticket.TextLeft(fila.Cells[4].Value.ToString() + " -" + fila.Cells[6].Value.ToString() + " %"); // precio unitario - lo que es de porcentaje Ticket.TextLeft(" " + "p.u $" + fila.Cells[5].Value.ToString() + " -" + fila.Cells[7].Value.ToString());//total-descuento // cantidad Precio unitario Precio*cantidad Ticket.TextLeft(" " + " " + fila.Cells[8].Value.ToString() + " " + fila.Cells[5].Value.ToString() + " " + fila.Cells[9].Value.ToString()); } } if (labelAnticipos.Text != "0") { Ticket.TextoCentro("-------------APARTADOS------------"); foreach (DataGridViewRow item in totalApartados.Rows) { string celdaCodigo = item.Cells[0].Value.ToString(); if (celdaCodigo != null) { //Ticket.TextLeft(item.Cells[0].Value.ToString()); //Codigo Apartado Ticket.TextLeft(item.Cells[2].Value.ToString()); // Nombre cliente //Ticket.TextLeft(" " + " " + "Anticipo: " + " " + item.Cells[3].Value.ToString() + " " + "---"); Ticket.TextLeft("Anticipo: " + " " + item.Cells[3].Value.ToString() + " " + "---"); } } } if (labelPagoText.Text != "0") { foreach (DataGridViewRow fila in pagosDiarios.Rows) { string celdaCodigo = fila.Cells[0].Value.ToString(); if (celdaCodigo != null) { //Ticket.TextLeft(fila.Cells[0].Value.ToString()); //Codigo Pago Ticket.TextLeft(fila.Cells[1].Value.ToString()); // Nombre cliente //Ticket.TextLeft(" " + " " + "Anticipo: " + " " + item.Cells[3].Value.ToString() + " " + "---"); Ticket.TextLeft("Pago: " + " " + fila.Cells[4].Value.ToString() + " " + "---"); } } } CrearImpresion.lineasSeparacion(); //------------------------------------------- Ticket.TextLeft("Ventas: $" + totalEnTexto.Text); //nombre Ticket.TextLeft("Anticipos: $" + labelAnticipos.Text); //nombre Ticket.TextLeft("Pagos: $" + labelPagoText.Text); //nombre Ticket.TextLeft("TOTAL DÍA: $" + totalDiario.Text); //nombre Ticket.TextLeft("(" + letras.enletras(totalDiario.Text).ToLower()); Ticket.ImprimirTiket(); }