List of usage examples for com.itextpdf.text.pdf PdfPTable PdfPTable
public PdfPTable(final PdfPTable table)
PdfPTable
. From source file:com.gp.cong.logisoft.lcl.report.LclAllBLPdfCreator.java
public void setCaribbenAndNonCaribben(LclBlPiece lclBlPiece, String impKeyValue, String metKeyValue, boolean iscaribben) throws Exception { String AWImp = "0.000", AVImp = "0.000"; String AWMet = "0.000", AVMet = "0.000"; if (lclBlPiece.getActualWeightImperial() != null) { AWImp = "Y".equalsIgnoreCase(impKeyValue) ? NumberUtils.convertToThreeDecimalhash(lclBlPiece.getActualWeightImperial().doubleValue()) : lclBlPiece.getActualWeightImperial().setScale(0, BigDecimal.ROUND_HALF_UP).toString(); }/*from www . j a v a 2s . c om*/ if (lclBlPiece.getActualVolumeImperial() != null) { AVImp = "Y".equalsIgnoreCase(impKeyValue) ? NumberUtils.convertToThreeDecimalhash(lclBlPiece.getActualVolumeImperial().doubleValue()) : lclBlPiece.getActualVolumeImperial().setScale(0, BigDecimal.ROUND_HALF_UP).toString(); } if ("N".equalsIgnoreCase(metKeyValue) && lclBlPiece.getActualWeightMetric() != null) { AWMet = NumberUtils.convertToThreeDecimalhash(lclBlPiece.getActualWeightMetric().doubleValue()); } if ("N".equalsIgnoreCase(metKeyValue) && lclBlPiece.getActualVolumeMetric() != null) { AVMet = NumberUtils.convertToThreeDecimalhash(lclBlPiece.getActualVolumeMetric().doubleValue()); } Paragraph p = null; cell = new PdfPCell(); cell.setBorder(0); cell.setBorderWidthLeft(0.6f); PdfPTable inner_Table = new PdfPTable(1); inner_Table.setWidthPercentage(100f); PdfPCell inner_Cell = null; inner_Cell = new PdfPCell(); inner_Cell.setBorder(0); inner_Cell.setBorderWidthBottom(0.6f); p = new Paragraph(6f, iscaribben ? "LBS" : "KGS", blackBoldFont65); p.setAlignment(Element.ALIGN_LEFT); inner_Cell.addElement(p); inner_Table.addCell(inner_Cell); inner_Cell = new PdfPCell(); inner_Cell.setBorder(0); p = new Paragraph(7f, iscaribben ? AWImp : AWMet, totalFontQuote); p.setAlignment(Element.ALIGN_CENTER); inner_Cell.addElement(p); inner_Table.addCell(inner_Cell); inner_Cell = new PdfPCell(); inner_Cell.setBorder(0); inner_Cell.setPaddingBottom(18f); inner_Table.addCell(inner_Cell); inner_Cell = new PdfPCell(); inner_Cell.setBorder(0); if ("N".equalsIgnoreCase(metKeyValue)) { inner_Cell.setBorderWidthBottom(0.6f); p = new Paragraph(6f, iscaribben ? "KGS" : "LBS", blackBoldFont65); } else { AWMet = ""; AWImp = ""; p = new Paragraph(6f, "", blackBoldFont65); } p.setAlignment(Element.ALIGN_LEFT); inner_Cell.addElement(p); inner_Table.addCell(inner_Cell); inner_Cell = new PdfPCell(); inner_Cell.setBorder(0); p = new Paragraph(7f, iscaribben ? AWMet : AWImp, totalFontQuote); p.setAlignment(Element.ALIGN_CENTER); inner_Cell.addElement(p); inner_Table.addCell(inner_Cell); if (commodity_count != lclBlPiecesList.size()) { inner_Cell = new PdfPCell(); inner_Cell.setBorder(0); inner_Cell.setPaddingBottom(16f); inner_Table.addCell(inner_Cell); } cell.addElement(inner_Table); table.addCell(cell); cell = new PdfPCell(); cell.setBorder(0); cell.setBorderWidthLeft(0.6f); inner_Table = new PdfPTable(1); inner_Table.setWidthPercentage(100f); inner_Cell = new PdfPCell(); inner_Cell.setBorder(0); inner_Cell.setBorderWidthBottom(0.6f); p = new Paragraph(6f, iscaribben ? "CU.FT." : "CBM", blackBoldFont65); p.setAlignment(Element.ALIGN_LEFT); inner_Cell.addElement(p); inner_Table.addCell(inner_Cell); inner_Cell = new PdfPCell(); inner_Cell.setBorder(0); p = new Paragraph(7f, iscaribben ? AVImp : AVMet, totalFontQuote); p.setAlignment(Element.ALIGN_CENTER); inner_Cell.addElement(p); inner_Table.addCell(inner_Cell); inner_Cell = new PdfPCell(); inner_Cell.setBorder(0); inner_Cell.setPaddingBottom(18f); inner_Table.addCell(inner_Cell); inner_Cell = new PdfPCell(); inner_Cell.setBorder(0); if ("N".equalsIgnoreCase(metKeyValue)) { inner_Cell.setBorderWidthBottom(0.6f); p = new Paragraph(6f, iscaribben ? "CBM" : "CU.FT.", blackBoldFont65); } else { AVMet = ""; AVImp = ""; p = new Paragraph(6f, "", blackBoldFont65); } p.setAlignment(Element.ALIGN_LEFT); inner_Cell.addElement(p); inner_Table.addCell(inner_Cell); inner_Cell = new PdfPCell(); inner_Cell.setBorder(0); p = new Paragraph(7f, iscaribben ? AVMet : AVImp, totalFontQuote); p.setAlignment(Element.ALIGN_CENTER); inner_Cell.addElement(p); inner_Table.addCell(inner_Cell); if (commodity_count != lclBlPiecesList.size()) { inner_Cell = new PdfPCell(); inner_Cell.setBorder(0); inner_Cell.setPaddingBottom(16f); inner_Table.addCell(inner_Cell); } cell.addElement(inner_Table); table.addCell(cell); }
From source file:com.gp.cong.logisoft.lcl.report.LclAllBLPdfCreator.java
public PdfPTable appendChargesAndCommodity() throws Exception { LclBlAcDAO lclBlAcDAO = new LclBlAcDAO(); List<LclBlPiece> lclBlPiecesList = lclbl.getLclFileNumber().getLclBlPieceList(); List<LclBlAc> chargeList = lclBlAcDAO.getLclCostByFileNumberAsc(lclbl.getFileNumberId()); PdfPTable chargeTable = new PdfPTable(6); PdfPCell chargeCell = null;// www . j a va 2s.c o m chargeTable.setWidths(new float[] { 3.8f, 1.5f, .8f, 3.8f, 1.5f, .8f }); chargeTable.setWidthPercentage(100f); Paragraph p = null; this.total_ar_amount = 0.00; this.total_ar_col_amount = 0.00; this.total_ar_ppd_amount = 0.00; List<LinkedHashMap<String, PdfPCell>> listChargeMap = null; LinkedHashMap<String, PdfPCell> chargeMap = null; if ("BOTH".equalsIgnoreCase(billType)) { listChargeMap = this.getTotalChargesList(chargeList, lclBlPiecesList); } else { chargeMap = this.getTotalCharges(chargeList, lclBlPiecesList); } LclBlAc blAC = lclBlAcDAO.manualChargeValidate(lclbl.getFileNumberId(), "OCNFRT", false); if (lclBlPiecesList != null && lclBlPiecesList.size() > 0 && blAC != null) { BigDecimal CFT = BigDecimal.ZERO, LBS = BigDecimal.ZERO; LclBlPiece lclBlPiece = (LclBlPiece) lclBlPiecesList.get(0); if (blAC.getRatePerUnitUom() != null) { CFT = blAC.getRatePerUnitUom().equalsIgnoreCase("FRV") ? blAC.getRatePerVolumeUnit() : BigDecimal.ZERO; LBS = blAC.getRatePerUnitUom().equalsIgnoreCase("FRW") ? blAC.getRatePerWeightUnit() : BigDecimal.ZERO; } if (CFT != BigDecimal.ZERO || LBS != BigDecimal.ZERO) { StringBuilder cbmValues = new StringBuilder(); if (CFT != BigDecimal.ZERO && lclBlPiece.getActualVolumeImperial() != null) { cbmValues.append(NumberUtils .convertToThreeDecimalhash(lclBlPiece.getActualVolumeImperial().doubleValue())); } if (LBS != BigDecimal.ZERO && lclBlPiece.getActualWeightImperial() != null) { cbmValues.append(NumberUtils .convertToThreeDecimalhash(lclBlPiece.getActualWeightImperial().doubleValue())); } if (null != blAC.getArAmount() && blAC.getArAmount().toString().equalsIgnoreCase(OCNFRT_Total)) { if (CFT == BigDecimal.ZERO) { cbmValues.append(" LBS @ ").append(LBS).append(" PER 100 LBS @ ") .append(blAC.getArAmount()); } else { cbmValues.append(" CFT @ ").append(CFT).append(" PER CFT @").append(blAC.getArAmount()); } chargeCell = new PdfPCell(); chargeCell.setBorder(0); chargeCell.setColspan(6); chargeTable.addCell(chargeCell); chargeCell = new PdfPCell(); chargeCell.setBorder(0); chargeCell.setColspan(6); p = new Paragraph(2f, "" + cbmValues.toString().toUpperCase(), totalFontQuote); p.add(new Paragraph(2f, null != lclBlPiece && null != lclBlPiece.getCommodityType() ? " Commodity# " + lclBlPiece.getCommodityType().getCode() : " Commodity#", totalFontQuote)); p.setAlignment(Element.ALIGN_LEFT); chargeCell.addElement(p); chargeTable.addCell(chargeCell); } } } this.OCNFRT_Total = ""; LinkedHashMap<String, PdfPCell> left_chargeMap = new LinkedHashMap<String, PdfPCell>(); LinkedHashMap<String, PdfPCell> right_chargeMap = new LinkedHashMap<String, PdfPCell>(); if ("BOTH".equalsIgnoreCase(billType) && listChargeMap != null && !listChargeMap.isEmpty()) { if (listChargeMap.size() > 1) { if (listChargeMap.get(0).size() > 6 || listChargeMap.get(1).size() > 6) { chargeMap = new LinkedHashMap<String, PdfPCell>(); chargeMap.putAll(listChargeMap.get(0)); chargeMap.putAll(listChargeMap.get(1)); int count = 0, size = chargeMap.size() / 2 <= 6 ? 6 : chargeMap.size() / 2; for (String key : chargeMap.keySet()) { if (count++ < size) { left_chargeMap.put(key, chargeMap.get(key)); } else { right_chargeMap.put(key, chargeMap.get(key)); } } } else { left_chargeMap.putAll(listChargeMap.get(0)); right_chargeMap.putAll(listChargeMap.get(1)); } } else { int count = 0, size = listChargeMap.get(0).size() / 2 <= 6 ? 6 : listChargeMap.get(0).size() / 2; for (String key : listChargeMap.get(0).keySet()) { if (count++ < size) { left_chargeMap.put(key, listChargeMap.get(0).get(key)); } else { right_chargeMap.put(key, listChargeMap.get(0).get(key)); } } } } else if (chargeMap != null && !chargeMap.isEmpty()) { int count = 0, size = chargeMap.size() / 2 <= 6 ? 6 : chargeMap.size() / 2; for (String key : chargeMap.keySet()) { if (count++ < size) { left_chargeMap.put(key, chargeMap.get(key)); } else { right_chargeMap.put(key, chargeMap.get(key)); } } } if (!left_chargeMap.isEmpty()) { String chargeDesc = null; PdfPTable innner_chargeTable = new PdfPTable(2); innner_chargeTable.setWidthPercentage(100f); PdfPCell inner_chargeCell = null; chargeCell = new PdfPCell(); chargeCell.setBorder(0); chargeCell.setColspan(3); chargeCell.setBorderWidthRight(0.6f); chargeCell.setPadding(0); innner_chargeTable = new PdfPTable(2); innner_chargeTable.setWidths(new float[] { 5f, 3f }); if (!left_chargeMap.isEmpty()) { for (String key : left_chargeMap.keySet()) { inner_chargeCell = new PdfPCell(); inner_chargeCell.setBorder(0); inner_chargeCell.setPaddingLeft(-15); chargeDesc = key.substring(key.indexOf("#") + 1, key.indexOf("$")); inner_chargeCell.addElement(new Paragraph(7f, "" + chargeDesc, totalFontQuote)); innner_chargeTable.addCell(inner_chargeCell); inner_chargeCell = new PdfPCell(); inner_chargeCell.setBorder(0); inner_chargeCell = left_chargeMap.get(key); innner_chargeTable.addCell(inner_chargeCell); } } chargeCell.addElement(innner_chargeTable); chargeTable.addCell(chargeCell); chargeCell = new PdfPCell(); chargeCell.setBorder(0); chargeCell.setColspan(3); chargeCell.setPadding(0); innner_chargeTable = new PdfPTable(2); innner_chargeTable.setWidths(new float[] { 5f, 3f }); if (!left_chargeMap.isEmpty()) { for (String key : right_chargeMap.keySet()) { inner_chargeCell = new PdfPCell(); inner_chargeCell.setBorder(0); inner_chargeCell.setPaddingLeft(-15); chargeDesc = key.substring(key.indexOf("#") + 1, key.indexOf("$")); inner_chargeCell.addElement(new Paragraph(7f, "" + chargeDesc, totalFontQuote)); innner_chargeTable.addCell(inner_chargeCell); inner_chargeCell = new PdfPCell(); inner_chargeCell.setBorder(0); inner_chargeCell = right_chargeMap.get(key); innner_chargeTable.addCell(inner_chargeCell); } } chargeCell.addElement(innner_chargeTable); chargeTable.addCell(chargeCell); } else { this.total_ar_amount = 0.00; this.total_ar_ppd_amount = 0.00; this.total_ar_col_amount = 0.00; } String acctNo = ""; String billToParty = ""; if (CommonFunctions.isNotNull(lclbl.getBillToParty()) && CommonUtils.isNotEmpty(lclbl.getBillToParty())) { if (lclbl.getBillToParty().equalsIgnoreCase("T") && CommonFunctions.isNotNull(lclbl.getThirdPartyAcct())) { billToParty = "THIRD PARTY"; acctNo = lclbl.getThirdPartyAcct().getAccountno(); } else if (lclbl.getBillToParty().equalsIgnoreCase("S") && CommonFunctions.isNotNull(lclbl.getShipAcct())) { billToParty = "SHIPPER"; acctNo = lclbl.getShipAcct().getAccountno(); } else if (lclbl.getBillToParty().equalsIgnoreCase("F") && CommonFunctions.isNotNull(lclbl.getFwdAcct())) { billToParty = "FORWARDER"; acctNo = lclbl.getFwdAcct().getAccountno(); } else if (lclbl.getBillToParty().equalsIgnoreCase("A") && CommonFunctions.isNotNull(lclbl.getAgentAcct())) { billToParty = "AGENT"; if (lclBooking.getBookingType().equals("T") && lclbl.getLclFileNumber().getLclBookingImport().getExportAgentAcctNo() != null) { acctNo = lclbl.getLclFileNumber().getLclBookingImport().getExportAgentAcctNo().getAccountno(); } else if (lclBooking.getAgentAcct() != null) { acctNo = lclBooking.getAgentAcct().getAccountno(); } else { acctNo = lclbl.getAgentAcct().getAccountno(); } } } if ("BOTH".equalsIgnoreCase(billType)) { if (this.total_ar_ppd_amount != 0.00 || this.total_ar_col_amount != 0.00) { if (this.total_ar_ppd_amount != 0.00) { if (CommonFunctions.isNotNullOrNotEmpty(ppdBillToSet) && ppdBillToSet.size() == 1) { for (String billTo : ppdBillToSet) { arBillToParty = billTo; break; } if (arBillToParty.equalsIgnoreCase("T")) { billToParty = "THIRD PARTY"; acctNo = null != lclbl.getThirdPartyAcct() ? lclbl.getThirdPartyAcct().getAccountno() : acctNo; } else if (arBillToParty.equalsIgnoreCase("S")) { acctNo = null != lclbl.getShipAcct() ? lclbl.getShipAcct().getAccountno() : acctNo; billToParty = "SHIPPER"; } else if (arBillToParty.equalsIgnoreCase("F")) { billToParty = "FORWARDER"; acctNo = null != lclbl.getFwdAcct() ? lclbl.getFwdAcct().getAccountno() : acctNo; } } else { acctNo = null; } chargeCell = new PdfPCell(); chargeCell.setBorder(0); chargeCell.setColspan(2); p = new Paragraph(7f, "T O T A L (USA)", totalFontQuote); p.setAlignment(Element.ALIGN_LEFT); chargeCell.addElement(p); chargeTable.addCell(chargeCell); chargeCell = new PdfPCell(); chargeCell.setColspan(4); chargeCell.setBorder(0); if (null != acctNo) { p = new Paragraph(7f, "$" + NumberUtils.convertToTwoDecimal(this.total_ar_ppd_amount) + " PPD " + billToParty + "-" + acctNo, totalFontQuote); } else { p = new Paragraph(7f, "$" + NumberUtils.convertToTwoDecimal(this.total_ar_ppd_amount) + " PPD ", totalFontQuote); } p.setAlignment(Element.ALIGN_LEFT); chargeCell.addElement(p); chargeTable.addCell(chargeCell); } if (this.total_ar_col_amount != 0.00) { String colAcctNo = ""; if (lclBooking.getBookingType().equals("T") && lclbl.getLclFileNumber().getLclBookingImport().getExportAgentAcctNo() != null) { colAcctNo = lclbl.getLclFileNumber().getLclBookingImport().getExportAgentAcctNo() .getAccountno(); } else if (lclBooking.getAgentAcct() != null) { colAcctNo = lclBooking.getAgentAcct().getAccountno(); } else if (lclbl.getAgentAcct() != null) { colAcctNo = lclbl.getAgentAcct().getAccountno(); } chargeCell = new PdfPCell(); chargeCell.setBorder(0); chargeCell.setColspan(2); if (this.total_ar_ppd_amount == 0.00) { p = new Paragraph(7f, "T O T A L (USA)", totalFontQuote); } else { p = new Paragraph(7f, "", totalFontQuote); } p.setAlignment(Element.ALIGN_LEFT); chargeCell.addElement(p); chargeTable.addCell(chargeCell); chargeCell = new PdfPCell(); chargeCell.setColspan(4); chargeCell.setBorder(0); p = new Paragraph(7f, "$" + NumberUtils.convertToTwoDecimal(this.total_ar_col_amount) + " COL AGENT-" + colAcctNo, totalFontQuote); p.setAlignment(Element.ALIGN_LEFT); chargeCell.addElement(p); chargeTable.addCell(chargeCell); } NumberFormat numberFormat = new DecimalFormat("###,###,##0.000"); if (this.total_ar_ppd_amount != 0.00) { String totalString1 = numberFormat.format(this.total_ar_ppd_amount).replaceAll(",", ""); int indexdot = totalString1.indexOf("."); String beforeDecimal = totalString1.substring(0, indexdot); String afterDecimal = totalString1.substring(indexdot + 1, totalString1.length()); chargeCell = new PdfPCell(); chargeCell.setColspan(6); chargeCell.setBorder(0); p = new Paragraph(7f, "" + ConvertNumberToWords.convert(Integer.parseInt(beforeDecimal)) + " DOLLARS AND " + StringUtils.removeEnd(afterDecimal, "0") + " CENTS", totalFontQuote); chargeCell.setHorizontalAlignment(Element.ALIGN_CENTER); chargeCell.addElement(p); chargeTable.addCell(chargeCell); } if (this.total_ar_col_amount != 0.00) { String totalString1 = numberFormat.format(this.total_ar_col_amount).replaceAll(",", ""); int indexdot = totalString1.indexOf("."); String beforeDecimal = totalString1.substring(0, indexdot); String afterDecimal = totalString1.substring(indexdot + 1, totalString1.length()); chargeCell = new PdfPCell(); chargeCell.setColspan(6); chargeCell.setBorder(0); p = new Paragraph(7f, "" + ConvertNumberToWords.convert(Integer.parseInt(beforeDecimal)) + " DOLLARS AND " + StringUtils.removeEnd(afterDecimal, "0") + " CENTS", totalFontQuote); chargeCell.setHorizontalAlignment(Element.ALIGN_CENTER); chargeCell.addElement(p); chargeTable.addCell(chargeCell); } } } else if (this.total_ar_amount != 0.00) { chargeCell = new PdfPCell(); chargeCell.setBorder(0); chargeCell.setColspan(2); chargeCell.setPaddingTop(8f); p = new Paragraph(7f, "T O T A L (USA)", totalFontQuote); p.setAlignment(Element.ALIGN_LEFT); chargeCell.addElement(p); chargeTable.addCell(chargeCell); chargeCell = new PdfPCell(); chargeCell.setColspan(4); chargeCell.setBorder(0); chargeCell.setPaddingTop(8f); p = new Paragraph(7f, "$" + NumberUtils.convertToTwoDecimal(this.total_ar_amount) + " " + billType + " " + billToParty + "-" + acctNo, totalFontQuote); p.setAlignment(Element.ALIGN_LEFT); chargeCell.addElement(p); chargeTable.addCell(chargeCell); NumberFormat numberFormat = new DecimalFormat("###,###,##0.000"); String totalString1 = numberFormat.format(this.total_ar_amount).replaceAll(",", ""); int indexdot = totalString1.indexOf("."); String beforeDecimal = totalString1.substring(0, indexdot); String afterDecimal = totalString1.substring(indexdot + 1, totalString1.length()); chargeCell = new PdfPCell(); chargeCell.setColspan(6); chargeCell.setBorder(0); p = new Paragraph(7f, "" + ConvertNumberToWords.convert(Integer.parseInt(beforeDecimal)) + " DOLLARS AND " + StringUtils.removeEnd(afterDecimal, "0") + " CENTS", totalFontQuote); chargeCell.setHorizontalAlignment(Element.ALIGN_CENTER); chargeCell.addElement(p); chargeTable.addCell(chargeCell); } chargeCell = new PdfPCell(); chargeCell.setBorder(0); chargeCell.setColspan(4); p = new Paragraph(5f, "" + sailDateFormat, totalFontQuote); p.setAlignment(Element.ALIGN_LEFT); chargeCell.addElement(p); chargeTable.addCell(chargeCell); chargeCell = new PdfPCell(); chargeCell.setColspan(5); chargeCell.setBorder(0); chargeTable.addCell(chargeCell); chargeCell = new PdfPCell(); chargeCell.setColspan(3); chargeCell.setBorder(0); chargeCell.setRowspan(3); String fdPodValue = null; if (agencyInfo != null && CommonUtils.isNotEmpty(agencyInfo[2])) { fdPodValue = agencyInfo[2]; } else if (CommonFunctions.isNotNull(lclbl.getFinalDestination()) && CommonFunctions.isNotNull(lclbl.getFinalDestination().getCountryId()) && CommonFunctions.isNotNull(lclbl.getFinalDestination().getCountryId().getCodedesc())) { fdPodValue = lclbl.getFinalDestination().getUnLocationName() + "," + lclbl.getFinalDestination().getCountryId().getCodedesc(); } p = new Paragraph(7f, fdPodValue != null ? fdPodValue.toUpperCase() : podValues.toUpperCase(), totalFontQuote); p.setAlignment(Element.ALIGN_LEFT); chargeCell.addElement(p); chargeTable.addCell(chargeCell); chargeCell = new PdfPCell(); chargeCell.setBorder(0); chargeCell.setColspan(3); p = new Paragraph(5f, "UNIT# " + unitNumber, headingblackBoldFont); p.setAlignment(Element.ALIGN_LEFT); chargeCell.addElement(p); chargeTable.addCell(chargeCell); chargeCell = new PdfPCell(); chargeCell.setBorder(0); chargeCell.setColspan(3); chargeCell.setPaddingTop(2f); p = new Paragraph(5f, "SEAL# " + sealOut, headingblackBoldFont); p.setAlignment(Element.ALIGN_LEFT); chargeCell.addElement(p); chargeTable.addCell(chargeCell); chargeCell = new PdfPCell(); chargeCell.setBorder(0); chargeCell.setColspan(3); chargeCell.setPaddingTop(2f); p = new Paragraph(5f, "CONTROL-VOY# " + voyageNumber, totalFontQuote); p.setAlignment(Element.ALIGN_LEFT); chargeCell.addElement(p); chargeTable.addCell(chargeCell); String emailId = ""; StringBuilder agentDetails = new StringBuilder(); //Agent Details String agentAcctNo = ""; if ("Y".equalsIgnoreCase(altAgentKey)) { agentAcctNo = CommonUtils.isNotEmpty(altAgentValue) ? altAgentValue : ""; } else if (lclbl.getAgentAcct() != null) { agentAcctNo = (agencyInfo != null && CommonUtils.isNotEmpty(agencyInfo[0])) ? agencyInfo[0] : lclbl.getAgentAcct().getAccountno(); } if (CommonUtils.isNotEmpty(agentAcctNo)) { CustAddress custAddress = new CustAddressDAO().findPrimeContact(agentAcctNo); if (CommonFunctions.isNotNull(custAddress)) { if (CommonFunctions.isNotNull(custAddress.getAcctName())) { agentDetails.append(custAddress.getAcctName()).append(" "); } if (CommonFunctions.isNotNull(custAddress.getPhone())) { agentDetails.append("Phone: ").append(custAddress.getPhone()).append("\n"); } else { agentDetails.append("\n"); } if (CommonFunctions.isNotNull(custAddress.getCoName())) { agentDetails.append(custAddress.getCoName()).append("\n"); } if (CommonFunctions.isNotNull(custAddress.getAddress1())) { agentDetails.append(custAddress.getAddress1().replace(", ", "\n")).append("\n"); } if (CommonFunctions.isNotNull(custAddress.getCity1())) { agentDetails.append(custAddress.getCity1()); } if (CommonFunctions.isNotNull(custAddress.getState())) { agentDetails.append(" ").append(custAddress.getState()); } if (CommonFunctions.isNotNull(custAddress.getEmail1())) { emailId = custAddress.getEmail1(); } } } BigDecimal PrintInvoiceValue = null; if (lclbl.getPortOfDestination() != null) { boolean schnum = new LCLPortConfigurationDAO().getSchnumValue(lclbl.getPortOfDestination().getId()); if (schnum) { BigDecimal printInvoice = lclbl.getInvoiceValue(); Long fileId = lclbl.getFileNumberId(); if (!CommonUtils.isEmpty(printInvoice) && !CommonUtils.isEmpty(fileId)) { PrintInvoiceValue = printInvoice; } } } chargeCell = new PdfPCell(); chargeCell.setBorder(2); chargeCell.setColspan(6); chargeCell.setPadding(0f); PdfPTable agent_Contact_Table = new PdfPTable(3); agent_Contact_Table.setWidthPercentage(100f); agent_Contact_Table.setWidths(new float[] { 2.3f, 1.7f, 1.8f }); PdfPCell agent_Contact_cell = new PdfPCell(); agent_Contact_cell.setBorder(0); agent_Contact_cell.setBorderWidthTop(1f); agent_Contact_cell.setBorderWidthLeft(1f); agent_Contact_cell.setBorderWidthBottom(0.06f); agent_Contact_cell.setBorderWidthRight(1f); p = new Paragraph(7f, "To Pick Up Freight Please Contact: ", blackContentNormalFont); p.setAlignment(Element.ALIGN_LEFT); agent_Contact_cell.addElement(p); agent_Contact_Table.addCell(agent_Contact_cell); agent_Contact_cell = new PdfPCell(); agent_Contact_cell.setBorder(0); agent_Contact_cell.setColspan(2); agent_Contact_cell.setBorderWidthTop(1f); agent_Contact_cell.setPaddingBottom(2f); p = new Paragraph(7f, "Email: " + emailId.toLowerCase(), totalFontQuote); p.setAlignment(Element.ALIGN_LEFT); agent_Contact_cell.addElement(p); agent_Contact_Table.addCell(agent_Contact_cell); agent_Contact_cell = new PdfPCell(); agent_Contact_cell.setColspan(2); agent_Contact_cell.setBorder(0); agent_Contact_cell.setBorderWidthLeft(1f); p = new Paragraph(7f, "" + agentDetails.toString(), totalFontQuote); p.setAlignment(Element.ALIGN_LEFT); agent_Contact_cell.addElement(p); agent_Contact_Table.addCell(agent_Contact_cell); agent_Contact_cell = new PdfPCell(); agent_Contact_cell.setBorder(0); agent_Contact_cell.setPaddingTop(27f); p = new Paragraph(7f, "" + agentAcctNo, totalFontQuote); p.setAlignment(Element.ALIGN_RIGHT); agent_Contact_cell.addElement(p); agent_Contact_Table.addCell(agent_Contact_cell); agent_Contact_cell = new PdfPCell(); agent_Contact_cell.setBorder(0); agent_Contact_cell.setColspan(3); agent_Contact_cell.setBorderWidthLeft(1f); StringBuilder builder = new StringBuilder(); builder.append(PrintInvoiceValue != null ? "Value of Goods:USD $" + PrintInvoiceValue : ""); p = new Paragraph(3f, "" + builder.toString(), totalFontQuote); p.setAlignment(Element.ALIGN_RIGHT); agent_Contact_cell.addElement(p); agent_Contact_Table.addCell(agent_Contact_cell); chargeCell.addElement(agent_Contact_Table); chargeTable.addCell(chargeCell); return chargeTable; }
From source file:com.gp.cong.logisoft.lcl.report.LclAllBLPdfCreator.java
public PdfPTable appendDescComments() throws Exception { PdfPTable descTable = new PdfPTable(5); descTable.setWidthPercentage(100f);//www .ja v a 2s .c om descTable.setWidths(new float[] { 0.1f, 0.5f, 4f, 0.5f, 0.01f }); PdfPCell descCell = null; Paragraph p = null; descCell = new PdfPCell(); descCell.setBorder(0); descCell.setColspan(5); String comments = LoadLogisoftProperties.getProperty(ruleName.equalsIgnoreCase("ECU") ? "ECU.tariffterms" : this.ruleName.equalsIgnoreCase("OTI") ? "OTI.tariffterms" : "Econo.tariffterms"); p = new Paragraph(8f, comments + "" + "" + "\n" + "IN WITNESS WHERE OF THE CARRIER BY ITS AGENT HAS SIGNED................. 3(THREE) BILLS OF LADING, ALL OF THE SAME TENOR AND DATE, " + "ONE OF WHICH BEING ACCOMPLISHED, THE OTHERS TO STAND VOID.\nPLEASE SEE OUR WEBSITE FOR TERMS AND CONDITIONS.", contentNormalFont); p.setSpacingAfter(10f); p.setAlignment(Element.ALIGN_LEFT); descCell.addElement(p); descCell.setFixedHeight(100f); descTable.addCell(descCell); descCell = new PdfPCell(); descCell.setBorder(0); descTable.addCell(descCell); descCell = new PdfPCell(); descCell.setColspan(5); descCell.setFixedHeight(10f); descCell.setBorder(0); descTable.addCell(descCell); descCell = new PdfPCell(); descCell.setBorder(0); descCell.setColspan(2); descTable.addCell(descCell); descCell = new PdfPCell(); descCell.setBorder(0); descCell.setBorderWidthBottom(0.06f); String carrierName = LoadLogisoftProperties.getProperty(ruleName.equalsIgnoreCase("ECU") ? "ECU.carrier" : ruleName.equalsIgnoreCase("OTI") ? "OTI.carrier" : "Econo.carrier"); p = new Paragraph(12f, "BY " + carrierName.toUpperCase(), fontCompNormalSub); p.setAlignment(Element.ALIGN_LEFT); descCell.addElement(p); descTable.addCell(descCell); descCell = new PdfPCell(); descCell.setBorder(0); descCell.setColspan(2); descTable.addCell(descCell); descCell = new PdfPCell(); descCell.setFixedHeight(15f); descCell.setColspan(2); descCell.setBorder(0); descTable.addCell(descCell); descCell = new PdfPCell(); descCell.setBorder(0); descCell.setBorderWidthBottom(0.06f); p = new Paragraph(7f, "", blackBoldFontSize8); p.setAlignment(Element.ALIGN_LEFT); descCell.addElement(p); descTable.addCell(descCell); descCell = new PdfPCell(); descCell.setBorder(0); descCell.setColspan(2); descTable.addCell(descCell); descCell = new PdfPCell(); descCell.setBorder(0); descCell.setColspan(2); descCell.setFixedHeight(15f); descTable.addCell(descCell); descCell = new PdfPCell(); descCell.setBorder(0); descCell.setBorderWidthBottom(0.06f); p = new Paragraph(12f, "" + polValues.toUpperCase(), fontCompNormalSub); p.setAlignment(Element.ALIGN_CENTER); descCell.addElement(p); descTable.addCell(descCell); descCell = new PdfPCell(); descCell.setBorder(0); descCell.setColspan(2); descTable.addCell(descCell); descCell = new PdfPCell(); descCell.setBorder(0); descCell.setColspan(2); descTable.addCell(descCell); descCell = new PdfPCell(); descCell.setBorder(0); if ("N".equalsIgnoreCase(portKey)) { p = new Paragraph(7f, "PORT", fontCompNormalSub); } else { p = new Paragraph(7f, "PORT" + " " + portKeyValue, fontCompNormalSub); } p.setAlignment(Element.ALIGN_CENTER); descCell.addElement(p); descTable.addCell(descCell); descCell = new PdfPCell(); descCell.setBorder(0); descCell.setColspan(2); descTable.addCell(descCell); return descTable; }
From source file:com.gp.cong.logisoft.lcl.report.LclConsolidationMiniManifestPdfCreator.java
private Element consolidateTable(String fileId) throws DocumentException, Exception { consolidateTable = new PdfPTable(8); consolidateTable.setWidthPercentage(99f); consolidateTable.setWidths(new float[] { 1f, 2f, 1f, 1f, 1f, 1f, 2f, 2f }); int pieceTotal = 0; DecimalFormat df = new DecimalFormat("0.00"); Double cftTotal = 0.0;/* ww w. j ava2 s .c o m*/ Double kgsToatl = 0.0; Paragraph p = null; Font blackStarSize = new Font(Font.FontFamily.COURIER, 9f, Font.BOLD); if (CommonUtils.isNotEmpty(fileId)) { LclConsolidateDAO consolidateDAO = new LclConsolidateDAO(); LCLBookingDAO lCLBookingDAO = new LCLBookingDAO(); long fileIDd = Long.parseLong(fileId); List consolidateFileList = consolidateDAO.getConsolidatesFiles(fileIDd); List newList = new ArrayList(); if (null != consolidateFileList && CommonUtils.isNotEmpty(consolidateFileList)) { newList.add(Long.parseLong(fileId)); newList.addAll(consolidateFileList); List<ConsolidationMiniManifestBean> minimanifestBean = lCLBookingDAO.getConsolidateDr(newList); for (ConsolidationMiniManifestBean value : minimanifestBean) { consolidateTable.addCell(makeCellNoBorderFont("", 1f, 8, blackNormalCourierFont10f)); consolidateTable.addCell(makeCellNoBorderFont("", 1f, 8, blackNormalCourierFont10f)); consolidateTable.addCell(makeCellNoBorderFont("", 1f, 8, blackNormalCourierFont10f)); consolidateTable.addCell(makeCellNoBorderFont("D/R", 1f, 0, blackNormalCourierFont10f)); consolidateTable .addCell(makeCellNoBorderFont("Supplier Name", 1f, 0, blackNormalCourierFont10f)); consolidateTable.addCell(makeCellNoBorderFont("PCS", 1f, 0, blackNormalCourierFont10f)); consolidateTable.addCell(makeCellNoBorderFont("Type", 1f, 0, blackNormalCourierFont10f)); consolidateTable.addCell(makeCellNoBorderFont("CFT ", 1f, 0, blackNormalCourierFont10f)); consolidateTable.addCell(makeCellNoBorderFont("Weight", 1f, 0, blackNormalCourierFont10f)); consolidateTable .addCell(makeCellNoBorderFont("DESCRIPTION ", 1f, 0, blackNormalCourierFont10f)); consolidateTable.addCell( makeCellNoBorderFont("PURCHASE ORDER/INVOICE", 1f, 0, blackNormalCourierFont10f)); consigneeCell = new PdfPCell(); consigneeCell.setBorder(0); consigneeCell.setPadding(0f); consigneeCell.setPaddingLeft(-3f); consigneeCell.setPaddingRight(-7f); consigneeCell.setPaddingBottom(4f); consigneeCell.setColspan(19); p = new Paragraph(8f, " ------------- ---------------------------- --------- ---------" + "----------- ------------- ------------- -------------" + "--------------------- -----------------------------", blackStarSize); consigneeCell.addElement(p); consolidateTable.addCell(consigneeCell); String customerpoValue = value.getCustomerPo(); List l = null; if (null != customerpoValue && CommonUtils.isNotEmpty(customerpoValue)) { l = helperClass.wrapAddress(customerpoValue); if (l.isEmpty() || l.size() < 3) { ADDRESS_SIZE += 3; } else { ADDRESS_SIZE += l.size(); } } consolidateTable .addCell(makeCellNoBorderFont(value.getFileNumber(), 1f, 0, blackNormalCourierFont10f)); consolidateTable.addCell( makeCellNoBorderFont(value.getSupplierName(), 1f, 0, blackNormalCourierFont10f)); consolidateTable.addCell(makeCellNoBorderFont(String.valueOf(value.getPiece()), 1f, 0, blackNormalCourierFont10f)); consolidateTable.addCell( makeCellNoBorderFont(value.getPackageName(), 1f, 0, blackNormalCourierFont10f)); consolidateTable.addCell(makeCellNoBorderFont( null != value.getCft() ? String.valueOf(df.format(value.getCft())) : "", 1f, 0, blackNormalCourierFont10f)); consolidateTable.addCell(makeCellNoBorderFont( null != value.getCft() ? String.valueOf(df.format(value.getKgs())) : "", 1f, 0, blackNormalCourierFont10f)); consolidateTable.addCell(makeCellNoBorderFont(value.getComDescrption().toUpperCase(), 1f, 0, blackNormalCourierFont10f)); consolidateTable.addCell(makeCellNoBorderFont(null != customerpoValue ? customerpoValue : "", 1f, 0, blackNormalCourierFont10f)); consigneeCell = new PdfPCell(); consigneeCell.setBorder(0); consigneeCell.setPadding(0f); consigneeCell.setPaddingLeft(-3f); consigneeCell.setPaddingRight(-7f); consigneeCell.setPaddingBottom(4f); consigneeCell.setColspan(19); p = new Paragraph(8f, " ***********************************************************" + "**************************************************" + "***********************************************************", blackStarSize); consigneeCell.addElement(p); consolidateTable.addCell(consigneeCell); pieceTotal = pieceTotal + value.getPiece(); if (null != value.getCft()) { cftTotal = (cftTotal + value.getCft()); df.format(cftTotal.doubleValue()); } if (null != value.getKgs()) { kgsToatl = kgsToatl + value.getKgs(); df.format(cftTotal.doubleValue()); } } } consolidateTable.addCell(makeCellNoBorderFont("", 2f, 0, blackNormalCourierFont10f)); consolidateTable.addCell(makeCellNoBorderFont("Grand Totals", 2f, 0, blackNormalCourierFont10f)); consolidateTable .addCell(makeCellNoBorderFont(String.valueOf(pieceTotal), 2f, 0, blackNormalCourierFont10f)); consolidateTable.addCell(makeCellNoBorderFont("", 2f, 0, blackNormalCourierFont10f)); consolidateTable.addCell( makeCellNoBorderFont(String.valueOf(df.format(cftTotal)), 2f, 0, blackNormalCourierFont10f)); consolidateTable.addCell( makeCellNoBorderFont(String.valueOf(df.format(kgsToatl)), 2f, 0, blackNormalCourierFont10f)); consolidateTable.addCell(makeCellNoBorderFont("", 2f, 0, blackNormalCourierFont10f)); consolidateTable.addCell(makeCellNoBorderFont("", 2f, 0, blackNormalCourierFont10f)); } return consolidateTable; }
From source file:com.gp.cong.logisoft.lcl.report.LclConsolidationMiniManifestPdfCreator.java
private Element consigneeTable() throws DocumentException { String consigneeName = ""; if (CommonFunctions.isNotNull(bl.getConsContact().getId()) && CommonFunctions.isNotNull(bl.getConsContact().getCompanyName())) { consigneeName = bl.getConsContact().getCompanyName(); }//from w ww. j ava 2s .co m consigneeTable = new PdfPTable(3); consigneeTable.setWidthPercentage(100); consigneeTable.setWidths(new float[] { 40, 40, 30 }); consigneeTable.addCell(makeCellNoBorderFont("", 2f, 0, blackNormalCourierFont10f)); consigneeTable.addCell(makeCellNoBorderFont("", 2f, 0, blackNormalCourierFont10f)); consigneeTable.addCell(makeCellNoBorderFont("", 2f, 0, blackNormalCourierFont10f)); consigneeTable.addCell(makeCellNoBorderFont("", 2f, 0, blackNormalCourierFont10f)); consigneeTable.addCell(makeCellNoBorderFont("", 2f, 0, blackNormalCourierFont10f)); consigneeTable.addCell(makeCellNoBorderFont("", 2f, 0, blackNormalCourierFont10f)); consigneeTable .addCell(makeCellNoBorderFont("Consignee - " + consigneeName, 2f, 0, blackNormalCourierFont10f)); consigneeTable.addCell(makeCellNoBorderFont("", 2f, 0, blackNormalCourierFont10f)); consigneeTable.addCell(makeCellNoBorderFont("", 2f, 0, blackNormalCourierFont10f)); consigneeTable .addCell(makeCellNoBorderFont("Voyage # - " + voyageNumber, 2f, 0, blackNormalCourierFont10f)); consigneeTable.addCell(makeCellNoBorderFont("", 2f, 0, blackNormalCourierFont10f)); consigneeTable.addCell(makeCellNoBorderFont("", 2f, 0, blackNormalCourierFont10f)); consigneeTable .addCell(makeCellNoBorderFont("Vessel # - " + vesselDetails, 2f, 0, blackNormalCourierFont10f)); consigneeTable.addCell(makeCellNoBorderFont("", 2f, 0, blackNormalCourierFont10f)); consigneeTable.addCell(makeCellNoBorderFont("", 2f, 0, blackNormalCourierFont10f)); consigneeTable.addCell(makeCellNoBorderFont("", 2f, 0, blackNormalCourierFont10f)); return consigneeTable; }
From source file:com.gp.cong.logisoft.lcl.report.LclConsolidationMiniManifestPdfCreator.java
private PdfPTable headerTable(PdfWriter pdfWriter) throws Exception { String companyName = LoadLogisoftProperties .getProperty(this.ruleName.equalsIgnoreCase("ECU") ? "application.ECU.companyname" : this.ruleName.equalsIgnoreCase("OTI") ? "application.OTI.companyname" : "application.Econo.companyname"); SimpleDateFormat sd = new SimpleDateFormat("MM/dd/yy"); SimpleDateFormat sdf = new SimpleDateFormat("HH:mm a "); Paragraph ph = null;//from w w w . ja v a2 s . c o m headerTable = new PdfPTable(3); headerTable.setWidthPercentage(100); headerTable.setWidths(new float[] { 40, 35, 25 }); headerTable.addCell(makeCellNoBorderFont("", 2f, 0, blackNormalCourierFont10f)); headerTable.addCell(makeCellNoBorderFont(" " + companyName, 2f, 0, blackNormalCourierFont10f)); headerTable .addCell(makeCellNoBorderFont(" DATE " + sd.format(new Date()), 2f, 0, blackNormalCourierFont10f)); headerTable.addCell(makeCellNoBorderFont("Page # - " + pdfWriter.getCurrentPageNumber(), 2f, 0, blackNormalCourierFont10f)); headerTable.addCell(makeCellNoBorderFont("Consolidation Mini Manifest", 2f, 0, blackNormalCourierFont10f)); headerTable .addCell(makeCellNoBorderFont("TIME " + sdf.format(new Date()), 2f, 0, blackNormalCourierFont10f)); headerTable.addCell(makeCellNoBorderFont("Requested By - " + bl.getEnteredBy().getLoginName(), 2f, 0, blackNormalCourierFont10f)); headerTable.addCell(makeCellNoBorderFont(null != blNumber ? "B/L " + blNumber : "B/L " + "", 2f, 0, blackNormalCourierFont10f)); headerTable.addCell(makeCellNoBorderFont("", 2f, 0, blackNormalCourierFont10f)); headerTable.addCell(makeCellNoBorderFont("", 2f, 0, blackNormalCourierFont10f)); headerTable.addCell(makeCellNoBorderFont("", 2f, 0, blackNormalCourierFont10f)); headerTable.addCell(makeCellNoBorderFont("", 2f, 0, blackNormalCourierFont10f)); headerTable.addCell(makeCellNoBorderFont("", 2f, 0, blackNormalCourierFont10f)); headerTable.addCell(makeCellNoBorderFont("", 2f, 0, blackNormalCourierFont10f)); headerTable.addCell(makeCellNoBorderFont("", 2f, 0, blackNormalCourierFont10f)); headerTable.addCell(makeCellNoBorderFont("", 2f, 0, blackNormalCourierFont10f)); headerTable.addCell(makeCellNoBorderFont("", 2f, 0, blackNormalCourierFont10f)); return headerTable; }
From source file:com.gp.cong.logisoft.lcl.report.LclVoyageNotificationPdfCreator.java
public PdfPTable onStartPage(String realPath, String scheduleNo, String unitNo, String voyContent) throws Exception { String path = LoadLogisoftProperties.getProperty("application.image.logo"); Font fontArialBold = FontFactory.getFont("Arial", 10f, Font.BOLD); Font colorBoldFont = FontFactory.getFont("Arial", 12f, Font.BOLD, new BaseColor(00, 102, 00)); Phrase p = null;// www . ja v a 2 s . co m Paragraph pValues = null; table = new PdfPTable(6); table.setWidths(new float[] { 0.1f, 1.8f, 2.5f, 3.5f, 1.8f, 1.8f }); table.setWidthPercentage(100f); cell = new PdfPCell(); cell.setBorder(0); cell.setPadding(0f); cell.setRowspan(3); table.addCell(cell); cell = new PdfPCell(); cell.setPadding(0f); cell.setBorder(0); cell.setPaddingBottom(3f); p = new Phrase("", fontArialBold); p.setLeading(20f); cell.addElement(p); table.addCell(cell); cell = new PdfPCell(); cell.setBorder(0); cell.setPadding(0f); cell.setPaddingBottom(3f); pValues = new Paragraph(25f, "", fontArialBold); cell.addElement(pValues); table.addCell(cell); cell = new PdfPCell(); cell.setRowspan(3); cell.setBorder(0); cell.setPadding(0f); Image img = Image.getInstance(realPath + path); img.scalePercent(60); img.setAlignment(Element.ALIGN_CENTER); img.setAlignment(Element.ALIGN_TOP); cell.addElement(img); table.addCell(cell); cell = new PdfPCell(); cell.setBorder(0); cell.setPadding(0f); cell.setPaddingBottom(3f); pValues = new Paragraph(20f, "Date:", fontArialBold); pValues.setAlignment(Element.ALIGN_RIGHT); cell.addElement(pValues); table.addCell(cell); cell = new PdfPCell(); cell.setBorder(0); cell.setPadding(0f); cell.setPaddingBottom(3f); pValues = new Paragraph(20f, " " + DateUtils.formatStringDateToAppFormatMMM(new Date()), fontArialBold); pValues.setAlignment(Element.ALIGN_LEFT); cell.addElement(pValues); table.addCell(cell); cell = new PdfPCell(); cell.setPadding(0f); cell.setBorder(0); cell.setPaddingBottom(3f); table.addCell(cell); cell = new PdfPCell(); cell.setBorder(0); cell.setPaddingBottom(3f); cell.setPadding(0f); table.addCell(cell); cell = new PdfPCell(); cell.setBorder(0); cell.setPadding(0f); cell.setPaddingBottom(3f); pValues = new Paragraph(9f, "Time:", fontArialBold); pValues.setAlignment(Element.ALIGN_RIGHT); cell.addElement(pValues); table.addCell(cell); cell = new PdfPCell(); cell.setBorder(0); cell.setPadding(0f); cell.setPaddingBottom(3f); pValues = new Paragraph(9f, " " + DateUtils.formatStringDateToTimeTT(new Date()), fontArialBold); pValues.setAlignment(Element.ALIGN_LEFT); cell.addElement(pValues); table.addCell(cell); cell = new PdfPCell(); cell.setColspan(2); cell.setBorder(0); cell.setPadding(0f); cell.setPaddingBottom(3f); table.addCell(cell); cell = new PdfPCell(); cell.setColspan(2); cell.setBorder(0); cell.setPaddingBottom(3f); table.addCell(cell); //voyage cell = new PdfPCell(); cell.setBorder(0); cell.setColspan(3); table.addCell(cell); cell = new PdfPCell(); cell.setBorder(0); cell.setPaddingLeft(5f); pValues = new Paragraph(8f, "VOYAGE NOTIFICATION", colorBoldFont); pValues.setAlignment(Element.ALIGN_CENTER); cell.addElement(pValues); table.addCell(cell); cell = new PdfPCell(); cell.setBorder(0); cell.setColspan(2); table.addCell(cell); return table; }
From source file:com.gp.cong.logisoft.lcl.report.LclVoyageNotificationPdfCreator.java
public PdfPTable voyInfo(LclUnitSs lclUnitSs) throws DocumentException { StringBuilder originValues = new StringBuilder(); if (CommonUtils.isNotEmpty(lclUnitSs.getLclSsHeader().getOrigin().getUnLocationName())) { originValues.append(lclUnitSs.getLclSsHeader().getOrigin().getUnLocationName()).append(","); }/*w w w . j a v a 2s .c o m*/ if (null != lclUnitSs.getLclSsHeader().getOrigin().getCountryId() && CommonUtils.isNotEmpty(lclUnitSs.getLclSsHeader().getOrigin().getCountryId().getCodedesc())) { originValues.append(lclUnitSs.getLclSsHeader().getOrigin().getCountryId().getCodedesc()).append(" "); } if (CommonUtils.isNotEmpty(lclUnitSs.getLclSsHeader().getOrigin().getUnLocationCode())) { originValues.append("(").append(lclUnitSs.getLclSsHeader().getOrigin().getUnLocationCode()).append(")"); } StringBuilder fdValues = new StringBuilder(); if (CommonUtils.isNotEmpty(lclUnitSs.getLclSsHeader().getDestination().getUnLocationName())) { fdValues.append(lclUnitSs.getLclSsHeader().getDestination().getUnLocationName()).append(","); } if (null != lclUnitSs.getLclSsHeader().getDestination().getStateId() && CommonUtils.isNotEmpty(lclUnitSs.getLclSsHeader().getDestination().getStateId().getCode())) { fdValues.append(lclUnitSs.getLclSsHeader().getDestination().getStateId().getCode()).append(" "); } if (CommonUtils.isNotEmpty(lclUnitSs.getLclSsHeader().getDestination().getUnLocationCode())) { fdValues.append("(").append(lclUnitSs.getLclSsHeader().getDestination().getUnLocationCode()) .append(")"); } Font fontCompSub = FontFactory.getFont("Arial", 9f, Font.BOLD); Paragraph pHeading = null; table = new PdfPTable(1); table.setWidthPercentage(100f); PdfPCell cell1 = new PdfPCell(); cell1.setBorder(0); cell1.setColspan(2); cell1.setBorderColor(new BaseColor(00, 51, 153)); cell1.setBorderWidthBottom(3f); cell1.setBorderWidthLeft(3f); cell1.setBorderWidthRight(3f); cell1.setBorderWidthTop(10f); cell1.setPadding(0f); //Heading pHeading = new Paragraph(8f, "Voyage Information", mainHeadingQuote); pHeading.setAlignment(Element.ALIGN_CENTER); cell1.addElement(pHeading); PdfPTable ntable1 = new PdfPTable(6); ntable1.setWidthPercentage(100f); ntable1.setWidths(new float[] { 0.1f, 1.15f, 0.09f, 4.09f, 1f, 2f }); //company Name ntable1.addCell(createEmptyCell(0, 1f, 6)); //Voyage Cell Origin ntable1.addCell(createEmptyCell(0, 1f, 0)); ntable1.addCell(makeCellNoBorderValue("Voyage. . . . . . . . . .", 0, 0f, 4f, fontCompSub)); ntable1.addCell(makeCellNoBorderValue(":", 0, 0f, 4f, fontCompSub)); ntable1.addCell(makeCellNoBorderValue(lclUnitSs.getLclSsHeader().getScheduleNo().toUpperCase(), 4, 0f, 5f, fontgreenCont)); //1Cell Origin ntable1.addCell(createEmptyCell(0, 1f, 0)); ntable1.addCell(makeCellNoBorderValue("Origin. . . . . . . . . . .", 0, 0f, 4f, fontCompSub)); ntable1.addCell(makeCellNoBorderValue(":", 0, 0f, 4f, fontCompSub)); ntable1.addCell(makeCellNoBorderValue(originValues.toString().toUpperCase(), 4, 0f, 5f, fontgreenCont)); ///2Cell Destination ntable1.addCell(createEmptyCell(0, 1f, 0)); ntable1.addCell(makeCellNoBorderValue("Destination. . . . . .", 0, 0f, 4f, fontCompSub)); ntable1.addCell(makeCellNoBorderValue(":", 0, 0f, 4f, fontCompSub)); ntable1.addCell(makeCellNoBorderValue(fdValues.toString().toUpperCase(), 4, 0f, 5f, fontgreenCont)); //3 StringBuilder billValues = new StringBuilder(); if (lclUnitSs.getLclSsHeader().getBillingTerminal().getTrmnum() != null) { billValues.append(lclUnitSs.getLclSsHeader().getBillingTerminal().getTrmnum()).append("-"); } if (lclUnitSs.getLclSsHeader().getBillingTerminal().getTerminalLocation() != null) { billValues.append(lclUnitSs.getLclSsHeader().getBillingTerminal().getTerminalLocation()); } ntable1.addCell(createEmptyCell(0, 1f, 0)); ntable1.addCell(makeCellNoBorderValue("Billing Terminal. . ", 0, 0f, 4f, fontCompSub)); ntable1.addCell(makeCellNoBorderValue(":", 0, 0f, 4f, fontCompSub)); ntable1.addCell(makeCellNoBorderValue(billValues.toString().toUpperCase(), 4, 0f, 4f, fontgreenCont)); ntable1.addCell(createEmptyCell(0, 1f, 6)); cell1.addElement(ntable1); table.addCell(cell1); return table; }
From source file:com.gp.cong.logisoft.lcl.report.LclVoyageNotificationPdfCreator.java
public PdfPTable unitInfo(LclUnitSs lclUnitSs) throws DocumentException, Exception { LclUnitSsImports lclUnitSsImports = lclUnitSs.getLclUnit().getLclUnitSsImportsList().get(0); StringBuilder cfsWarehs = new StringBuilder(); if (lclUnitSsImports != null && lclUnitSsImports.getCfsWarehouseId() != null) { if (lclUnitSsImports.getCfsWarehouseId().getWarehouseName() != null) { cfsWarehs.append(lclUnitSsImports.getCfsWarehouseId().getWarehouseName()).append("-"); }// www.ja v a2 s . c o m if (lclUnitSsImports.getCfsWarehouseId().getWarehouseNo() != null) { cfsWarehs.append(lclUnitSsImports.getCfsWarehouseId().getWarehouseNo()); } } LclUnitSsManifest lclUnitSsManifest = lclUnitSs.getLclUnit().getLclUnitSsManifestList().get(0); Font fontCompSub = FontFactory.getFont("Arial", 9f, Font.BOLD); Paragraph pHeading = null; table = new PdfPTable(1); table.setWidthPercentage(100f); PdfPCell cell1 = new PdfPCell(); cell1.setBorder(0); cell1.setColspan(2); cell1.setBorderColor(new BaseColor(00, 51, 153)); cell1.setBorderWidthBottom(3f); cell1.setBorderWidthLeft(3f); cell1.setBorderWidthRight(3f); cell1.setBorderWidthTop(10f); cell1.setPadding(0f); //Heading pHeading = new Paragraph(8f, "Unit Information", mainHeadingQuote); pHeading.setAlignment(Element.ALIGN_CENTER); cell1.addElement(pHeading); PdfPTable ntable1 = new PdfPTable(6); ntable1.setWidthPercentage(100f); ntable1.setWidths(new float[] { 0.1f, 1.15f, 0.09f, 4.09f, 1f, 2f }); //company Name ntable1.addCell(createEmptyCell(0, 1f, 6)); //unit No Cell ntable1.addCell(createEmptyCell(0, 1f, 0)); ntable1.addCell(makeCellNoBorderValue("Unit No . . . . . . . . .", 0, 0f, 4f, fontCompSub)); ntable1.addCell(makeCellNoBorderValue(":", 0, 0f, 4f, fontCompSub)); ntable1.addCell( makeCellNoBorderValue(lclUnitSs.getLclUnit().getUnitNo().toUpperCase(), 4, 0f, 4f, fontgreenCont)); //3 ntable1.addCell(createEmptyCell(0, 1f, 0)); ntable1.addCell(makeCellNoBorderValue("CFS(Devanning). . ", 0, 0f, 4f, fontCompSub)); ntable1.addCell(makeCellNoBorderValue(":", 0, 0f, 4f, fontCompSub)); ntable1.addCell(makeCellNoBorderValue(cfsWarehs.toString().toUpperCase(), 4, 0f, 4f, fontgreenCont)); // ntable1.addCell(createEmptyCell(0, 1f, 0)); ntable1.addCell(makeCellNoBorderValue("Master BL. . . . . . . ", 0, 0f, 4f, fontCompSub)); ntable1.addCell(makeCellNoBorderValue(":", 0, 0f, 4f, fontCompSub)); ntable1.addCell( makeCellNoBorderValue(lclUnitSsManifest.getMasterbl().toUpperCase(), 4, 0f, 4f, fontgreenCont)); ntable1.addCell(createEmptyCell(0, 1f, 6)); cell1.addElement(ntable1); table.addCell(cell1); return table; }
From source file:com.gp.cong.logisoft.lcl.report.LclVoyageNotificationPdfCreator.java
public PdfPTable dispoInfo(LclUnitSs lclUnitSs) throws DocumentException, Exception { Paragraph pHeading = null;/* w w w .j a v a 2 s.c o m*/ table = new PdfPTable(1); table.setWidthPercentage(100f); PdfPCell cell1 = null; cell1 = new PdfPCell(); cell1.setBorder(0); cell1.setBorderColor(new BaseColor(00, 51, 153)); cell1.setBorderWidthBottom(3f); cell1.setBorderWidthLeft(3f); cell1.setBorderWidthRight(3f); cell1.setBorderWidthTop(10f); cell1.setPadding(0f); //Heading pHeading = new Paragraph(8f, "Disposition Details", mainHeadingQuote); pHeading.setAlignment(Element.ALIGN_CENTER); cell1.addElement(pHeading); //company Name PdfPTable ntable1 = new PdfPTable(9); ntable1.setWidthPercentage(100f); ntable1.setWidths(new float[] { 0.2f, 2f, 0.25f, 1.5f, 0.25f, 4.5f, 1.5f, 5f, .5f }); ntable1.addCell(createEmptyCell(0, 0.1f, 9)); ntable1.addCell(createEmptyCell(0, 1f, 0)); cell = new PdfPCell(); cell.setBorder(0); cell.setBorderWidthBottom(0.06f); Chunk c1 = new Chunk("DATE", greenCourierFont9); cell.addElement(c1); ntable1.addCell(cell); ntable1.addCell(createEmptyCell(0, .5f, 0)); cell = new PdfPCell(); cell.setBorder(0); cell.setBorderWidthBottom(0.06f); c1 = new Chunk("TIME", greenCourierFont9); cell.addElement(c1); ntable1.addCell(cell); ntable1.addCell(createEmptyCell(0, .5f, 0)); cell = new PdfPCell(); cell.setBorder(0); cell.setBorderWidthBottom(0.06f); c1 = new Chunk("CONTAINER STATUS", greenCourierFont9); cell.addElement(c1); ntable1.addCell(cell); ntable1.addCell(createEmptyCell(0, .5f, 0)); ntable1.addCell(createEmptyCell(0, .5f, 0)); ntable1.addCell(createEmptyCell(0, .5f, 0)); LclSsDetail lclSsDetail = lclUnitSs.getLclSsHeader().getVesselSsDetail(); List<LclUnitSsDispo> dispositionList = new LclUnitSsDispoDAO() .getUnitDispoDetailsWithoutData(lclUnitSs.getLclUnit().getId(), lclSsDetail.getId()); if (!dispositionList.isEmpty()) { for (int i = 0; i < dispositionList.size(); i++) { LclUnitSsDispo lclUnitSsDispo = (LclUnitSsDispo) dispositionList.get(i); String dateTimeV = DateUtils.formatDate(lclUnitSsDispo.getDispositionDatetime(), "dd-MMM-yyyy hh:mm a"); String[] dateTimeArray1 = dateTimeV.split(" "); ntable1.addCell(createEmptyCell(0, 1f, 0)); cell = new PdfPCell(); cell.setBorder(0); pHeading = new Paragraph(5f, "" + dateTimeArray1[0], greenCourierFont9); cell.addElement(pHeading); ntable1.addCell(cell); ntable1.addCell(createEmptyCell(0, .5f, 0)); cell = new PdfPCell(); cell.setBorder(0); pHeading = new Paragraph(5f, "" + dateTimeArray1[1] + " " + dateTimeArray1[2], greenCourierFont9); cell.addElement(pHeading); ntable1.addCell(cell); ntable1.addCell(createEmptyCell(0, .5f, 0)); cell = new PdfPCell(); cell.setBorder(0); if (lclUnitSsDispo.getDisposition() != null && lclUnitSsDispo.getDisposition().getDescription() != null) { pHeading = new Paragraph(5f, "" + lclUnitSsDispo.getDisposition().getDescription(), greenCourierFont9); } else { pHeading = new Paragraph(5f, "" + lclUnitSsDispo.getDisposition().getEliteCode(), greenCourierFont9); } cell.addElement(pHeading); ntable1.addCell(cell); ntable1.addCell(createEmptyCell(0, .5f, 0)); ntable1.addCell(createEmptyCell(0, .5f, 0)); ntable1.addCell(createEmptyCell(0, .5f, 0)); } } ntable1.addCell(createEmptyCell(0, 2f, 9)); cell1.addElement(ntable1); table.addCell(cell1); return table; }