List of usage examples for com.itextpdf.text.pdf PdfPCell setBorderWidthBottom
public void setBorderWidthBottom(final float borderWidthBottom)
From source file:com.gp.cong.logisoft.reports.DeliveryOrderPdfCreator.java
public PdfPTable tablebodyOne(FclBl bl, String freeDate, String localDeliveryOrTransferBy, String po, String referenceNumbers, String realPath) throws Exception { PdfPTable table = new PdfPTable(4); table.setWidths(new float[] { 3f, 2f, 2f, 4f }); table.setWidthPercentage(100);/*ww w. j av a 2s .c o m*/ PdfPCell cell = null; Paragraph p = null; cell = new PdfPCell(); cell.setBorderWidthBottom(0f); p = new Paragraph(8f, "IMPORTING CAREER:", blackFontForAR); cell.addElement(p); table.addCell(cell); cell = new PdfPCell(); cell.setBorderWidthBottom(0f); cell.setColspan(2); p = new Paragraph(8f, "LOCATION:", blackFontForAR); cell.addElement(p); table.addCell(cell); cell = new PdfPCell(); cell.setBorderWidthBottom(0f); p = new Paragraph(9f, "FROM PORT OF ORIGIN AIRPORT:", blackFontForAR); cell.addElement(p); table.addCell(cell); cell = new PdfPCell(); cell.setBorderWidthTop(0f); p = new Paragraph(8f, CommonUtils.isNotEmpty(bl.getSslineName()) ? bl.getSslineName() : "", blackFont); cell.addElement(p); table.addCell(cell); cell = new PdfPCell(); cell.setBorderWidthTop(0f); cell.setColspan(2); p = new Paragraph(8f, CommonUtils.isNotEmpty(bl.getOnwardInlandRouting()) ? bl.getOnwardInlandRouting() : "", blackFont); cell.addElement(p); table.addCell(cell); cell = new PdfPCell(); cell.setBorderWidthTop(0f); p = new Paragraph(8f, CommonUtils.isNotEmpty(bl.getTerminal()) ? bl.getTerminal() : "", blackFont); cell.addElement(p); table.addCell(cell); cell = new PdfPCell(); cell.setBorderWidthBottom(0f); p = new Paragraph(8f, "BILL OR AWB NO: ", blackFontForAR); cell.addElement(p); table.addCell(cell); cell = new PdfPCell(); cell.setBorderWidthBottom(0f); p = new Paragraph(8f, "ARRIVAL DATE:", blackFontForAR); cell.addElement(p); table.addCell(cell); cell = new PdfPCell(); cell.setBorderWidthBottom(0f); p = new Paragraph(9f, "FREE TIME EXP:", blackFontForAR); cell.addElement(p); table.addCell(cell); cell = new PdfPCell(); cell.setBorderWidthBottom(0f); p = new Paragraph(9f, "LOCAL DELIVERY OR TRANSFER BY:", blackFontForAR); cell.addElement(p); table.addCell(cell); cell = new PdfPCell(); cell.setBorderWidthTop(0f); p = new Paragraph(8f, CommonUtils.isNotEmpty(bl.getNewMasterBL()) ? bl.getNewMasterBL() : "", blackFont); cell.addElement(p); table.addCell(cell); cell = new PdfPCell(); cell.setBorderWidthTop(0f); if (bl.getEtaFd() != null) { p = new Paragraph(8f, "" + DateUtils.formatStringDateToAppFormatMMM(bl.getEtaFd()), blackFont); } else { p = new Paragraph(8f, "", blackFont); } cell.addElement(p); table.addCell(cell); cell = new PdfPCell(); cell.setBorderWidthTop(0f); p = new Paragraph(8f, freeDate, blackFont); cell.addElement(p); table.addCell(cell); cell = new PdfPCell(); cell.setBorderWidthTop(0f); p = new Paragraph(8f, localDeliveryOrTransferBy, blackFont); cell.addElement(p); table.addCell(cell); cell = new PdfPCell(); cell.setBorderWidthBottom(0f); p = new Paragraph(8f, "PO#:", blackFontForAR); cell.addElement(p); table.addCell(cell); cell = new PdfPCell(); cell.setBorderWidthBottom(0f); cell.setColspan(2); p = new Paragraph(8f, "HAWB NO:", blackFontForAR); cell.addElement(p); table.addCell(cell); cell = new PdfPCell(); cell.setBorderWidthBottom(0f); p = new Paragraph(8f, "REFERENCE NUMBERS:", blackFontForAR); cell.addElement(p); table.addCell(cell); cell = new PdfPCell(); cell.setBorderWidthTop(0f); p = new Paragraph(8f, po, blackFont); cell.addElement(p); table.addCell(cell); cell = new PdfPCell(); cell.setBorderWidthTop(0f); cell.setColspan(2); p = new Paragraph(8f, CommonUtils.isNotEmpty(bl.getImportAMSHouseBl()) ? bl.getImportAMSHouseBl() : "", blackFont); cell.addElement(p); table.addCell(cell); cell = new PdfPCell(); cell.setBorderWidthTop(0f); p = new Paragraph(8f, referenceNumbers, blackFont); cell.addElement(p); table.addCell(cell); return table; }
From source file:com.gp.cong.logisoft.reports.DeliveryOrderPdfCreator.java
public PdfPTable tablebodyTwo(FclBl bl, String deliveryTo, String deliveryContact, String deliveryEmail, String deliveryPhone, String deliveryFax, String notify, String realPath) throws Exception { PdfPTable table = new PdfPTable(5); table.setWidths(new float[] { 2f, 2f, 2f, 2f, 2f }); table.setWidthPercentage(100);/*from w w w . java2s .c om*/ PdfPCell cell = null; Paragraph p = null; cell = new PdfPCell(); cell.setColspan(2); cell.setBorderWidthBottom(0f); p = new Paragraph(8f, "FOR DELIVERY TO:", blackFontForAR); cell.addElement(p); table.addCell(cell); cell = new PdfPCell(); cell.setBorder(0); table.addCell(cell); cell = new PdfPCell(); cell.setColspan(2); cell.setBorderWidthBottom(0f); p = new Paragraph(8f, "NOTIFY:", blackFontForAR); cell.addElement(p); table.addCell(cell); cell = new PdfPCell(); cell.setColspan(2); cell.setBorderWidthTop(0f); p = new Paragraph(8f, deliveryTo, blackFont); cell.addElement(p); p = new Paragraph(8f, "Contact Name: " + deliveryContact, blackFont); cell.addElement(p); p = new Paragraph(8f, "Phone: " + deliveryPhone, blackFont); cell.addElement(p); p = new Paragraph(8f, "Fax: " + deliveryFax, blackFont); cell.addElement(p); p = new Paragraph(8f, "Email: " + deliveryEmail, blackFont); cell.addElement(p); table.addCell(cell); cell = new PdfPCell(); cell.setBorder(0); cell.setBorderWidthBottom(0f); table.addCell(cell); cell = new PdfPCell(); cell.setColspan(2); cell.setBorderWidthTop(0f); cell.setBorderWidthTop(0f); p = new Paragraph(8f, notify, blackFont); cell.addElement(p); table.addCell(cell); return table; }
From source file:com.gp.cong.logisoft.reports.DeliveryOrderPdfCreator.java
public PdfPTable tablebodyThree(FclBl bl, FclDoorDelivery fclDoorDelivery, MessageResources messageResources, String realPath) throws Exception { PdfPTable table = new PdfPTable(4); table.setWidths(new float[] { 2f, 1f, 5f, 2f }); table.setWidthPercentage(100);/* w ww . jav a2 s . c o m*/ PdfPCell cell = null; Paragraph p = null; cell = new PdfPCell(); p = new Paragraph(8f, "MARKS AND NUMBERS", blackFontForAR); cell.addElement(p); table.addCell(cell); cell = new PdfPCell(); p = new Paragraph(8f, "PIECES", blackFontForAR); cell.addElement(p); table.addCell(cell); cell = new PdfPCell(); p = new Paragraph(8f, "DESCRIPTION OF PACKAGES AND GOODS", blackFontForAR); cell.addElement(p); table.addCell(cell); cell = new PdfPCell(); p = new Paragraph(8f, "GROSS WEIGHT LBS", blackFontForAR); cell.addElement(p); table.addCell(cell); FclBlContainerDAO fclBlContainerDAO = new FclBlContainerDAO(); Set<FclBlContainer> containerSet = bl.getFclcontainer(); for (Iterator iter = containerSet.iterator(); iter.hasNext();) { FclBlContainer fclBlContainer = (FclBlContainer) iter.next(); StringBuilder tempSizeLegened = new StringBuilder(); String sizeLegend = fclBlContainer.getSizeLegend() != null ? (fclBlContainer.getSizeLegend().getCodedesc() != null ? fclBlContainer.getSizeLegend().getCodedesc() : "") : ""; int index = sizeLegend.indexOf("="); if (index != -1) { tempSizeLegened.append("1X"); String tempSize = sizeLegend.substring(index + 1, sizeLegend.length()); if (tempSize.equalsIgnoreCase(messageResources.getMessage("container40HC"))) { tempSize = "40" + "'" + "HC"; } else if (tempSize.equalsIgnoreCase(messageResources.getMessage("container40NOR"))) { tempSize = "40" + "'" + "NOR"; } else { tempSize = tempSize + "'"; } tempSizeLegened.append(tempSize); } else { tempSizeLegened.append(""); } StringBuilder marksNumber = new StringBuilder(); if (null != bl.getPrintContainersOnBL() && bl.getPrintContainersOnBL().equalsIgnoreCase("Yes")) { marksNumber.append(tempSizeLegened); marksNumber.append("\n"); marksNumber.append(fclBlContainer.getTrailerNo() != null ? fclBlContainer.getTrailerNo() : ""); marksNumber.append("\n"); marksNumber.append("SEAL: "); marksNumber.append(" " + fclBlContainer.getSealNo() != null ? fclBlContainer.getSealNo() : ""); } // HelperClass helperClass = new HelperClass(); // // List marksList = helperClass.splitDescrption(helperClass.wrapAddress(fclBlContainer.getMarks()), DESC_SIZE + 1); // if (!marksList.isEmpty()) { // marksNumber.append("\n"); // marksNumber.append(marksList.get(0).toString()); // marksList.remove(0); // } List<FclBlMarks> fclMarksList = fclBlContainerDAO.getPakagesDetails(fclBlContainer.getTrailerNoId()); if (fclMarksList != null && !fclMarksList.isEmpty()) { cell = new PdfPCell(); cell.setBorderWidthBottom(0f); cell.setBorderWidthTop(0f); p = new Paragraph(8f, marksNumber.toString(), blackFont); cell.addElement(p); table.addCell(cell); cell = new PdfPCell(); cell.setBorderWidthBottom(0f); cell.setBorderWidthTop(0f); table.addCell(cell); cell = new PdfPCell(); cell.setBorderWidthBottom(0f); cell.setBorderWidthTop(0f); table.addCell(cell); cell = new PdfPCell(); cell.setBorderWidthBottom(0f); cell.setBorderWidthTop(0f); table.addCell(cell); for (FclBlMarks fclBlmarks : fclMarksList) { cell = new PdfPCell(); cell.setBorderWidthBottom(0f); cell.setBorderWidthTop(0f); table.addCell(cell); cell = new PdfPCell(); cell.setBorderWidthBottom(0f); cell.setBorderWidthTop(0f); p = new Paragraph(8f, "" + fclBlmarks.getNoOfPkgs(), blackFont); cell.addElement(p); table.addCell(cell); cell = new PdfPCell(); cell.setBorderWidthBottom(0f); cell.setBorderWidthTop(0f); p = new Paragraph(8f, fclBlmarks.getDescPckgs(), blackFont); cell.addElement(p); table.addCell(cell); cell = new PdfPCell(); cell.setBorderWidthBottom(0f); cell.setBorderWidthTop(0f); p = new Paragraph(8f, "" + fclBlmarks.getNetweightLbs(), blackFont); cell.addElement(p); table.addCell(cell); } } } cell = new PdfPCell(); cell.setBorderWidthTop(0f); table.addCell(cell); cell = new PdfPCell(); cell.setBorderWidthTop(0f); table.addCell(cell); cell = new PdfPCell(); cell.setBorderWidthTop(0f); table.addCell(cell); cell = new PdfPCell(); cell.setBorderWidthTop(0f); table.addCell(cell); return table; }
From source file:com.gp.cong.logisoft.reports.DeliveryOrderPdfCreator.java
public PdfPTable tablebodyFour(FclBl bl, String billing, String realPath) throws Exception { PdfPTable table = new PdfPTable(5); table.setWidths(new float[] { 3f, 3f, 1f, 2f, 1f }); table.setWidthPercentage(100);//from w w w.j ava 2s. c o m PdfPCell cell = null; Paragraph p = null; cell = new PdfPCell(); cell.setBorder(0); table.addCell(cell); cell = new PdfPCell(); cell.setBorderWidthBottom(0f); p = new Paragraph(8f, "PRE-PAID/COLLECT/3rd PARTY", blackFontForAR); cell.addElement(p); table.addCell(cell); cell = new PdfPCell(); cell.setBorder(0); table.addCell(cell); cell = new PdfPCell(); cell.setColspan(2); cell.setBorder(0); p = new Paragraph(8f, "Received in Good Order By:", blackFontForAR); cell.addElement(p); table.addCell(cell); cell = new PdfPCell(); cell.setFixedHeight(25f); cell.setBorder(0); table.addCell(cell); cell = new PdfPCell(); cell.setBorderWidthTop(0f); p = new Paragraph(8f, billing, blackFont); cell.addElement(p); table.addCell(cell); cell = new PdfPCell(); cell.setBorder(0); table.addCell(cell); cell = new PdfPCell(); cell.setColspan(2); cell.setBorder(0); p = new Paragraph(8f, "", blackFontForAR); cell.addElement(p); table.addCell(cell); cell = new PdfPCell(); cell.setBorder(0); cell.setColspan(3); table.addCell(cell); cell = new PdfPCell(); cell.setColspan(2); cell.setBorderWidthTop(0f); cell.setBorderWidthLeft(0f); cell.setBorderWidthRight(0f); p = new Paragraph(8f, "Signature:", blackFontForAR); cell.addElement(p); table.addCell(cell); return table; }
From source file:com.pdfwriter.PrintInventoryReport.java
public void create(ObservableList list, String totalSales) { try {/*from w w w . j av a 2 s . co m*/ Document document = new Document(PageSize.LETTER); document.setMargins(1, 1, 1, 1); PdfWriter.getInstance(document, new FileOutputStream(filename)); document.open(); Font font2 = new Font(Font.FontFamily.UNDEFINED, 10, Font.BOLD); PdfPTable table = new PdfPTable(5); table.setWidthPercentage(95); table.setWidths(new int[] { 40, 40, 40, 40, 40 }); PdfPCell cell; cell = new PdfPCell(new Phrase("", font2)); cell.setBorder(0); cell.setColspan(8); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setVerticalAlignment(Element.ALIGN_CENTER); cell.setBorderWidthTop(0); cell.setBorderWidthBottom(0); table.addCell(cell); cell = new PdfPCell( new Phrase("KELNOVI SHOPPING BOTIQUE", new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.BOLD))); cell.setColspan(10); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBorder(0); table.addCell(cell); cell = new PdfPCell( new Phrase("Pondol,Loon, Bohol", new Font(Font.FontFamily.HELVETICA, 12, Font.BOLD))); cell.setColspan(10); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBorder(0); table.addCell(cell); cell = new PdfPCell( new Phrase("Phone/Fax#:000-000-000", new Font(Font.FontFamily.UNDEFINED, 9, Font.UNDERLINE))); cell.setColspan(10); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBorder(0); table.addCell(cell); cell = new PdfPCell(new Phrase(" ")); cell.setColspan(10); cell.setRowspan(3); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBorder(0); table.addCell(cell); cell = new PdfPCell(new Phrase("SALES REPORT", new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.BOLD))); cell.setColspan(10); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBorder(0); table.addCell(cell); cell = new PdfPCell(new Phrase(" ")); cell.setColspan(10); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBorder(0); table.addCell(cell); cell = new PdfPCell(new Phrase("NO.")); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBorder(14); cell.setBackgroundColor(BaseColor.GRAY); table.addCell(cell); cell = new PdfPCell(new Phrase("PRODUCT NAME")); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBorder(14); cell.setBackgroundColor(BaseColor.GRAY); table.addCell(cell); cell = new PdfPCell(new Phrase("PRICE")); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBorder(14); cell.setBackgroundColor(BaseColor.GRAY); table.addCell(cell); cell = new PdfPCell(new Phrase("QUANTITY")); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBorder(14); cell.setBackgroundColor(BaseColor.GRAY); table.addCell(cell); cell = new PdfPCell(new Phrase("AMOUNT PAYABLE")); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBorder(14); cell.setBackgroundColor(BaseColor.GRAY); table.addCell(cell); for (int i = 0; i < list.size(); i++) { it = (ProductClass) list.get(i); cell = new PdfPCell(new Phrase("" + it.idProperty().get())); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBorder(14); table.addCell(cell); cell = new PdfPCell(new Phrase("" + it.productDescriptionProperty().get())); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBorder(14); table.addCell(cell); cell = new PdfPCell(new Phrase("" + it.productPriceProperty().get())); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBorder(14); table.addCell(cell); cell = new PdfPCell(new Phrase("" + it.productQtyProperty().get())); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBorder(14); table.addCell(cell); //totalSales.setText(String.format("%,.2f",globalSales)); cell = new PdfPCell(new Phrase( String.format("%,.2f", Double.parseDouble(it.productTotalSalesProperty().get())))); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBorder(14); table.addCell(cell); } cell = new PdfPCell(new Phrase(" ")); cell.setColspan(10); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setBorder(0); table.addCell(cell); cell = new PdfPCell(new Phrase(" ")); cell.setColspan(10); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setBorder(0); table.addCell(cell); cell = new PdfPCell(new Phrase("TOTAL AMOUNT PAYABLE:")); cell.setColspan(10); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setBorder(0); table.addCell(cell); cell = new PdfPCell( new Phrase("Php " + totalSales, new Font(Font.FontFamily.UNDEFINED, 14, Font.UNDERLINE))); cell.setColspan(10); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setBorder(0); table.addCell(cell); cell = new PdfPCell(new Phrase(" ")); cell.setColspan(10); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setBorder(0); table.addCell(cell); cell = new PdfPCell(new Phrase("Approved by:")); cell.setColspan(10); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setBorder(0); table.addCell(cell); cell = new PdfPCell(new Phrase("MICHAEL NOVI MALUENDA II", new Font(Font.FontFamily.UNDEFINED, 14, Font.UNDERLINE))); cell.setColspan(10); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setBorder(0); table.addCell(cell); cell = new PdfPCell(new Phrase("General Manager")); cell.setColspan(10); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setBorder(0); table.addCell(cell); cell = new PdfPCell(new Phrase(" ")); cell.setColspan(10); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setBorder(0); table.addCell(cell); document.add(table); document.close(); openFile(); } catch (Exception e) { e.printStackTrace(); } }
From source file:com.skatettoo.reportes.Generador.java
public String generarPDF() throws Exception { try {/*from w w w.ja va 2 s. c o m*/ String path = FacesContext.getCurrentInstance().getExternalContext().getRealPath("img"); path = path.substring(0, path.indexOf("\\build")); path = path + "\\web\\img\\"; Document doc = new Document(PageSize.A4, 36, 36, 10, 10); PdfPTable tabla = new PdfPTable(4); PdfWriter.getInstance(doc, new FileOutputStream(path + "\\archivo\\reporte.pdf\\")); doc.open(); Image img = Image.getInstance(path + "Skatetoo4.png"); img.scaleAbsolute(40, 40); img.setAlignment(Element.ALIGN_LEFT); doc.add(img); doc.addTitle(this.titulo); doc.addAuthor("\n "); doc.addAuthor("\n "); doc.addAuthor("\n "); doc.addAuthor("\n "); tabla.setWidthPercentage(100); tabla.setWidths(new float[] { 1.4f, 0.8f, 0.8f, 0.8f }); Object font = new Font(Font.FontFamily.HELVETICA, 14, Font.BOLD, BaseColor.WHITE); PdfPCell cell = new PdfPCell(new Phrase("Reporte de tatuadores", (Font) font)); cell.setColspan(4); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setPaddingTop(0f); cell.setPaddingBottom(7f); cell.setBackgroundColor(new BaseColor(0, 0, 0)); cell.setBorder(0); cell.setBorderWidthBottom(2f); tabla.addCell(cell); tabla.addCell("Tatuador"); tabla.addCell("Cantidad de diseos"); tabla.addCell("Citas realizadas"); tabla.addCell("Noticias publicadas"); for (Usuario u : this.getUsu()) { tabla.addCell(u.getNombre() + " " + u.getApellido()); tabla.addCell(String.valueOf(u.getDisenioList().size())); tabla.addCell(String.valueOf(u.getCitaList1().size())); tabla.addCell(String.valueOf(u.getNoticiaList().size())); } doc.add(tabla); doc.bottomMargin(); /* doc.add(new Paragraph("Tatuador mas solicitado")); for(Usuario u : this.getUs()){ doc.add(new Paragraph(u.getNombre() + " " + u.getApellido())); }*/ doc.close(); FacesContext context = FacesContext.getCurrentInstance(); ExternalContext externalContext = context.getExternalContext(); externalContext.responseReset(); externalContext.setResponseContentType("application/pdf"); externalContext.setResponseHeader("Content-Disposition", "attachment;filename=\"reporte.pdf\""); FileInputStream inputStream = new FileInputStream(new File(path + "\\archivo\\reporte.pdf\\")); OutputStream outputStream = externalContext.getResponseOutputStream(); byte[] buffer = new byte[1024]; int length; while ((length = inputStream.read(buffer)) > 0) { outputStream.write(buffer, 0, length); } inputStream.close(); context.responseComplete(); } catch (Exception e) { throw e; } return ""; }
From source file:com.softwaremagico.tm.pdf.small.SmallCharacterSheet.java
License:Open Source License
protected PdfPTable createCharacterContent(CharacterPlayer characterPlayer) throws Exception { float[] widths = { 2.2f, 1f }; PdfPTable mainTable = new PdfPTable(widths); BaseElement.setTablePropierties(mainTable); mainTable.getDefaultCell().setPadding(0); PdfPTable infoTable = CharacterBasicsReducedTableFactory.getCharacterBasicsTable(characterPlayer); PdfPCell infoCell = new PdfPCell(infoTable); infoCell.setBorderWidthTop(0);//from w ww .j a va2s . c o m infoCell.setBorderWidthLeft(0); infoCell.setBorderWidthBottom(1); mainTable.addCell(infoCell); PdfPTable learnedSkillsTable = LearnedSkillsTable.getSkillsTable(characterPlayer, getLanguage()); PdfPCell learnedSkillsCell = new PdfPCell(learnedSkillsTable); learnedSkillsCell.setColspan(2); learnedSkillsCell.setRowspan(3); learnedSkillsCell.setBorderWidthTop(0); learnedSkillsCell.setBorderWidthRight(0); mainTable.addCell(learnedSkillsCell); PdfPTable basicTable = new PdfPTable(new float[] { 5f, 4f }); BaseElement.setTablePropierties(basicTable); basicTable.getDefaultCell().setBorder(0); PdfPTable characteristicsTable = CharacteristicsTableFactory.getCharacteristicsBasicsTable(characterPlayer); PdfPCell characteristicCell = new PdfPCell(characteristicsTable); characteristicCell.setBorderWidthLeft(0); basicTable.addCell(characteristicCell); PdfPTable naturalSkillsTable = NaturalSkillsTable.getSkillsTable(characterPlayer, getLanguage()); PdfPCell naturalSkillsCell = new PdfPCell(naturalSkillsTable); naturalSkillsCell.setBorderWidthRight(0); basicTable.addCell(naturalSkillsCell); PdfPCell basicComposedCell = new PdfPCell(basicTable); basicComposedCell.setBorder(0); mainTable.addCell(basicComposedCell); PdfPTable composedTable = new PdfPTable(new float[] { 5f, 2f }); PdfPTable blessingsTable = new BlessingTable(characterPlayer); PdfPCell blessingsCell = new PdfPCell(blessingsTable); blessingsCell.setBorderWidthLeft(0); blessingsCell.setBorderWidthBottom(1); composedTable.addCell(blessingsCell); PdfPTable beneficesTable = new BeneficesTable(characterPlayer); PdfPCell beneficesCell = new PdfPCell(beneficesTable); beneficesCell.setBorderWidthBottom(1); composedTable.addCell(beneficesCell); PdfPCell composedCell = new PdfPCell(composedTable); composedCell.setRowspan(2); composedCell.setBorder(0); mainTable.addCell(composedCell); PdfPTable armourTable = new ArmourTable(characterPlayer); PdfPCell armourCell = new PdfPCell(armourTable); armourCell.setBorderWidthRight(0); armourCell.setBorderWidthBottom(1); mainTable.addCell(armourCell); PdfPTable fightTable = new PdfPTable(new float[] { 3f, 5f, 1f }); if (characterPlayer != null && (characterPlayer.getSelectedPowers().isEmpty() && !characterPlayer.getCybernetics().isEmpty())) { PdfPTable cyberneticsTable = new CyberneticsTable(characterPlayer); PdfPCell cyberneticsCell = new PdfPCell(cyberneticsTable); cyberneticsCell.setBorderWidthLeft(0); fightTable.addCell(cyberneticsCell); } else { PdfPTable occultismTable = new OccultismTable(characterPlayer, getLanguage()); PdfPCell occultismCell = new PdfPCell(occultismTable); occultismCell.setBorderWidthLeft(0); fightTable.addCell(occultismCell); } PdfPTable weaponsTable = new WeaponsTable(characterPlayer); fightTable.addCell(weaponsTable); PdfPCell victoryPointsCell = new PdfPCell(new VerticalVictoryPointsTable()); victoryPointsCell.setPadding(0); victoryPointsCell.setRowspan(3); fightTable.addCell(victoryPointsCell); PdfPTable vitalityTable = new VitalityTable(characterPlayer); PdfPCell vitalityCell = new PdfPCell(vitalityTable); vitalityCell.setColspan(2); vitalityCell.setBorderWidth(1); fightTable.addCell(vitalityCell); PdfPTable wyrdTable = new WyrdTable(characterPlayer); PdfPCell wyrdCell = new PdfPCell(wyrdTable); wyrdCell.setBorderWidth(1); wyrdCell.setColspan(2); fightTable.addCell(wyrdCell); PdfPCell fightCell = new PdfPCell(fightTable); fightCell.setBorder(0); fightCell.setColspan(2); mainTable.addCell(fightCell); return mainTable; }
From source file:cz.zcu.kiv.eegdatabase.logic.pdf.ReservationPDF.java
License:Apache License
public static PdfPTable formatReservation(Reservation reservation) { int padding = 5; GregorianCalendar created = new GregorianCalendar(); created.setTime(reservation.getCreationTime()); GregorianCalendar startTime = new GregorianCalendar(); startTime.setTime(reservation.getStartTime()); GregorianCalendar endTime = new GregorianCalendar(); endTime.setTime(reservation.getEndTime()); String personName = BookingRoomUtils.formatPersonName(reservation.getPerson()); Font title = FontFactory.getFont("Trebuchet MS", "utf-8", 15, Font.BOLD, new BaseColor(59, 70, 00)); Font header = FontFactory.getFont(FontFactory.TIMES_BOLD, 13, Font.BOLD, BaseColor.BLACK); Font value = FontFactory.getFont(FontFactory.TIMES, 13); PdfPTable table = new PdfPTable(2); PdfPCell cell; Phrase phrase;/*ww w .ja v a2s. c o m*/ phrase = new Phrase("Reservation by " + personName); phrase.setFont(title); cell = new PdfPCell(phrase); cell.setColspan(2); cell.setBorder(0); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBorderWidthTop(1); cell.setBorderWidthLeft(1); cell.setBorderWidthRight(1); cell.setPadding(padding); cell.setPaddingBottom(5); table.addCell(cell); phrase = new Phrase("Date: "); phrase.setFont(header); cell = new PdfPCell(phrase); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBorder(0); cell.setBorderWidthLeft(1); cell.setPadding(padding); table.addCell(cell); phrase = new Phrase(BookingRoomUtils.getDate(startTime)); phrase.setFont(value); cell = new PdfPCell(phrase); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBorder(0); cell.setBorderWidthRight(1); cell.setPadding(padding); table.addCell(cell); phrase = new Phrase("Start: "); phrase.setFont(header); cell = new PdfPCell(phrase); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBorder(0); cell.setBorderWidthLeft(1); cell.setPadding(padding); table.addCell(cell); phrase = new Phrase(BookingRoomUtils.getHoursAndMinutes(startTime)); phrase.setFont(value); cell = new PdfPCell(phrase); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBorder(0); cell.setBorderWidthRight(1); cell.setPadding(padding); table.addCell(cell); phrase = new Phrase("End: "); phrase.setFont(header); cell = new PdfPCell(phrase); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBorder(0); cell.setBorderWidthLeft(1); cell.setBorderWidthBottom(1); cell.setPadding(padding); table.addCell(cell); phrase = new Phrase(BookingRoomUtils.getHoursAndMinutes(endTime)); phrase.setFont(value); cell = new PdfPCell(phrase); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBorder(0); cell.setBorderWidthRight(1); cell.setBorderWidthBottom(1); cell.setPadding(padding); table.addCell(cell); table.setSpacingBefore(10); table.setSpacingAfter(10); return table; }
From source file:es.clinica.veterinaria.albaranes.AlbaranPdf.java
public PdfPTable createTable() throws DocumentException { // a table with three columns int iva = 0, iva2 = 0; DecimalFormat df = new DecimalFormat("0.00"); PdfPTable table = new PdfPTable(5); table.setTotalWidth(new float[] { 55, 150, 200, 70, 70 }); table.setLockedWidth(true);/*w w w . j a va2 s. co m*/ // the cell object // we add a cell with colspan 3 PdfPCell cell = new PdfPCell(new Phrase("CANT.")); cell.setColspan(1); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); cell.setPaddingTop(5); cell.setPaddingBottom(5); table.addCell(cell); cell = new PdfPCell(new Phrase("CONCEPTO")); cell.setColspan(1); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); cell.setPaddingTop(5); cell.setPaddingBottom(5); table.addCell(cell); cell = new PdfPCell(new Phrase("DESCRIPCIN")); cell.setColspan(1); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); cell.setPaddingTop(5); cell.setPaddingBottom(5); table.addCell(cell); cell = new PdfPCell(new Phrase("PRECIO")); cell.setColspan(1); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); cell.setPaddingTop(5); cell.setPaddingBottom(5); table.addCell(cell); cell = new PdfPCell(new Phrase("IMPORTE")); cell.setColspan(1); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); cell.setPaddingTop(5); cell.setPaddingBottom(5); table.addCell(cell); HashSet<VentaLinea> listVenta = getVenta().getVenta_lineas(); for (VentaLinea vlinea : listVenta) { if (vlinea.getTipo() == 1) { if (vlinea.getProducto().getIva() != null) { iva2 = vlinea.getProducto().getIva().getValor(); // System.out.println("IVA: " +iva2); } } else if (vlinea.getTipo() == 2) { if (vlinea.getServicio().getIva() != null) { iva2 = vlinea.getServicio().getIva().getValor(); // System.out.println("IVA: " +iva2); } } //Para hacer el calculo nos vamos a quedar con el IVA mayor if (iva < iva2) { iva = iva2; } cell = new PdfPCell(new Phrase(vlinea.getCantidad() + "", small)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setPaddingBottom(5); table.addCell(cell); table.addCell(new PdfPCell(new Phrase(vlinea.getNombre(), small))); String descripcion = vlinea.getDescripcion(); if (descripcion == null || "null".equals(descripcion)) { table.addCell(new PdfPCell(new Phrase(" ", small))); // System.out.println("null:" + descripcion); } else { table.addCell(new PdfPCell(new Phrase(descripcion, small))); // System.out.println("!null:" + descripcion); } cell = new PdfPCell(new Phrase(df.format(vlinea.getPvp()) + " ", small)); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setPaddingBottom(5); table.addCell(cell); cell = new PdfPCell(new Phrase(df.format(vlinea.getPreciototalNoIVA()) + " ", small)); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setPaddingBottom(5); table.addCell(cell); } cell = new PdfPCell(new Phrase(" ")); cell.setColspan(1); cell.setBorderWidthBottom(0); cell.setBorderWidthLeft(0); cell.setBorder(0); cell.setBorderColorLeft(BaseColor.WHITE); cell.setBorderColorBottom(BaseColor.WHITE); cell.setPaddingBottom(5); table.addCell(cell); table.addCell(cell); table.addCell(cell); cell = new PdfPCell(new Phrase("SUMA")); cell.setColspan(1); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); cell.setPaddingBottom(5); table.addCell(cell); cell = new PdfPCell(new Phrase(df.format(venta.getCostesinIva()) + " ")); cell.setColspan(1); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setPaddingBottom(5); table.addCell(cell); /* IVA */ cell = new PdfPCell(new Phrase(" ")); cell.setColspan(1); cell.setBorderWidthBottom(0); cell.setBorderWidthLeft(0); cell.setBorder(0); cell.setBorderColorLeft(BaseColor.WHITE); cell.setBorderColorBottom(BaseColor.WHITE); cell.setPaddingBottom(5); table.addCell(cell); table.addCell(cell); table.addCell(cell); // float costetotal = (float) (venta.getCoste() * (1+(iva*0.01))); cell = new PdfPCell(new Phrase("IVA " + iva + "%")); cell.setColspan(1); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); cell.setPaddingBottom(5); table.addCell(cell); cell = new PdfPCell(new Phrase(df.format(venta.getIvas()) + " ")); cell.setColspan(1); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setPaddingBottom(5); table.addCell(cell); /* COSTE TOTAL */ cell = new PdfPCell(new Phrase(" ")); cell.setColspan(1); cell.setBorderWidthBottom(0); cell.setBorderWidthLeft(0); cell.setBorder(0); cell.setBorderColorLeft(BaseColor.WHITE); cell.setBorderColorBottom(BaseColor.WHITE); cell.setPaddingBottom(5); table.addCell(cell); table.addCell(cell); table.addCell(cell); cell = new PdfPCell(new Phrase("TOTAL")); cell.setColspan(1); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); cell.setPaddingBottom(5); table.addCell(cell); cell = new PdfPCell(new Phrase(df.format(venta.getCoste()) + " ")); cell.setColspan(1); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setPaddingBottom(5); table.addCell(cell); return table; }
From source file:es.clinica.veterinaria.facturas.FacturaPdf.java
public PdfPTable createTable() throws DocumentException { // a table with three columns int iva = 0, iva2 = 0; DecimalFormat df = new DecimalFormat("0.00"); PdfPTable table = new PdfPTable(6); table.setTotalWidth(new float[] { 50, 65, 150, 150, 65, 70 }); table.setLockedWidth(true);// ww w . j a v a2 s.c o m // the cell object // we add a cell with colspan 3 PdfPCell cell = new PdfPCell(new Phrase("CANT.")); cell.setColspan(1); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); cell.setPaddingTop(5); cell.setPaddingBottom(5); table.addCell(cell); cell = new PdfPCell(new Phrase("FECHA")); cell.setColspan(1); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); cell.setPaddingTop(5); cell.setPaddingBottom(5); table.addCell(cell); cell = new PdfPCell(new Phrase("CONCEPTO")); cell.setColspan(1); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); cell.setPaddingTop(5); cell.setPaddingBottom(5); table.addCell(cell); cell = new PdfPCell(new Phrase("DESCRIPCIN")); cell.setColspan(1); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); cell.setPaddingTop(5); cell.setPaddingBottom(5); table.addCell(cell); cell = new PdfPCell(new Phrase("PRECIO")); cell.setColspan(1); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); cell.setPaddingTop(5); cell.setPaddingBottom(5); table.addCell(cell); cell = new PdfPCell(new Phrase("IMPORTE")); cell.setColspan(1); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); cell.setPaddingTop(5); cell.setPaddingBottom(5); table.addCell(cell); HashSet<Venta> ventas = this.getFactura().getVentas(); for (Venta venta : ventas) { HashSet<VentaLinea> listVenta = venta.getVenta_lineas(); for (VentaLinea vlinea : listVenta) { if (vlinea.getTipo() == 1) { if (vlinea.getProducto().getIva() != null) { iva2 = vlinea.getProducto().getIva().getValor(); // System.out.println("IVA: " +iva2); } } else if (vlinea.getTipo() == 2) { if (vlinea.getServicio().getIva() != null) { iva2 = vlinea.getServicio().getIva().getValor(); // System.out.println("IVA: " +iva2); } } //Para hacer el calculo nos vamos a quedar con el IVA mayor if (iva < iva2) { iva = iva2; } cell = new PdfPCell(new Phrase(vlinea.getCantidad() + "", small)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setPaddingBottom(5); table.addCell(cell); cell = new PdfPCell( new Phrase(new SimpleDateFormat("dd-MM-yyyy").format(vlinea.getFecha()), small)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setPaddingBottom(5); table.addCell(cell); if (vlinea.getTipo() == 2) { //Servicio table.addCell(new PdfPCell(new Phrase(vlinea.getNombre(), small))); String descripcion = vlinea.getDescripcion(); if (descripcion == null || "null".equals(descripcion)) { table.addCell(new PdfPCell(new Phrase(" ", small))); // System.out.println("null:" + descripcion); } else { table.addCell(new PdfPCell(new Phrase(descripcion, small))); // System.out.println("!null:" + descripcion); } } else if (vlinea.getTipo() == 1) { //Producto //Si el producto es Tratamiento if (vlinea.getProducto().getFamilia().isTratamiento()) { table.addCell(new PdfPCell(new Phrase("Tratamiento", small))); table.addCell(new PdfPCell(new Phrase("", small))); } else { table.addCell(new PdfPCell(new Phrase(vlinea.getNombre(), small))); String descripcion = vlinea.getDescripcion(); if (descripcion == null || "null".equals(descripcion)) { table.addCell(new PdfPCell(new Phrase(" ", small))); // System.out.println("null:" + descripcion); } else { table.addCell(new PdfPCell(new Phrase(descripcion, small))); // System.out.println("!null:" + descripcion); } } } cell = new PdfPCell(new Phrase(df.format(vlinea.getPvp()) + " ", small)); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setPaddingBottom(5); table.addCell(cell); cell = new PdfPCell(new Phrase(df.format(vlinea.getPreciototalNoIVA()) + " ", small)); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setPaddingBottom(5); table.addCell(cell); } } cell = new PdfPCell(new Phrase(" ")); cell.setColspan(1); cell.setBorderWidthBottom(0); cell.setBorderWidthLeft(0); cell.setBorder(0); cell.setBorderColorLeft(BaseColor.WHITE); cell.setBorderColorBottom(BaseColor.WHITE); cell.setPaddingBottom(5); table.addCell(cell); table.addCell(cell); table.addCell(cell); table.addCell(cell); cell = new PdfPCell(new Phrase("SUMA")); cell.setColspan(1); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); cell.setPaddingBottom(5); table.addCell(cell); cell = new PdfPCell(new Phrase(df.format(factura.getCoste()) + " ", smallBold)); cell.setColspan(1); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setPaddingBottom(5); table.addCell(cell); /* IVA */ cell = new PdfPCell(new Phrase(" ")); cell.setColspan(1); cell.setBorderWidthBottom(0); cell.setBorderWidthLeft(0); cell.setBorder(0); cell.setBorderColorLeft(BaseColor.WHITE); cell.setBorderColorBottom(BaseColor.WHITE); cell.setPaddingBottom(5); table.addCell(cell); table.addCell(cell); table.addCell(cell); table.addCell(cell); float costetotal = (float) (factura.getCostetotal()); cell = new PdfPCell(new Phrase("IVA " + iva + "%")); cell.setColspan(1); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); cell.setPaddingBottom(5); table.addCell(cell); cell = new PdfPCell(new Phrase(df.format(factura.getIvas()) + " ", smallBold)); cell.setColspan(1); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setPaddingBottom(5); table.addCell(cell); /* COSTE TOTAL */ cell = new PdfPCell(new Phrase(" ")); cell.setColspan(1); cell.setBorderWidthBottom(0); cell.setBorderWidthLeft(0); cell.setBorder(0); cell.setBorderColorLeft(BaseColor.WHITE); cell.setBorderColorBottom(BaseColor.WHITE); cell.setPaddingBottom(5); table.addCell(cell); table.addCell(cell); table.addCell(cell); table.addCell(cell); cell = new PdfPCell(new Phrase("TOTAL")); cell.setColspan(1); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBackgroundColor(BaseColor.LIGHT_GRAY); cell.setPaddingBottom(5); table.addCell(cell); cell = new PdfPCell(new Phrase(df.format(costetotal) + " ", smallBold)); cell.setColspan(1); cell.setHorizontalAlignment(Element.ALIGN_RIGHT); cell.setPaddingBottom(5); table.addCell(cell); return table; }