List of usage examples for com.itextpdf.text.pdf PdfPCell setColspan
public void setColspan(int colspan)
From source file:org.totschnig.myexpenses.model.Account.java
License:Open Source License
private void addTransactionList(Document document, Cursor transactionCursor, PdfHelper helper, WhereFilter filter) throws DocumentException, IOException { String selection;//w w w. j av a 2s. c o m String[] selectionArgs; if (!filter.isEmpty()) { selection = filter.getSelectionForParts(DatabaseConstants.VIEW_EXTENDED);//GROUP query uses extended view selectionArgs = filter.getSelectionArgs(true); } else { selection = null; selectionArgs = null; } Builder builder = Transaction.CONTENT_URI.buildUpon(); builder.appendPath(TransactionProvider.URI_SEGMENT_GROUPS).appendPath(grouping.name()); if (getId() < 0) { builder.appendQueryParameter(KEY_CURRENCY, currency.getCurrencyCode()); } else { builder.appendQueryParameter(KEY_ACCOUNTID, String.valueOf(getId())); } Cursor groupCursor = cr().query(builder.build(), null, selection, selectionArgs, KEY_YEAR + " ASC," + KEY_SECOND_GROUP + " ASC"); MyApplication ctx = MyApplication.getInstance(); int columnIndexGroupSumIncome = groupCursor.getColumnIndex(KEY_SUM_INCOME); int columnIndexGroupSumExpense = groupCursor.getColumnIndex(KEY_SUM_EXPENSES); int columnIndexGroupSumTransfer = groupCursor.getColumnIndex(KEY_SUM_TRANSFERS); int columIndexGroupSumInterim = groupCursor.getColumnIndex(KEY_INTERIM_BALANCE); int columnIndexRowId = transactionCursor.getColumnIndex(KEY_ROWID); int columnIndexYear = transactionCursor.getColumnIndex(KEY_YEAR); int columnIndexYearOfWeekStart = transactionCursor.getColumnIndex(KEY_YEAR_OF_WEEK_START); int columnIndexMonth = transactionCursor.getColumnIndex(KEY_MONTH); int columnIndexWeek = transactionCursor.getColumnIndex(KEY_WEEK); int columnIndexDay = transactionCursor.getColumnIndex(KEY_DAY); int columnIndexAmount = transactionCursor.getColumnIndex(KEY_AMOUNT); int columnIndexLabelSub = transactionCursor.getColumnIndex(KEY_LABEL_SUB); int columnIndexLabelMain = transactionCursor.getColumnIndex(KEY_LABEL_MAIN); int columnIndexComment = transactionCursor.getColumnIndex(KEY_COMMENT); int columnIndexReferenceNumber = transactionCursor.getColumnIndex(KEY_REFERENCE_NUMBER); int columnIndexPayee = transactionCursor.getColumnIndex(KEY_PAYEE_NAME); int columnIndexTransferPeer = transactionCursor.getColumnIndex(KEY_TRANSFER_PEER); int columnIndexDate = transactionCursor.getColumnIndex(KEY_DATE); DateFormat itemDateFormat; switch (grouping) { case DAY: itemDateFormat = android.text.format.DateFormat.getTimeFormat(ctx); break; case MONTH: itemDateFormat = new SimpleDateFormat("dd"); break; case WEEK: itemDateFormat = new SimpleDateFormat("EEE"); break; default: itemDateFormat = Utils.localizedYearlessDateFormat(); } PdfPTable table = null; int prevHeaderId = 0, currentHeaderId; transactionCursor.moveToFirst(); groupCursor.moveToFirst(); while (transactionCursor.getPosition() < transactionCursor.getCount()) { int year = transactionCursor .getInt(grouping.equals(Grouping.WEEK) ? columnIndexYearOfWeekStart : columnIndexYear); int month = transactionCursor.getInt(columnIndexMonth); int week = transactionCursor.getInt(columnIndexWeek); int day = transactionCursor.getInt(columnIndexDay); int second = -1; switch (grouping) { case DAY: currentHeaderId = year * 1000 + day; break; case WEEK: currentHeaderId = year * 1000 + week; break; case MONTH: currentHeaderId = year * 1000 + month; break; case YEAR: currentHeaderId = year * 1000; break; default: currentHeaderId = 1; } if (currentHeaderId != prevHeaderId) { if (table != null) { document.add(table); } switch (grouping) { case DAY: second = transactionCursor.getInt(columnIndexDay); break; case MONTH: second = transactionCursor.getInt(columnIndexMonth); break; case WEEK: second = transactionCursor.getInt(columnIndexWeek); break; } table = helper.newTable(2); table.setWidthPercentage(100f); PdfPCell cell = helper.printToCell(grouping.getDisplayTitle(ctx, year, second, transactionCursor), FontType.HEADER); table.addCell(cell); Long sumExpense = DbUtils.getLongOr0L(groupCursor, columnIndexGroupSumExpense); Long sumIncome = DbUtils.getLongOr0L(groupCursor, columnIndexGroupSumIncome); Long sumTransfer = DbUtils.getLongOr0L(groupCursor, columnIndexGroupSumTransfer); Long delta = sumIncome - sumExpense + sumTransfer; Long interimBalance = DbUtils.getLongOr0L(groupCursor, columIndexGroupSumInterim); Long previousBalance = interimBalance - delta; cell = helper.printToCell(String.format("%s %s %s = %s", Utils.convAmount(previousBalance, currency), Long.signum(delta) > -1 ? "+" : "-", Utils.convAmount(Math.abs(delta), currency), Utils.convAmount(interimBalance, currency)), FontType.HEADER); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); table.addCell(cell); document.add(table); table = helper.newTable(3); table.setWidthPercentage(100f); cell = helper.printToCell("+ " + Utils.convAmount(sumIncome, currency), FontType.NORMAL); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = helper.printToCell("- " + Utils.convAmount(sumExpense, currency), FontType.NORMAL); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = helper.printToCell("<-> " + Utils.convAmount(DbUtils.getLongOr0L(groupCursor, columnIndexGroupSumTransfer), currency), FontType.NORMAL); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); table.setSpacingAfter(2f); document.add(table); LineSeparator sep = new LineSeparator(); document.add(sep); table = helper.newTable(4); table.setWidths(new int[] { 1, 5, 3, 2 }); table.setSpacingBefore(2f); table.setSpacingAfter(2f); table.setWidthPercentage(100f); prevHeaderId = currentHeaderId; groupCursor.moveToNext(); } long amount = transactionCursor.getLong(columnIndexAmount); String catText = transactionCursor.getString(columnIndexLabelMain); PdfPCell cell = helper.printToCell( Utils.convDateTime(transactionCursor.getString(columnIndexDate), itemDateFormat), FontType.NORMAL); table.addCell(cell); if (DbUtils.getLongOrNull(transactionCursor, columnIndexTransferPeer) != null) { catText = ((amount < 0) ? "=> " : "<= ") + catText; } else { Long catId = DbUtils.getLongOrNull(transactionCursor, KEY_CATID); if (SPLIT_CATID.equals(catId)) { Cursor splits = cr().query(Transaction.CONTENT_URI, null, KEY_PARENTID + " = " + transactionCursor.getLong(columnIndexRowId), null, null); splits.moveToFirst(); catText = ""; while (splits.getPosition() < splits.getCount()) { String splitText = DbUtils.getString(splits, KEY_LABEL_MAIN); if (splitText.length() > 0) { if (DbUtils.getLongOrNull(splits, KEY_TRANSFER_PEER) != null) { splitText = "[" + splitText + "]"; } else { String label_sub = DbUtils.getString(splits, KEY_LABEL_SUB); if (label_sub.length() > 0) splitText += TransactionList.CATEGORY_SEPARATOR + label_sub; } } else { splitText = ctx.getString(R.string.no_category_assigned); } splitText += " " + Utils .convAmount(splits.getLong(splits.getColumnIndexOrThrow(KEY_AMOUNT)), currency); String splitComment = DbUtils.getString(splits, KEY_COMMENT); if (splitComment != null && splitComment.length() > 0) { splitText += " (" + splitComment + ")"; } catText += splitText; if (splits.getPosition() != splits.getCount() - 1) { catText += "; "; } splits.moveToNext(); } splits.close(); } else if (catId == null) { catText = ctx.getString(R.string.no_category_assigned); } else { String label_sub = transactionCursor.getString(columnIndexLabelSub); if (label_sub != null && label_sub.length() > 0) { catText = catText + TransactionList.CATEGORY_SEPARATOR + label_sub; } } } String referenceNumber = transactionCursor.getString(columnIndexReferenceNumber); if (referenceNumber != null && referenceNumber.length() > 0) catText = "(" + referenceNumber + ") " + catText; cell = helper.printToCell(catText, FontType.NORMAL); String payee = transactionCursor.getString(columnIndexPayee); if (payee == null || payee.length() == 0) { cell.setColspan(2); } table.addCell(cell); if (payee != null && payee.length() > 0) { table.addCell(helper.printToCell(payee, FontType.UNDERLINE)); } FontType t = amount < 0 ? FontType.EXPENSE : FontType.INCOME; cell = helper.printToCell(Utils.convAmount(amount, currency), t); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); table.addCell(cell); String comment = transactionCursor.getString(columnIndexComment); if (comment != null && comment.length() > 0) { cell = helper.printToCell(comment, FontType.ITALIC); cell.setColspan(2); table.addCell(helper.emptyCell()); table.addCell(cell); table.addCell(helper.emptyCell()); } transactionCursor.moveToNext(); } // now add all this to the document document.add(table); groupCursor.close(); }
From source file:org.tvd.thptty.management.report.Report.java
private PdfPTable createStatisticsStudentPointTable() throws BadElementException { PdfPTable table = new PdfPTable(15); table.setWidthPercentage(100);/*www . j a v a 2 s. c o m*/ for (int i = 0; i < 3; i++) { Phrase phrase = new Phrase(cellTitles[i], tahomaBoldFont); PdfPCell cx = new PdfPCell(phrase); cx.setHorizontalAlignment(Element.ALIGN_CENTER); cx.setVerticalAlignment(Element.ALIGN_MIDDLE); cx.setRowspan(3); table.addCell(cx); } for (int i = 3; i < 5; i++) { Phrase phrase = new Phrase(cellTitles[i], tahomaBoldFont); PdfPCell cx = new PdfPCell(phrase); cx.setHorizontalAlignment(Element.ALIGN_CENTER); cx.setVerticalAlignment(Element.ALIGN_MIDDLE); cx.setColspan(6); table.addCell(cx); } for (int i = 5; i < 11; i++) { Phrase phrase = new Phrase(cellTitles[i], tahomaBoldFont); PdfPCell cx = new PdfPCell(phrase); cx.setHorizontalAlignment(Element.ALIGN_CENTER); cx.setVerticalAlignment(Element.ALIGN_MIDDLE); cx.setColspan(2); table.addCell(cx); } for (int i = 11; i < 23; i++) { Phrase phrase = new Phrase(cellTitles[i], tahomaBoldFont); PdfPCell cx = new PdfPCell(phrase); cx.setHorizontalAlignment(Element.ALIGN_CENTER); cx.setVerticalAlignment(Element.ALIGN_MIDDLE); table.addCell(cx); } table.setHeaderRows(3); Phrase phrase = null; for (int i = 0; rows != null && i < rows.size(); i++) { for (int k = 0; k < rows.get(i).getListCells().size(); k++) { phrase = new Phrase(rows.get(i).getListCells().get(k).getCellName(), tahomaSmallFont); PdfPCell cx = new PdfPCell(phrase); cx.setHorizontalAlignment(Element.ALIGN_CENTER); cx.setVerticalAlignment(Element.ALIGN_MIDDLE); table.addCell(cx); } } float totalWidth = PageSize.A4.getWidth(); float columnWidths[] = new float[15]; for (int i = 0; i < columnWidths.length; i++) { columnWidths[i] = (float) (1.0 / 15) * totalWidth; } try { table.setWidthPercentage(columnWidths, PageSize.A4); } catch (DocumentException e) { e.printStackTrace(); } return table; }
From source file:PDF.GenerateReportActivities.java
private PdfPTable TablaDatos() throws Exception { PdfPTable Datos_prof = new PdfPTable(5); Datos_prof.setWidths(new int[] { 2, 3, 2, 2, 2 }); PdfPCell Titulo_tabla = new PdfPCell(new Phrase("Datos generales del Profesor", encabezadost)); PdfPCell Nombre = new PdfPCell(new Phrase("Nombre del Profesor")); PdfPCell Matricula = new PdfPCell(new Phrase("No. de Empleado")); PdfPCell UA = new PdfPCell(new Phrase("Unidad Acadmica")); PdfPCell Puntos = new PdfPCell(new Phrase("Puntos obtenidos")); PdfPCell Nivel = new PdfPCell(new Phrase("Nivel de Beca")); Titulo_tabla.setHorizontalAlignment(Element.ALIGN_CENTER); Titulo_tabla.setVerticalAlignment(Element.ALIGN_MIDDLE); Titulo_tabla.setBackgroundColor(new BaseColor(153, 0, 76)); Titulo_tabla.setColspan(5); Titulo_tabla.setExtraParagraphSpace(15f); Datos_prof.addCell(Titulo_tabla);/* www.ja v a 2 s .c o m*/ Nombre.setHorizontalAlignment(Element.ALIGN_CENTER); Datos_prof.addCell(Nombre); Matricula.setHorizontalAlignment(Element.ALIGN_CENTER); Datos_prof.addCell(Matricula); UA.setHorizontalAlignment(Element.ALIGN_CENTER); Datos_prof.addCell(UA); Puntos.setHorizontalAlignment(Element.ALIGN_CENTER); Datos_prof.addCell(Puntos); Nivel.setHorizontalAlignment(Element.ALIGN_CENTER); Datos_prof.addCell(Nivel); /*Aqui van las consultas de los datos del profesor*/ ResultSet rn, rt; String nom_usuario = null, id_usuario = null, u_a = null, puntaje_final = null, nivel = null; //Datos_prof.addCell("Hola"); ResultSet rp = lb.executeQuery("SELECT * FROM usuario WHERE id_usuario = " + username); while (rp.next()) { nom_usuario = rp.getString("nom_usuario"); id_usuario = rp.getString("id_usuario"); u_a = rp.getString("u_a"); } System.out.println(getUsername()); rn = lb.executeQuery( "SELECT * FROM evaluador_evalua_profesor WHERE id_usuario_prof = '" + getUsername() + "'"); while (rn.next()) { puntaje_final = rn.getString("puntaje_final"); //Datos_prof.addCell(rn.getString("puntaje_final")); } rt = lb.executeQuery("SELECT * FROM profesor WHERE id_usuario = '" + getUsername() + "'"); while (rt.next()) { nivel = rt.getString("nivel"); } Datos_prof.addCell(nom_usuario); Datos_prof.addCell(id_usuario); Datos_prof.addCell(u_a); Datos_prof.addCell(puntaje_final); Datos_prof.addCell(nivel); return Datos_prof; }
From source file:PDF.GenerateReportActivities.java
private PdfPTable dospuntouno() throws Exception { PdfPTable Dos_uno = new PdfPTable(6); Dos_uno.setWidths(new int[] { 2, 2, 3, 2, 2, 2 }); PdfPCell Titulo_tabla = new PdfPCell(new Phrase( "Actividad 2.1" + " - Formacin de Recursos Humanos para la Investigacin", encabezadost)); PdfPCell Nom_Proyecto = new PdfPCell(new Phrase("Nmero de proyecto SIP")); PdfPCell Num_Actividad = new PdfPCell(new Phrase("Nmero de Actividad")); PdfPCell Tipo_Actividad = new PdfPCell(new Phrase("Tipo de Actividad")); PdfPCell Ruta_alm = new PdfPCell(new Phrase("Evidencia")); PdfPCell Puntos = new PdfPCell(new Phrase("Puntos obtenidos")); PdfPCell Observaciones = new PdfPCell(new Phrase("Observaciones")); //PdfPCell celda=new PdfPCell(); Titulo_tabla.setHorizontalAlignment(Element.ALIGN_CENTER); Titulo_tabla.setVerticalAlignment(Element.ALIGN_MIDDLE); Titulo_tabla.setBackgroundColor(new BaseColor(153, 0, 76)); Titulo_tabla.setColspan(6); Titulo_tabla.setExtraParagraphSpace(15f); Dos_uno.addCell(Titulo_tabla);/*from www . ja v a 2 s .c om*/ Nom_Proyecto.setHorizontalAlignment(Element.ALIGN_CENTER); Nom_Proyecto.setVerticalAlignment(Element.ALIGN_MIDDLE); Dos_uno.addCell(Nom_Proyecto); Num_Actividad.setHorizontalAlignment(Element.ALIGN_CENTER); Num_Actividad.setVerticalAlignment(Element.ALIGN_MIDDLE); Dos_uno.addCell(Num_Actividad); Tipo_Actividad.setHorizontalAlignment(Element.ALIGN_CENTER); Tipo_Actividad.setVerticalAlignment(Element.ALIGN_MIDDLE); Dos_uno.addCell(Tipo_Actividad); Ruta_alm.setHorizontalAlignment(Element.ALIGN_CENTER); Ruta_alm.setVerticalAlignment(Element.ALIGN_MIDDLE); Dos_uno.addCell(Ruta_alm); Puntos.setHorizontalAlignment(Element.ALIGN_CENTER); Puntos.setVerticalAlignment(Element.ALIGN_MIDDLE); Dos_uno.addCell(Puntos); Observaciones.setHorizontalAlignment(Element.ALIGN_CENTER); Observaciones.setVerticalAlignment(Element.ALIGN_MIDDLE); Dos_uno.addCell(Observaciones); /*Aqui van las consultas de las Actividades del profesor*/ /**Get actual period***/ int periodo = 0; ResultSet rperiodo = lb.executeQuery("SELECT * FROM profesor WHERE id_usuario = " + getUsername()); if (rperiodo.next()) periodo = rperiodo.getInt("periodo"); /**Get actual period***/ String id_al = null, tipo_alumno = null, puntaje = null, comen = null, nom_proyecto = null; ResultSet rb = lb .executeQuery("SELECT * FROM profesor_tiene_proyecto WHERE " + "id_usuario = " + getUsername() + " AND (validado_alumno = 1 OR validado_alumno = 0) AND " + "periodo = " + periodo); while (rb.next()) { nom_proyecto = rb.getString("id_proyecto"); Dos_uno.addCell(nom_proyecto); id_al = rb.getString("id_alumno"); Dos_uno.addCell(id_al); tipo_alumno = rb.getString("tipo_alumno"); Dos_uno.addCell(tipo_alumno); Anchor anchor = new Anchor("Constancia"); //anchor.setReference("file:///"+rb.getString("ruta_alm")); anchor.setReference(rb.getString("ruta_alumno")); Dos_uno.addCell(anchor); puntaje = rb.getString("puntaje_alumno"); Dos_uno.addCell(puntaje); comen = rb.getString("comentarios"); Dos_uno.addCell(comen); } return Dos_uno; }
From source file:PDF.GenerateReportActivities.java
private PdfPTable dospuntodos() throws Exception { PdfPTable Dos_dos = new PdfPTable(5); Dos_dos.setWidths(new int[] { 2, 2, 3, 2, 3 }); PdfPCell Titulo_tabla = new PdfPCell( new Phrase("Actividad 2.2" + " - Publicaciones Cientficas y/o de Divulgacin", encabezadost)); PdfPCell Num_Actividad = new PdfPCell(new Phrase("Nmero de Actividad")); PdfPCell Tipo_Actividad = new PdfPCell(new Phrase("Tipo de Actividad* (Consultar parte de abajo)")); PdfPCell Ruta_alm = new PdfPCell(new Phrase("Evidencia")); PdfPCell Puntos = new PdfPCell(new Phrase("Puntos obtenidos")); PdfPCell Observaciones = new PdfPCell(new Phrase("Observaciones")); PdfPCell celda = new PdfPCell(); Titulo_tabla.setHorizontalAlignment(Element.ALIGN_CENTER); Titulo_tabla.setVerticalAlignment(Element.ALIGN_MIDDLE); Titulo_tabla.setBackgroundColor(new BaseColor(153, 0, 76)); Titulo_tabla.setColspan(5); Titulo_tabla.setExtraParagraphSpace(15f); Dos_dos.addCell(Titulo_tabla);//from ww w . j ava 2 s .c o m Num_Actividad.setHorizontalAlignment(Element.ALIGN_CENTER); Num_Actividad.setVerticalAlignment(Element.ALIGN_MIDDLE); Dos_dos.addCell(Num_Actividad); Tipo_Actividad.setHorizontalAlignment(Element.ALIGN_CENTER); Tipo_Actividad.setVerticalAlignment(Element.ALIGN_MIDDLE); Dos_dos.addCell(Tipo_Actividad); Ruta_alm.setHorizontalAlignment(Element.ALIGN_CENTER); Ruta_alm.setVerticalAlignment(Element.ALIGN_MIDDLE); Dos_dos.addCell(Ruta_alm); Puntos.setHorizontalAlignment(Element.ALIGN_CENTER); Puntos.setVerticalAlignment(Element.ALIGN_MIDDLE); Dos_dos.addCell(Puntos); Observaciones.setHorizontalAlignment(Element.ALIGN_CENTER); Observaciones.setVerticalAlignment(Element.ALIGN_MIDDLE); Dos_dos.addCell(Observaciones); /*Aqui van las consultas de las Actividades del profesor*/ int periodo = 0; ResultSet rperiodo = lb.executeQuery("SELECT * FROM profesor WHERE id_usuario = " + getUsername()); if (rperiodo.next()) periodo = rperiodo.getInt("periodo"); /**Get actual period***/ String id_pub = null, id_tipo = null, puntaje = null, coment = null; ResultSet rb = lb.executeQuery("SELECT * FROM profesor_tiene_pub WHERE " + "id_usuario = '" + getUsername() + "' AND (validado = 1 OR validado = 0) AND (id_tipo_pub = 1 " + "OR id_tipo_pub = 2 OR id_tipo_pub = 3 OR id_tipo_pub = 4 OR id_tipo_pub = 5) AND " + "periodo = " + periodo); while (rb.next()) { id_pub = rb.getString("id_publicacion"); Dos_dos.addCell(id_pub); id_tipo = rb.getString("id_tipo_pub"); Dos_dos.addCell(id_tipo);//Add the type of every type pub Anchor anchor = new Anchor("Constancia"); anchor.setReference(rb.getString("ruta_alm")); //anchor.setReference("file:///"+rb.getString("ruta_alm")); Dos_dos.addCell(anchor); puntaje = rb.getString("puntaje"); Dos_dos.addCell(puntaje); coment = rb.getString("comentarios"); Dos_dos.addCell(coment); } return Dos_dos; }
From source file:PDF.GenerateReportActivities.java
private PdfPTable dospuntotres() throws Exception { PdfPTable Dos_tres = new PdfPTable(5); Dos_tres.setWidths(new int[] { 2, 2, 3, 2, 3 }); PdfPCell Titulo_tabla = new PdfPCell(new Phrase("Actividad 2.3" + " - Eventos Acadmicos", encabezadost)); PdfPCell Num_Actividad = new PdfPCell(new Phrase("Nmero de Actividad")); PdfPCell Ruta_alm = new PdfPCell(new Phrase("Evidencia")); PdfPCell Puntos = new PdfPCell(new Phrase("Puntos obtenidos")); PdfPCell Observaciones = new PdfPCell(new Phrase("Observaciones")); PdfPCell Tipo_Actividad = new PdfPCell(new Phrase("Nombre del evento")); PdfPCell celda = new PdfPCell(); Titulo_tabla.setHorizontalAlignment(Element.ALIGN_CENTER); Titulo_tabla.setVerticalAlignment(Element.ALIGN_MIDDLE); Titulo_tabla.setBackgroundColor(new BaseColor(153, 0, 76)); Titulo_tabla.setColspan(5); Titulo_tabla.setExtraParagraphSpace(15f); Dos_tres.addCell(Titulo_tabla);/*from www.j av a 2 s .c o m*/ Num_Actividad.setHorizontalAlignment(Element.ALIGN_CENTER); Num_Actividad.setVerticalAlignment(Element.ALIGN_MIDDLE); Dos_tres.addCell(Num_Actividad); Tipo_Actividad.setHorizontalAlignment(Element.ALIGN_CENTER); Tipo_Actividad.setVerticalAlignment(Element.ALIGN_MIDDLE); Dos_tres.addCell(Tipo_Actividad); Ruta_alm.setHorizontalAlignment(Element.ALIGN_CENTER); Ruta_alm.setVerticalAlignment(Element.ALIGN_MIDDLE); Dos_tres.addCell(Ruta_alm); Puntos.setHorizontalAlignment(Element.ALIGN_CENTER); Puntos.setVerticalAlignment(Element.ALIGN_MIDDLE); Dos_tres.addCell(Puntos); Observaciones.setHorizontalAlignment(Element.ALIGN_CENTER); Observaciones.setVerticalAlignment(Element.ALIGN_MIDDLE); Dos_tres.addCell(Observaciones); /*Aqui van las consultas de las Actividades del profesor*/ /**Get actual period***/ int periodo = 0; String id_evento = null, even = null, puntaje = null, comentarios = null; ResultSet rperiodo = lb.executeQuery("SELECT * FROM profesor WHERE id_usuario = " + getUsername()); if (rperiodo.next()) periodo = rperiodo.getInt("periodo"); /**Get actual period***/ ResultSet rb = lb.executeQuery("SELECT * FROM profesor_tiene_pub WHERE " + "id_usuario = '" + getUsername() + "' AND (validado = 1 OR validado = 0) AND periodo = " + periodo + " AND " + "(id_tipo_pub = 6 OR id_tipo_pub = 7 OR id_tipo_pub = 8)"); while (rb.next()) { id_evento = rb.getString("id_evento"); Dos_tres.addCell(id_evento); Dos_tres.addCell("Evento acadmico"); Anchor anchor = new Anchor("Constancia"); anchor.setReference(rb.getString("ruta_alm")); //anchor.setReference("file:///"+rb.getString("ruta_alm")); Dos_tres.addCell(anchor); puntaje = rb.getString("puntaje"); Dos_tres.addCell(puntaje); comentarios = rb.getString("comentarios"); Dos_tres.addCell(comentarios); } return Dos_tres; }
From source file:PDF.GenerateReportActivities.java
private PdfPTable dospuntocuatro() throws Exception { PdfPTable Dos_cuatro = new PdfPTable(5); Dos_cuatro.setWidths(new int[] { 2, 2, 3, 2, 3 }); PdfPCell Titulo_tabla = new PdfPCell( new Phrase("Actividad 2.4" + " - Investigacin y/o Desarrollo Satisfactorio", encabezadost)); PdfPCell Num_Actividad = new PdfPCell(new Phrase("Nmero de Actividad")); PdfPCell Tipo_Actividad = new PdfPCell(new Phrase("ID del proyecto SIP")); PdfPCell Ruta_alm = new PdfPCell(new Phrase("Evidencia")); PdfPCell Puntos = new PdfPCell(new Phrase("Puntos obtenidos")); PdfPCell Observaciones = new PdfPCell(new Phrase("Observaciones")); PdfPCell celda = new PdfPCell(); Titulo_tabla.setHorizontalAlignment(Element.ALIGN_CENTER); Titulo_tabla.setVerticalAlignment(Element.ALIGN_MIDDLE); Titulo_tabla.setBackgroundColor(new BaseColor(153, 0, 76)); Titulo_tabla.setColspan(5); Titulo_tabla.setExtraParagraphSpace(15f); Dos_cuatro.addCell(Titulo_tabla);/*from w ww .j a va2 s . c o m*/ Num_Actividad.setHorizontalAlignment(Element.ALIGN_CENTER); Num_Actividad.setVerticalAlignment(Element.ALIGN_MIDDLE); Dos_cuatro.addCell(Num_Actividad); Tipo_Actividad.setHorizontalAlignment(Element.ALIGN_CENTER); Tipo_Actividad.setVerticalAlignment(Element.ALIGN_MIDDLE); Dos_cuatro.addCell(Tipo_Actividad); Ruta_alm.setHorizontalAlignment(Element.ALIGN_CENTER); Ruta_alm.setVerticalAlignment(Element.ALIGN_MIDDLE); Dos_cuatro.addCell(Ruta_alm); Puntos.setHorizontalAlignment(Element.ALIGN_CENTER); Puntos.setVerticalAlignment(Element.ALIGN_MIDDLE); Dos_cuatro.addCell(Puntos); Observaciones.setHorizontalAlignment(Element.ALIGN_CENTER); Observaciones.setVerticalAlignment(Element.ALIGN_MIDDLE); Dos_cuatro.addCell(Observaciones); /*Aqui van las consultas de las Actividades del profesor*/ int periodo = 0; ResultSet rperiodo = lb.executeQuery("SELECT * FROM profesor WHERE id_usuario = " + getUsername()); if (rperiodo.next()) periodo = rperiodo.getInt("periodo"); /**Get actual period***/ String id_pr = null, puntaje = null, comenta = null; ResultSet rb = lb.executeQuery("SELECT count(*), id_proyecto, ruta_alm, puntaje, comentarios " + "FROM profesor_tiene_proyecto " + "WHERE id_usuario = " + getUsername() + " AND " + "(validado = 1 OR validado = 0) AND periodo = " + periodo + " GROUP BY id_proyecto " + "HAVING COUNT(*) > 0"); /* SELECT count(*), id_proyecto, ruta_alm, puntaje, comentarios FROM profesor_tiene_proyecto WHERE id_usuario = 11014 AND aceptado = 1 AND validado = 1 GROUP BY id_proyecto HAVING COUNT(*) > 1; */ while (rb.next()) { Dos_cuatro.addCell("2.4.2"); id_pr = rb.getString("id_proyecto"); Dos_cuatro.addCell(id_pr); Anchor anchor = new Anchor("Constancia"); //anchor.setReference("file:///"+rb.getString("ruta_alm")); anchor.setReference(rb.getString("ruta_alm")); Dos_cuatro.addCell(anchor); puntaje = rb.getString("puntaje"); Dos_cuatro.addCell(puntaje); comenta = rb.getString("comentarios"); Dos_cuatro.addCell(comenta); } return Dos_cuatro; }
From source file:PDF.GenerateReportActivities.java
private PdfPTable dospuntocinco() throws Exception { PdfPTable Dos_cinco = new PdfPTable(5); Dos_cinco.setWidths(new int[] { 2, 2, 3, 2, 3 }); PdfPCell Titulo_tabla = new PdfPCell(new Phrase("Actividad 2.5.2" + " - Derechos de Autor", encabezadost)); PdfPCell Num_Actividad = new PdfPCell(new Phrase("Nmero de Actividad")); PdfPCell Tipo_Actividad = new PdfPCell(new Phrase("Identificador de obra")); PdfPCell Ruta_alm = new PdfPCell(new Phrase("Evidencia")); PdfPCell Puntos = new PdfPCell(new Phrase("Puntos obtenidos")); PdfPCell Observaciones = new PdfPCell(new Phrase("Observaciones")); PdfPCell celda = new PdfPCell(); Titulo_tabla.setHorizontalAlignment(Element.ALIGN_CENTER); Titulo_tabla.setVerticalAlignment(Element.ALIGN_MIDDLE); Titulo_tabla.setBackgroundColor(new BaseColor(153, 0, 76)); Titulo_tabla.setColspan(5); Titulo_tabla.setExtraParagraphSpace(15f); Dos_cinco.addCell(Titulo_tabla);// w ww.ja va 2s . c om Num_Actividad.setHorizontalAlignment(Element.ALIGN_CENTER); Num_Actividad.setVerticalAlignment(Element.ALIGN_MIDDLE); Dos_cinco.addCell(Num_Actividad); Tipo_Actividad.setHorizontalAlignment(Element.ALIGN_CENTER); Tipo_Actividad.setVerticalAlignment(Element.ALIGN_MIDDLE); Dos_cinco.addCell(Tipo_Actividad); Ruta_alm.setHorizontalAlignment(Element.ALIGN_CENTER); Ruta_alm.setVerticalAlignment(Element.ALIGN_MIDDLE); Dos_cinco.addCell(Ruta_alm); Puntos.setHorizontalAlignment(Element.ALIGN_CENTER); Puntos.setVerticalAlignment(Element.ALIGN_MIDDLE); Dos_cinco.addCell(Puntos); Observaciones.setHorizontalAlignment(Element.ALIGN_CENTER); Observaciones.setVerticalAlignment(Element.ALIGN_MIDDLE); Dos_cinco.addCell(Observaciones); /*Aqui van las consultas de las Actividades del profesor*/ int periodo = 0; ResultSet rperiodo = lb.executeQuery("SELECT * FROM profesor WHERE id_usuario = " + getUsername()); if (rperiodo.next()) periodo = rperiodo.getInt("periodo"); /**Get actual period***/ String id_obra = null, puntaje = null, comenta = null; ResultSet rb = lb.executeQuery("SELECT * FROM profesor_tiene_obra WHERE " + "id_usuario = '" + getUsername() + "' AND (validado = 1 OR validado=0 ) AND periodo = " + periodo); while (rb.next()) { Dos_cinco.addCell("2.5"); id_obra = rb.getString("id_obra"); Dos_cinco.addCell(id_obra); Anchor anchor = new Anchor("Constancia"); //anchor.setReference("file:///"+rb.getString("ruta_alm")); anchor.setReference(rb.getString("ruta_alm")); Dos_cinco.addCell(anchor); puntaje = rb.getString("puntaje"); Dos_cinco.addCell(puntaje); comenta = rb.getString("comentarios"); Dos_cinco.addCell(comenta); } return Dos_cinco; }
From source file:PDF.GenerateReportActivities.java
private PdfPTable dospuntoonce() throws Exception { PdfPTable Dos_once = new PdfPTable(5); Dos_once.setWidths(new int[] { 2, 2, 3, 2, 3 }); PdfPCell Titulo_tabla = new PdfPCell( new Phrase("Actividad 2.11" + " - Direcciones y Codirecciones", encabezadost)); PdfPCell Num_Actividad = new PdfPCell(new Phrase("Nmero de Actividad")); PdfPCell Tipo_Actividad = new PdfPCell(new Phrase("Identificador de TT o tesis")); PdfPCell Ruta_alm = new PdfPCell(new Phrase("Evidencia")); PdfPCell Puntos = new PdfPCell(new Phrase("Puntos obtenidos")); PdfPCell Observaciones = new PdfPCell(new Phrase("Observaciones")); PdfPCell celda = new PdfPCell(); Titulo_tabla.setHorizontalAlignment(Element.ALIGN_CENTER); Titulo_tabla.setVerticalAlignment(Element.ALIGN_MIDDLE); Titulo_tabla.setBackgroundColor(new BaseColor(153, 0, 76)); Titulo_tabla.setColspan(5); Titulo_tabla.setExtraParagraphSpace(15f); Dos_once.addCell(Titulo_tabla);/*from www. j a v a 2 s . com*/ Num_Actividad.setHorizontalAlignment(Element.ALIGN_CENTER); Num_Actividad.setVerticalAlignment(Element.ALIGN_MIDDLE); Dos_once.addCell(Num_Actividad); Tipo_Actividad.setHorizontalAlignment(Element.ALIGN_CENTER); Tipo_Actividad.setVerticalAlignment(Element.ALIGN_MIDDLE); Dos_once.addCell(Tipo_Actividad); Ruta_alm.setHorizontalAlignment(Element.ALIGN_CENTER); Ruta_alm.setVerticalAlignment(Element.ALIGN_MIDDLE); Dos_once.addCell(Ruta_alm); Puntos.setHorizontalAlignment(Element.ALIGN_CENTER); Puntos.setVerticalAlignment(Element.ALIGN_MIDDLE); Dos_once.addCell(Puntos); Observaciones.setHorizontalAlignment(Element.ALIGN_CENTER); Observaciones.setVerticalAlignment(Element.ALIGN_MIDDLE); Dos_once.addCell(Observaciones); /*Aqui van las consultas de las Actividades del profesor*/ int periodo = 0; ResultSet rperiodo = lb.executeQuery("SELECT * FROM profesor WHERE id_usuario = " + getUsername()); if (rperiodo.next()) periodo = rperiodo.getInt("periodo"); /**Get actual period***/ String id_tt = null, puntaje = null, comenta = null; ResultSet rb = lb.executeQuery("SELECT * FROM profesor_tiene_tt WHERE " + "id_usuario = '" + getUsername() + "' AND (validado = 1 OR validado = 0) AND periodo = " + periodo); while (rb.next()) { Dos_once.addCell("2.11"); id_tt = rb.getString("id_TT"); Dos_once.addCell(id_tt); Anchor anchor = new Anchor("Constancia"); //anchor.setReference("file:///"+rb.getString("ruta_alm")); anchor.setReference(rb.getString("ruta_alm")); Dos_once.addCell(anchor); puntaje = rb.getString("puntaje"); Dos_once.addCell(puntaje); comenta = rb.getString("comentarios"); Dos_once.addCell(comenta); } return Dos_once; }
From source file:PDF.GenerateReportActivities.java
private PdfPTable dospuntodoce() throws Exception { PdfPTable Dos_doce = new PdfPTable(5); Dos_doce.setWidths(new int[] { 2, 2, 3, 2, 3 }); PdfPCell Titulo_tabla = new PdfPCell(new Phrase( "Actividad 2.12" + " - Coordinacin o Participacin en la elaboracin o actualizacin" + "de un plan de estudios", encabezadost));/*from ww w .ja v a 2 s . c om*/ //PdfPCell Num_Actividad = new PdfPCell(new Phrase("Nmero de Actividad")); PdfPCell Tipo_Actividad = new PdfPCell(new Phrase("Identificador de Plan de estudios")); PdfPCell Tipo_parti = new PdfPCell(new Phrase("Tipo de participacin** (Ver parte de abajo)")); PdfPCell Ruta_alm = new PdfPCell(new Phrase("Evidencia")); PdfPCell Puntos = new PdfPCell(new Phrase("Puntos obtenidos")); PdfPCell Observaciones = new PdfPCell(new Phrase("Observaciones")); //PdfPCell celda=new PdfPCell(); Titulo_tabla.setHorizontalAlignment(Element.ALIGN_CENTER); Titulo_tabla.setVerticalAlignment(Element.ALIGN_MIDDLE); Titulo_tabla.setBackgroundColor(new BaseColor(153, 0, 76)); Titulo_tabla.setColspan(5); Titulo_tabla.setExtraParagraphSpace(15f); Dos_doce.addCell(Titulo_tabla); /*Num_Actividad.setHorizontalAlignment(Element.ALIGN_CENTER); Num_Actividad.setVerticalAlignment(Element.ALIGN_MIDDLE); Dos_doce.addCell(Num_Actividad);*/ Tipo_Actividad.setHorizontalAlignment(Element.ALIGN_CENTER); Tipo_Actividad.setVerticalAlignment(Element.ALIGN_MIDDLE); Dos_doce.addCell(Tipo_Actividad); Tipo_parti.setHorizontalAlignment(Element.ALIGN_CENTER); Tipo_parti.setVerticalAlignment(Element.ALIGN_MIDDLE); Dos_doce.addCell(Tipo_parti); Ruta_alm.setHorizontalAlignment(Element.ALIGN_CENTER); Ruta_alm.setVerticalAlignment(Element.ALIGN_MIDDLE); Dos_doce.addCell(Ruta_alm); Puntos.setHorizontalAlignment(Element.ALIGN_CENTER); Puntos.setVerticalAlignment(Element.ALIGN_MIDDLE); Dos_doce.addCell(Puntos); Observaciones.setHorizontalAlignment(Element.ALIGN_CENTER); Observaciones.setVerticalAlignment(Element.ALIGN_MIDDLE); Dos_doce.addCell(Observaciones); /*Aqui van las consultas de las Actividades del profesor*/ int periodo = 0; ResultSet rperiodo = lb.executeQuery("SELECT * FROM profesor WHERE id_usuario = " + getUsername()); if (rperiodo.next()) periodo = rperiodo.getInt("periodo"); /**Get actual period***/ String id_part = null, id_tipo = null, puntaje = null, comenta = null; ResultSet rb = lb.executeQuery("SELECT * FROM profesor_participa_en_plan WHERE " + "id_usuario = '" + getUsername() + "' AND (validado = 1 OR validado = 0) AND periodo = " + periodo /*AND periodo = que el que tiene registrado el profesor*/); while (rb.next()) { //Dos_doce.addCell("2.12"); id_part = rb.getString("id_part"); Dos_doce.addCell(id_part); id_tipo = rb.getString("id_tipo_part"); Dos_doce.addCell(id_tipo);//Agregar a la parte de abajo el tipo de prticicin Anchor anchor = new Anchor("Constancia"); //anchor.setReference("file:///"+rb.getString("ruta_alm")); anchor.setReference("file:///" + rb.getString("ruta_alm")); anchor.setReference("Constancia"); Dos_doce.addCell(anchor); puntaje = rb.getString("puntaje"); Dos_doce.addCell(puntaje); comenta = rb.getString("comentarios"); Dos_doce.addCell(comenta); } return Dos_doce; }