Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //---------------- Creando el stream para generar el reporte en la ventana-----------//
- private void streamReporte() {
- try {
- int fila2 = jTRerporte.getSelectedRow();
- String id = jTRerporte.getValueAt(fila2, 0).toString();
- String usuario = jTRerporte.getValueAt(fila2, 1).toString();
- String sucursal = jTRerporte.getValueAt(fila2, 2).toString();
- String trabajos = jTRerporte.getValueAt(fila2, 3).toString();
- String tiempos = jTRerporte.getValueAt(fila2, 4).toString();
- String comisiones = jTRerporte.getValueAt(fila2, 5).toString();
- String bono = jTRerporte.getValueAt(fila2, 6).toString();
- //Creando el objeto bw de la clase BufferedWriter Y se le pasa como parametro la ruta donde se guardara el archivo
- BufferedWriter bw = new BufferedWriter(new FileWriter("C:\\Users\\dario\\Documents\\NetBeansProjects\\floreria2\\src\\reportes.txt"));
- //se le pasa lo contenido en la caja de texto para que lo imprima en el archivo txt
- bw.write("REPORTE INDIVDUAL" + "\n");
- bw.write("Num. Empleado:" + id + "\n");
- bw.write("Usuario:" + usuario + "\n");
- bw.write("Sucursal:" + sucursal + "\n");
- bw.write("Trabajos realizados en el periodo" + trabajos + "\n");
- bw.write("Tiempo Total:" + tiempos + "\n");
- bw.write("Commisiones totales durante el periodo:" + comisiones + "\n");
- bw.write("Bono Extra:" + bono + "\n");
- bw.close(); //se cierra el stream
- JOptionPane.showMessageDialog(null, "Archivo creado con exito");
- } catch (HeadlessException | IOException e) {
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement