List of usage examples for com.itextpdf.text Element ALIGN_RIGHT
int ALIGN_RIGHT
To view the source code for com.itextpdf.text Element ALIGN_RIGHT.
Click Source Link
From source file:com.gp.cong.logisoft.lcl.report.LclAllBLPdfCreator.java
public PdfPTable headerSection() throws Exception { Paragraph p = null;//from w w w.ja va 2s . co m String companyName = ""; Font blackArialFont20 = FontFactory.getFont("Arial", 20f, Font.NORMAL); table = new PdfPTable(3); table.setWidthPercentage(100f); cell = new PdfPCell(); cell.setBorder(0); companyName = LoadLogisoftProperties .getProperty(ruleName.equalsIgnoreCase("ECU") ? "application.ECU.companyname" : ruleName.equalsIgnoreCase("ECI") ? "application.Econo.companyname" : ruleName.equalsIgnoreCase("OTI") ? "application.OTI.companyname" : "application.Econo.companyname"); p = new Paragraph(2f, companyName.toUpperCase(), blackArialFont20); p.setAlignment(Element.ALIGN_LEFT); cell.addElement(p); table.addCell(cell); cell = new PdfPCell(); cell.setBorder(0); p = new Paragraph(2f, this.headingAlert.equalsIgnoreCase("Y") ? "PRE-ALERT" : "", blackBoldFont14); p.setAlignment(Element.ALIGN_CENTER); cell.addElement(p); table.addCell(cell); cell = new PdfPCell(); cell.setBorder(0); p = new Paragraph(2f, "BILL OF LADING", blackArialFont20); p.setAlignment(Element.ALIGN_RIGHT); cell.addElement(p); table.addCell(cell); //empty space table.addCell(createEmptyCell(0, 1f, 3)); return table; }
From source file:com.gp.cong.logisoft.lcl.report.LclAllBLPdfCreator.java
public PdfPTable bodySection() throws Exception { String exportRefRemarks = ""; String routingInsRemarks = ""; String InsStatement = ""; StringBuilder pierValues = new StringBuilder(); String[] remarkTypes = { REMARKS_TYPE_ROUTING_INSTRU, REMARKS_TYPE_EXPORT_REF }; List remarks = new LclRemarksDAO().getRemarksByTypes(lclbl.getFileNumberId(), remarkTypes); for (Object row : remarks) { Object[] col = (Object[]) row; if (col[1].toString().equalsIgnoreCase("Export Reference")) { exportRefRemarks = col[0].toString(); }// ww w .jav a 2 s . c o m if (col[1].toString().equalsIgnoreCase("Routing Instruction")) { routingInsRemarks = col[0].toString(); } } String bill_type = lclbl.getBillingType(); billingType = bill_type.equalsIgnoreCase("P") ? "** FREIGHT PREPAID **" : bill_type.equalsIgnoreCase("C") ? "** FREIGHT COLLECT **" : bill_type.equalsIgnoreCase("B") && "Y".equalsIgnoreCase(printPpdBlBothKey) ? "** FREIGHT PREPAID **" : "** FREIGHT COLLECT **"; billType = bill_type.equalsIgnoreCase("P") ? "PPD" : bill_type.equalsIgnoreCase("C") ? "COL" : "BOTH"; LclSsDetail bookedOrPickedVoy = null; ExportVoyageSearchModel pickedDetails = new LclUnitSsDAO() .getPickedVoyageByVessel(lclBooking.getFileNumberId(), "E"); if (pickedDetails != null && CommonUtils.isNotEmpty(pickedDetails.getUnitSsId())) { LclUnitSs lclUnitSs = new LclUnitSsDAO().findById(Long.parseLong(pickedDetails.getUnitSsId())); bookedOrPickedVoy = lclUnitSs.getLclSsHeader().getVesselSsDetail(); unitNumber = lclUnitSs.getLclUnit().getUnitNo(); voyageNumber = lclUnitSs.getLclSsHeader().getScheduleNo(); sealOut = CommonUtils.isNotEmpty(lclUnitSs.getSUHeadingNote()) ? lclUnitSs.getSUHeadingNote().toUpperCase() : ""; } else { bookedOrPickedVoy = null != lclbl.getBookedSsHeaderId() ? lclbl.getBookedSsHeaderId().getVesselSsDetail() : null; } StringBuilder carrierName = new StringBuilder(); if (bookedOrPickedVoy != null) { sailDate = DateUtils.formatStringDateToAppFormatMMM(bookedOrPickedVoy.getStd()); sailDateFormat = DateUtils.formatDateToMMMMDDYYYY(bookedOrPickedVoy.getStd()); ladenSailDateRemarks = "\nLaden On Board:" + sailDate; if (CommonFunctions.isNotNull(bookedOrPickedVoy.getSpReferenceName())) { carrierName.append(bookedOrPickedVoy.getSpReferenceName()).append(" "); } if (CommonUtils.isNotEmpty(bookedOrPickedVoy.getTransMode())) { carrierName.append(bookedOrPickedVoy.getTransMode()).append(". "); } if (CommonUtils.isNotEmpty(bookedOrPickedVoy.getSpReferenceNo())) { carrierName.append(bookedOrPickedVoy.getSpReferenceNo()); } pierValues.append(bookedOrPickedVoy.getDeparture().getUnLocationName()); if (null != bookedOrPickedVoy.getDeparture().getStateId()) { pierValues.append("/").append(bookedOrPickedVoy.getDeparture().getStateId().getCode()); } } Paragraph p = null; table = new PdfPTable(2); table.setWidthPercentage(100f); table.setWidths(new float[] { 5.3f, 4.7f }); PdfPCell bCell = null; bCell = new PdfPCell(); bCell.setBorder(0); bCell.setPadding(0f); bCell.setBorderWidthBottom(0.06f); bCell.setBorderWidthTop(0.06f); bCell.setBorderWidthRight(0.06f); PdfPTable bTable = new PdfPTable(2); bTable.setWidths(new float[] { 5f, 4f }); bTable.setWidthPercentage(100f); bTable.addCell(makeCellLeftTopNoBorderFont("SHIPPER/EXPORTER", -0.5f, 0.8f, blackBoldFont65)); PdfPCell shCell = new PdfPCell(); shCell.setBorder(0); shCell.setColspan(2); shCell.setPadding(0f); shCell.setPaddingLeft(4f); shCell.setBorderWidthBottom(0.06f); shCell.setFixedHeight(65f); String shipperDetails = lclUtils.getConcatenatedAccountDetails(lclbl.getShipContact()); if (CommonUtils.isNotEmpty(shipperDetails)) { p = new Paragraph(11f, "" + shipperDetails.toUpperCase(), totalFontQuote); p.setAlignment(Element.ALIGN_LEFT); p.setSpacingAfter(15f); } else { p = new Paragraph(8f, "", totalFontQuote); shCell.setPadding(35f); } shCell.addElement(p); bTable.addCell(shCell); //consignee bTable.addCell(makeCellLeftTopNoBorderFont("CONSIGNEE", -0.5f, 0.8f, blackBoldFont65)); //consignee Values PdfPCell cvCell = new PdfPCell(); cvCell.setBorder(0); cvCell.setColspan(2); cvCell.setPadding(0f); cvCell.setPaddingLeft(4f); cvCell.setBorderWidthBottom(0.06f); cvCell.setFixedHeight(65f); String consDetails = lclUtils.getConcatenatedAccountDetails(lclbl.getConsContact()); if (CommonUtils.isNotEmpty(consDetails)) { p = new Paragraph(11f, "" + consDetails.toUpperCase(), totalFontQuote); p.setSpacingAfter(15f); p.setAlignment(Element.ALIGN_LEFT); } else { p = new Paragraph(8f, "", totalFontQuote); cvCell.setPadding(30f); } cvCell.addElement(p); bTable.addCell(cvCell); //Notify bTable.addCell(makeCellLeftTopNoBorderFont("NOTIFY PARTY", -0.5f, 0.8f, blackBoldFont65)); //consignee Values PdfPCell nvCell = new PdfPCell(); nvCell.setBorder(0); nvCell.setColspan(2); nvCell.setPadding(0f); nvCell.setPaddingLeft(4f); nvCell.setBorderWidthBottom(0.06f); nvCell.setFixedHeight(70f); String notyDetails = lclUtils.getConcatenatedAccountDetails(lclbl.getNotyContact()); if (CommonUtils.isNotEmpty(notyDetails)) { p = new Paragraph(11f, "" + notyDetails.toUpperCase(), totalFontQuote); p.setSpacingAfter(25f); p.setAlignment(Element.ALIGN_LEFT); } else { p = new Paragraph(8f, "", totalFontQuote); nvCell.setPadding(40f); } nvCell.addElement(p); bTable.addCell(nvCell); //place of receipt PdfPCell prCell = new PdfPCell(); prCell.setBorder(0); prCell.setPaddingLeft(-0.9f); prCell.setPaddingTop(-0.2f); p = new Paragraph(7f, "PLACE OF RECEIPT", blackBoldFont65); p.setAlignment(Element.ALIGN_LEFT); prCell.addElement(p); bTable.addCell(prCell); /* Pier Logic */ String pier = "N".equalsIgnoreCase(printPierPol) ? ("N".equalsIgnoreCase(printPierPol) && !"N".equalsIgnoreCase(hblPierOverRideKey)) ? hblPierOverRideKey : pierValues.toString() : ""; /* POL Logic */ String pol = ""; if ("Y".equalsIgnoreCase(printPierPol)) { if ("N".equalsIgnoreCase(hblPierOverRideKey)) { pol = pierValues.toString(); } else { pol = hblPierOverRideKey; } } else { pol = !"N".equalsIgnoreCase(hblPolOverRideKey) ? hblPolOverRideKey : polValues; } Boolean checkBlInsurance = new LclBlAcDAO().checkBlInsurance(lclbl.getFileNumberId(), INSURANCE_CHARGE_CODE); if (checkBlInsurance && "Y".equalsIgnoreCase(printBlInsuranceKey)) { InsStatement = LoadLogisoftProperties.getProperty("InsuranceChargeComment"); } PdfPCell pierCell = new PdfPCell(); pierCell.setBorder(0); pierCell.setBorderWidthLeft(0.06f); pierCell.setPaddingTop(-0.2f); p = new Paragraph(7f, "PIER", blackBoldFont65); p.setAlignment(Element.ALIGN_LEFT); pierCell.addElement(p); bTable.addCell(pierCell); //place of receipt values PdfPCell prvCell = new PdfPCell(); prvCell.setBorder(0); prvCell.setBorderWidthBottom(0.06f); if (lclBooking.getPooPickup()) { LclBookingPad lclBookingPad = lclBooking.getLclFileNumber().getLclBookingPadList().get(0); String pickUp_city = lclBookingPad.getPickUpCity().replaceAll("/", ","); pickUp_city = pickUp_city.substring(pickUp_city.indexOf("-") + 1, pickUp_city.length()); p = new Paragraph(7f, "" + pickUp_city.toUpperCase(), totalFontQuote); } else { StringBuilder placeofReceipt = new StringBuilder(); if (null != lclbl.getPortOfOrigin()) { placeofReceipt.append(lclbl.getPortOfOrigin().getUnLocationName()); if (CommonFunctions.isNotNull(lclbl.getPortOfOrigin().getStateId()) && CommonFunctions.isNotNull(lclbl.getPortOfOrigin().getStateId().getCode())) { placeofReceipt.append(",").append(lclbl.getPortOfOrigin().getStateId().getCode()); } } p = new Paragraph(7f, "" + placeofReceipt.toString().toUpperCase(), totalFontQuote); } p.setSpacingAfter(5f); p.setSpacingBefore(5f); p.setAlignment(Element.ALIGN_LEFT); prvCell.addElement(p); bTable.addCell(prvCell); //pier values PdfPCell piervCell = new PdfPCell(); piervCell.setBorder(0); piervCell.setBorderWidthLeft(0.06f); piervCell.setBorderWidthBottom(0.06f); p = new Paragraph(7f, "" + pier, totalFontQuote); p.setSpacingAfter(5f); p.setSpacingBefore(5f); p.setAlignment(Element.ALIGN_LEFT); piervCell.addElement(p); bTable.addCell(piervCell); //exporting carrier PdfPCell ecCell = new PdfPCell(); ecCell.setBorder(0); ecCell.setPaddingLeft(-0.5f); ecCell.setPaddingTop(-0.2f); p = new Paragraph(7f, "EXPORTING CARRIER (Vessel) (Flag)", blackBoldFont65); p.setAlignment(Element.ALIGN_LEFT); ecCell.addElement(p); bTable.addCell(ecCell); //portof loading PdfPCell portCell = new PdfPCell(); portCell.setBorder(0); portCell.setPaddingTop(-0.2f); portCell.setBorderWidthLeft(0.06f); p = new Paragraph(7f, "PORT OF LOADING", blackBoldFont65); p.setAlignment(Element.ALIGN_LEFT); portCell.addElement(p); bTable.addCell(portCell); //exporting values PdfPCell exvCell = new PdfPCell(); exvCell.setBorder(0); exvCell.setFixedHeight(15f); exvCell.setBorderWidthBottom(0.06f); p = new Paragraph(7f, "" + carrierName.toString().toUpperCase(), totalFontQuote); p.setSpacingAfter(5f); p.setSpacingBefore(5f); p.setAlignment(Element.ALIGN_LEFT); exvCell.addElement(p); bTable.addCell(exvCell); //port of loading values PdfPCell portvCell = new PdfPCell(); portvCell.setBorder(0); portvCell.setBorderWidthLeft(0.06f); portvCell.setBorderWidthBottom(0.06f); p = new Paragraph(7f, "" + pol.toUpperCase(), totalFontQuote); p.setAlignment(Element.ALIGN_LEFT); portvCell.addElement(p); bTable.addCell(portvCell); //sea port of discharge PdfPCell seaCell = new PdfPCell(); seaCell.setBorder(0); seaCell.setPaddingLeft(-0.5f); seaCell.setPaddingTop(-0.2f); p = new Paragraph(7f, "SEA PORT OF DISCHARGE", blackBoldFont65); p.setAlignment(Element.ALIGN_LEFT); seaCell.addElement(p); bTable.addCell(seaCell); //finalde PdfPCell finalCell = new PdfPCell(); finalCell.setBorder(0); finalCell.setBorderWidthLeft(0.06f); finalCell.setPaddingTop(-0.2f); p = new Paragraph(7f, "FINAL DELIVERY TO", blackBoldFont65); p.setAlignment(Element.ALIGN_LEFT); finalCell.addElement(p); bTable.addCell(finalCell); //sea values PdfPCell seavCell = new PdfPCell(); seavCell.setBorder(0); seavCell.setFixedHeight(25f); // seavCell.setBorderWidthBottom(0.06f); p = new Paragraph(7f, "" + podValues.toUpperCase(), totalFontQuote); p.setAlignment(Element.ALIGN_LEFT); seavCell.addElement(p); bTable.addCell(seavCell); //fina deliver values String finalDest = !fdOverride.equalsIgnoreCase("N") ? fdOverride : (agencyInfo != null && CommonUtils.isNotEmpty(agencyInfo[2])) ? agencyInfo[2] : blUtils.getBLConcatenatedFinalDestination(lclbl); PdfPCell finalvCell = new PdfPCell(); finalvCell.setBorder(0); finalvCell.setBorderWidthLeft(0.06f); p = new Paragraph(7f, !finalDest.equalsIgnoreCase(podValues) ? "" + finalDest.toUpperCase() : "", totalFontQuote); p.setAlignment(Element.ALIGN_LEFT); finalvCell.addElement(p); bTable.addCell(finalvCell); bCell.addElement(bTable); table.addCell(bCell); //2column cell = new PdfPCell(); cell.setBorder(0); cell.setPadding(0f); cell.setBorderWidthBottom(0.06f); cell.setBorderWidthTop(0.06f); PdfPTable pTable = new PdfPTable(2); pTable.setWidths(new float[] { 4f, 2f }); pTable.setWidthPercentage(100f); PdfPCell nCell = null; nCell = new PdfPCell(); nCell.setBorder(0); nCell.setPaddingTop(0.2f); p = new Paragraph(7f, "DOCUMENT NO", blackBoldFont65); p.setAlignment(Element.ALIGN_LEFT); nCell.addElement(p); pTable.addCell(nCell); nCell = new PdfPCell(); nCell.setBorder(0); nCell.setPaddingTop(0.2f); p = new Paragraph(7f, "PAGE : " + ++page_count, blackBoldFont65); p.setAlignment(Element.ALIGN_RIGHT); nCell.addElement(p); pTable.addCell(nCell); String consolidateNumber = new LclConsolidateDAO() .getConsolidatesFileNumbers(lclbl.getLclFileNumber().getId().toString()); consolidateNumber = null == consolidateNumber ? lclbl.getLclFileNumber().getFileNumber() : lclbl.getLclFileNumber().getFileNumber() + "," + consolidateNumber; PdfPCell dvCell = new PdfPCell(); dvCell.setBorder(0); dvCell.setColspan(2); dvCell.setBorderWidthBottom(0.06f); dvCell.setPaddingLeft(8f); dvCell.setPaddingBottom(5f); dvCell.setPaddingTop(2f); p = new Paragraph(8f, "" + consolidateNumber.toUpperCase(), totalFontQuote); p.setAlignment(Element.ALIGN_LEFT); dvCell.addElement(p); pTable.addCell(dvCell); PdfPCell eCell = new PdfPCell(); eCell.setBorder(0); eCell.setPaddingTop(0.2f); eCell.setColspan(2); p = new Paragraph(7f, "EXPORT REFERENCE", blackBoldFont65); p.setAlignment(Element.ALIGN_LEFT); eCell.addElement(p); pTable.addCell(eCell); PdfPCell evCell = new PdfPCell(); evCell.setBorder(0); evCell.setColspan(2); evCell.setBorderWidthBottom(0.06f); evCell.setPaddingLeft(8f); evCell.setFixedHeight(35f); exportRefRemarks = exportRefRemarks + ("EXPORT".equalsIgnoreCase(ladenSailDateOptKey) ? ladenSailDateRemarks : "") + ("EXPORT".equalsIgnoreCase(printTermsTypeKey) ? termsType1 : ""); if (exportRefRemarks != null && !exportRefRemarks.equals("")) { p = new Paragraph(10f, "" + exportRefRemarks, totalFontQuote); p.setAlignment(Element.ALIGN_LEFT); } else { p = new Paragraph(8f, "", contentBLNormalFont); } evCell.addElement(p); pTable.addCell(evCell); PdfPCell fCell = new PdfPCell(); fCell.setBorder(0); fCell.setColspan(2); fCell.setPaddingTop(0.2f); p = new Paragraph(7f, "FORWARDING AGENT-REFERENCES", blackBoldFont65); p.setAlignment(Element.ALIGN_LEFT); fCell.addElement(p); pTable.addCell(fCell); //forwarding avlues PdfPCell fvCell = new PdfPCell(); fvCell.setBorder(0); fvCell.setColspan(2); fvCell.setPaddingLeft(3f); fvCell.setPaddingTop(2f); fvCell.setBorderWidthBottom(0.06f); fvCell.setFixedHeight(65f); if (null != lclbl.getFwdAcct() && !lclbl.getFwdAcct().getAccountName().equalsIgnoreCase("NO FRT. FORWARDER ASSIGNED")) { boolean forwarderAcctFlag = new LCLBlDAO() .getFreightForwardAcctStatus(lclbl.getFwdAcct().getAccountno()); String fwdDetails = lclUtils.getConcatenatedAccountDetails(lclbl.getFwdContact()); if (CommonUtils.isNotEmpty(fwdDetails) && !forwarderAcctFlag) { p = new Paragraph(11f, "" + fwdDetails.toUpperCase(), totalFontQuote); p.setSpacingAfter(15f); p.setAlignment(Element.ALIGN_LEFT); } else { p = new Paragraph(8f, "", totalFontQuote); fvCell.setPadding(25f); } fvCell.addElement(p); pTable.addCell(fvCell); } else { p = new Paragraph(8f, "", totalFontQuote); fvCell.setBorderWidthBottom(0.06f); pTable.addCell(fvCell); } //pointoforigin PdfPCell pCell = new PdfPCell(); pCell.setBorder(0); pCell.setColspan(2); pCell.setPaddingTop(0.2f); p = new Paragraph(7f, "POINT AND COUNTRY OF ORIGIN", blackBoldFont65); p.setAlignment(Element.ALIGN_LEFT); pCell.addElement(p); pTable.addCell(pCell); //point avlues PdfPCell pvCell = new PdfPCell(); pvCell.setBorder(0); pvCell.setColspan(2); pvCell.setPaddingLeft(8f); pvCell.setPaddingBottom(5f); pvCell.setPaddingTop(2f); pvCell.setFixedHeight(20f); pvCell.setBorderWidthBottom(0.06f); if (lclbl.getPointOfOrigin() != null) { p = new Paragraph(9f, "" + lclbl.getPointOfOrigin(), totalFontQuote); pvCell.addElement(p); } p.setAlignment(Element.ALIGN_LEFT); pTable.addCell(pvCell); //domes PdfPCell doCell = new PdfPCell(); doCell.setBorder(0); doCell.setColspan(2); doCell.setPaddingTop(0.2f); p = new Paragraph(7f, "DOMESTIC ROUTING/EXPORT INSTRUCTIONS", blackBoldFont65); p.setAlignment(Element.ALIGN_LEFT); doCell.addElement(p); pTable.addCell(doCell); //point avlues PdfPCell dovCell = new PdfPCell(); dovCell.setBorder(0); dovCell.setColspan(2); dovCell.setPaddingLeft(8f); dovCell.setBorderWidthBottom(0.06f); dovCell.setFixedHeight(45f); routingInsRemarks = routingInsRemarks + ("ROUTING".equalsIgnoreCase(ladenSailDateOptKey) ? ladenSailDateRemarks : "") + ("ROUTING".equalsIgnoreCase(printTermsTypeKey) ? termsType1 : ""); if (routingInsRemarks != null && !"".equalsIgnoreCase(routingInsRemarks)) { p = new Paragraph(10f, "" + routingInsRemarks, totalFontQuote); p.setSpacingAfter(10f); p.setAlignment(Element.ALIGN_LEFT); } else { p = new Paragraph(8f, "", contentBLNormalFont); dovCell.setPadding(15f); } dovCell.addElement(p); pTable.addCell(dovCell); //addito PdfPCell adCell = new PdfPCell(); adCell.setBorder(0); adCell.setColspan(2); adCell.setPaddingTop(0.2f); p = new Paragraph(7f, "ADDITIONAL DOCUMENT NUMBERS", blackBoldFont65); p.setAlignment(Element.ALIGN_LEFT); adCell.addElement(p); pTable.addCell(adCell); //add values PdfPCell advCell = new PdfPCell(); advCell.setBorder(0); advCell.setColspan(2); advCell.setPadding(10f); p = new Paragraph(7f, InsStatement, totalFontQuote); p.setAlignment(Element.ALIGN_LEFT); advCell.addElement(p); pTable.addCell(advCell); cell.addElement(pTable); table.addCell(cell); return table; }
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;//from w ww . j a va 2 s.com 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 LinkedHashMap<String, PdfPCell> getTotalCharges(List<LclBlAc> chargeList, List<LclBlPiece> lclBlPiecesList) throws Exception { List formattedChargesList = null; String chargeCode = ""; LinkedHashMap<String, PdfPCell> chargeMap = new LinkedHashMap<String, PdfPCell>(); if (chargeList != null && chargeList.size() > 0 && lclBlPiecesList != null) { if (!"".equalsIgnoreCase(engmet)) { if (lclBlPiecesList.size() == 1) { formattedChargesList = blUtils.getFormattedLabelChargesForBl(lclBlPiecesList, chargeList, engmet, null, true); } else { formattedChargesList = blUtils.getRolledUpChargesForBl(lclBlPiecesList, chargeList, engmet, null, true);/*from w w w . ja v a 2s.c om*/ } } Double bundleMinchg = 0.0; Double flatRateMinimum = 0.0; Double barrelBundlechg = 0.0; Double barrelAmount = 0.0; boolean is_OFBARR_Bundle = false; if (formattedChargesList != null && !formattedChargesList.isEmpty()) { PdfPCell chargeCell = null; Paragraph p = null; for (int i = 0; i < formattedChargesList.size(); i++) { LclBlAc lclBlAc = (LclBlAc) formattedChargesList.get(i); if (lclBlAc.getBundleIntoOf()) { if ("TTBARR".equalsIgnoreCase(lclBlAc.getArglMapping().getChargeCode())) { if (null != lclBlAc.getRolledupCharges()) { barrelBundlechg += lclBlAc.getRolledupCharges().doubleValue(); } else if (!CommonUtils.isEmpty(lclBlAc.getArAmount())) { barrelBundlechg += lclBlAc.getArAmount().doubleValue(); } } else { if ("OFBARR".equalsIgnoreCase(lclBlAc.getArglMapping().getChargeCode())) { is_OFBARR_Bundle = true; } if (null != lclBlAc.getRolledupCharges()) { bundleMinchg += lclBlAc.getRolledupCharges().doubleValue(); } else if (!CommonUtils.isEmpty(lclBlAc.getArAmount())) { bundleMinchg += lclBlAc.getArAmount().doubleValue(); } } } } for (int k = 0; k < formattedChargesList.size(); k++) { LclBlAc lclBlAc = (LclBlAc) formattedChargesList.get(k); if (lclBlAc.getArglMapping().getChargeCode().equals(CommonConstants.OFR_CHARGECODE)) { if (null != lclBlAc.getRolledupCharges()) { flatRateMinimum = lclBlAc.getRolledupCharges().doubleValue() + bundleMinchg; } else if (lclBlAc != null && lclBlAc.getArAmount() != null) { flatRateMinimum = lclBlAc.getArAmount().doubleValue() + bundleMinchg; } } else if (!is_OFBARR_Bundle && lclBlAc.getArglMapping().getChargeCode().equalsIgnoreCase("OFBARR")) { if (null != lclBlAc.getRolledupCharges()) { barrelAmount = lclBlAc.getRolledupCharges().doubleValue() + barrelBundlechg; } else if (lclBlAc.getArAmount() != null) { barrelAmount = lclBlAc.getArAmount().doubleValue() + barrelBundlechg; } } } Iterator sList = formattedChargesList.iterator(); while (sList.hasNext()) { LclBlAc lclBl = (LclBlAc) sList.next(); if (lclBl.getBundleIntoOf()) { sList.remove(); } else if (!lclBl.getPrintOnBl()) { sList.remove(); } } for (int i = 0; i < formattedChargesList.size(); i++) { LclBlAc lclBlAc = (LclBlAc) formattedChargesList.get(i); String chargeDesc = null; String lbl = ""; if (lclBlAc.getArglMapping() != null && CommonUtils.isNotEmpty(lclBlAc.getArglMapping().getChargeCode())) { chargeCode = lclBlAc.getArglMapping().getChargeCode(); chargeDesc = CommonUtils.isNotEmpty(lclBlAc.getArglMapping().getChargeDescriptions()) ? lclBlAc.getArglMapping().getChargeDescriptions() : lclBlAc.getArglMapping().getChargeCode(); } String ar_amountLabel = ""; if (lclBlAc.getArAmount() != null) { if (lclBlAc.getArglMapping().getChargeCode().equals(CommonConstants.OFR_CHARGECODE)) { flatRateMinimum += is_OFBARR_Bundle ? barrelBundlechg : 0; this.total_ar_amount += flatRateMinimum; ar_amountLabel = NumberUtils.convertToTwoDecimal(flatRateMinimum); OCNFRT_Total = NumberUtils.convertToTwoDecimal(flatRateMinimum); } else if (!is_OFBARR_Bundle && lclBlAc.getArglMapping().getChargeCode().equalsIgnoreCase("OFBARR")) { this.total_ar_amount += barrelAmount; ar_amountLabel = NumberUtils.convertToTwoDecimal(barrelAmount); } else if (null != lclBlAc.getRolledupCharges()) { this.total_ar_amount += lclBlAc.getRolledupCharges().doubleValue(); ar_amountLabel = lclBlAc.getRolledupCharges().toString(); } else if (!CommonUtils.isEmpty(lclBlAc.getArAmount())) { this.total_ar_amount += lclBlAc.getArAmount().doubleValue(); ar_amountLabel = lclBlAc.getArAmount().toString(); } } chargeCell = new PdfPCell(); chargeCell.setBorder(0); if (lclBlAc.getRatePerUnitUom().equalsIgnoreCase("W") || lclBlAc.getRatePerUnitUom().equalsIgnoreCase("FRW")) { lbl = "WT"; chargeCell.setPaddingRight(-14); } else if (lclBlAc.getRatePerUnitUom().equalsIgnoreCase("V") || lclBlAc.getRatePerUnitUom().equalsIgnoreCase("FRV")) { lbl = "MEA"; chargeCell.setPaddingRight(-14); } else if (lclBlAc.getRatePerUnitUom().equalsIgnoreCase("M") || lclBlAc.getRatePerUnitUom().equalsIgnoreCase("FRM")) { lbl = "MIN"; chargeCell.setPaddingRight(-14); } else { chargeCell.setPaddingRight(7); } chargeCell.setPaddingLeft(-5); p = new Paragraph(7f, ar_amountLabel + " " + lbl, totalFontQuote); p.setAlignment(Element.ALIGN_RIGHT); chargeCell.addElement(p); int blAcId = lclBlAc.getId().intValue(); chargeMap.put(chargeCode + "#" + chargeDesc + "$" + blAcId, chargeCell); } } } return chargeMap; }
From source file:com.gp.cong.logisoft.lcl.report.LclAllBLPdfCreator.java
public List<LinkedHashMap<String, PdfPCell>> getTotalChargesList(List<LclBlAc> chargeList, List<LclBlPiece> lclBlPiecesList) throws Exception { List<LinkedHashMap<String, PdfPCell>> l = new ArrayList<LinkedHashMap<String, PdfPCell>>(); List formattedChargesList = null; String chargeCode = ""; LinkedHashMap<String, PdfPCell> ppdChargeMap = new LinkedHashMap<String, PdfPCell>(); LinkedHashMap<String, PdfPCell> colChargeMap = new LinkedHashMap<String, PdfPCell>(); Double bundleMinchg = 0.0;/*w ww.java 2 s . co m*/ Double flatRateMinimum = 0.0; Double barrelBundlechg = 0.0; Double barrelAmount = 0.0; boolean is_OFBARR_Bundle = false; PdfPCell chargeCell = null; Paragraph p = null; if (chargeList != null && chargeList.size() > 0 && lclBlPiecesList != null) { String engmet = new PortsDAO() .getEngmet(lclbl.getFinalDestination() != null ? lclbl.getFinalDestination().getUnLocationCode() : lclbl.getPortOfDestination().getUnLocationCode()); if (!"".equalsIgnoreCase(engmet)) { if (lclBlPiecesList.size() == 1) { formattedChargesList = blUtils.getFormattedLabelChargesForBl(lclBlPiecesList, chargeList, engmet, null, true); } else { formattedChargesList = blUtils.getRolledUpChargesForBl(lclBlPiecesList, chargeList, engmet, null, true); } } if (formattedChargesList != null && !formattedChargesList.isEmpty()) { for (int i = 0; i < formattedChargesList.size(); i++) { LclBlAc lclBlAc = (LclBlAc) formattedChargesList.get(i); if (lclBlAc.getBundleIntoOf()) { if ("TTBARR".equalsIgnoreCase(lclBlAc.getArglMapping().getChargeCode())) { if (null != lclBlAc.getRolledupCharges()) { barrelBundlechg += lclBlAc.getRolledupCharges().doubleValue(); } else if (!CommonUtils.isEmpty(lclBlAc.getArAmount())) { barrelBundlechg += lclBlAc.getArAmount().doubleValue(); } } else { if ("OFBARR".equalsIgnoreCase(lclBlAc.getArglMapping().getChargeCode())) { is_OFBARR_Bundle = true; } if (null != lclBlAc.getRolledupCharges()) { bundleMinchg += lclBlAc.getRolledupCharges().doubleValue(); } else if (!CommonUtils.isEmpty(lclBlAc.getArAmount())) { bundleMinchg += lclBlAc.getArAmount().doubleValue(); } } } } for (int k = 0; k < formattedChargesList.size(); k++) { LclBlAc lclBlAc = (LclBlAc) formattedChargesList.get(k); if (lclBlAc.getArglMapping().getChargeCode().equals(CommonConstants.OFR_CHARGECODE)) { if (null != lclBlAc.getRolledupCharges()) { flatRateMinimum = lclBlAc.getRolledupCharges().doubleValue() + bundleMinchg; } else if (lclBlAc != null && lclBlAc.getArAmount() != null) { flatRateMinimum = lclBlAc.getArAmount().doubleValue() + bundleMinchg; } } else if (!is_OFBARR_Bundle && lclBlAc.getArglMapping().getChargeCode().equalsIgnoreCase("OFBARR")) { if (null != lclBlAc.getRolledupCharges()) { barrelAmount = lclBlAc.getRolledupCharges().doubleValue() + barrelBundlechg; } else if (lclBlAc != null && lclBlAc.getArAmount() != null) { barrelAmount = lclBlAc.getArAmount().doubleValue() + barrelBundlechg; } } } Iterator sList = formattedChargesList.iterator(); while (sList.hasNext()) { LclBlAc lclBl = (LclBlAc) sList.next(); if (lclBl.getBundleIntoOf()) { sList.remove(); } else if (!lclBl.getPrintOnBl()) { sList.remove(); } } for (int i = 0; i < formattedChargesList.size(); i++) { LclBlAc lclBlAc = (LclBlAc) formattedChargesList.get(i); String chargeDesc = null; String lbl = ""; if (lclBlAc.getArglMapping() != null && CommonUtils.isNotEmpty(lclBlAc.getArglMapping().getChargeCode())) { chargeCode = lclBlAc.getArglMapping().getChargeCode(); chargeDesc = CommonUtils.isNotEmpty(lclBlAc.getArglMapping().getChargeDescriptions()) ? lclBlAc.getArglMapping().getChargeDescriptions() : lclBlAc.getArglMapping().getChargeCode(); } String ar_amountLabel = ""; if (lclBlAc.getArAmount() != null) { if (lclBlAc.getArglMapping().getChargeCode().equals(CommonConstants.OFR_CHARGECODE)) { flatRateMinimum += is_OFBARR_Bundle ? barrelBundlechg : 0; if ("A".equalsIgnoreCase(lclBlAc.getArBillToParty())) { this.total_ar_col_amount += flatRateMinimum; } else { this.total_ar_ppd_amount += flatRateMinimum; } ar_amountLabel = NumberUtils.convertToTwoDecimal(flatRateMinimum); OCNFRT_Total = NumberUtils.convertToTwoDecimal(flatRateMinimum); } else if (!is_OFBARR_Bundle && lclBlAc.getArglMapping().getChargeCode().equalsIgnoreCase("OFBARR")) { if ("A".equalsIgnoreCase(lclBlAc.getArBillToParty())) { this.total_ar_col_amount += barrelAmount; } else { this.total_ar_ppd_amount += barrelAmount; } ar_amountLabel = NumberUtils.convertToTwoDecimal(barrelAmount); } else if (null != lclBlAc.getRolledupCharges()) { if ("A".equalsIgnoreCase(lclBlAc.getArBillToParty())) { this.total_ar_col_amount += lclBlAc.getRolledupCharges().doubleValue(); } else { this.total_ar_ppd_amount += lclBlAc.getRolledupCharges().doubleValue(); } ar_amountLabel = lclBlAc.getRolledupCharges().toString(); } else if (!CommonUtils.isEmpty(lclBlAc.getArAmount())) { if ("A".equalsIgnoreCase(lclBlAc.getArBillToParty())) { this.total_ar_col_amount += lclBlAc.getArAmount().doubleValue(); } else { this.total_ar_ppd_amount += lclBlAc.getArAmount().doubleValue(); } ar_amountLabel = lclBlAc.getArAmount().toString(); } } chargeCell = new PdfPCell(); chargeCell.setBorder(0); if ("A".equalsIgnoreCase(lclBlAc.getArBillToParty())) { lbl = "COL"; } else { lbl = "PPD"; } chargeCell.setPaddingRight(-14); chargeCell.setPaddingLeft(-5); p = new Paragraph(7f, ar_amountLabel + " " + lbl, totalFontQuote); p.setAlignment(Element.ALIGN_RIGHT); chargeCell.addElement(p); int blAcId = lclBlAc.getId().intValue(); if ("A".equalsIgnoreCase(lclBlAc.getArBillToParty())) { colChargeMap.put(chargeCode + "#" + chargeDesc + "$" + blAcId, chargeCell); } else { ppdBillToSet.add(lclBlAc.getArBillToParty()); ppdChargeMap.put(chargeCode + "#" + chargeDesc + "$" + blAcId, chargeCell); } } if (!ppdChargeMap.isEmpty() && !colChargeMap.isEmpty()) { l.add(0, ppdChargeMap); l.add(1, colChargeMap); } else if (!ppdChargeMap.isEmpty()) { l.add(0, ppdChargeMap); } else if (!colChargeMap.isEmpty()) { l.add(0, colChargeMap); } } } return l; }
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;/*from ww w . j av a 2s .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.reports.DeliveryOrderPdfCreator.java
public PdfPTable lineTable(FclBl bl, String deliveryDate, String realPath) throws Exception { PdfPCell cell = new PdfPCell(); PdfPCell celL = new PdfPCell(); String path = LoadLogisoftProperties.getProperty("application.image.logo"); String econoPath = LoadLogisoftProperties.getProperty("application.image.econo.logo"); String companyCode = new SystemRulesDAO().getSystemRulesByCode("CompanyCode"); PdfPTable table = new PdfPTable(4); table.setWidthPercentage(100);//w w w.j av a2 s . co m Paragraph p = null; cell = new PdfPCell(); cell.setColspan(4); cell.setBorder(0); if (null != bl && bl.getBrand().equalsIgnoreCase("Econo") && ("03").equals(companyCode)) { Image img = Image.getInstance(realPath + econoPath); img.setAlignment(Element.ALIGN_CENTER); img.scalePercent(60); img.setAlignment(Element.ALIGN_TOP); cell.addElement(img); } else if (null != bl && bl.getBrand().equalsIgnoreCase("OTI") && ("02").equals(companyCode)) { Image img = Image.getInstance(realPath + econoPath); img.setAlignment(Element.ALIGN_CENTER); img.scalePercent(60); img.setAlignment(Element.ALIGN_TOP); cell.addElement(img); } else if (null != bl && bl.getBrand().equalsIgnoreCase("Ecu Worldwide")) { Image img = Image.getInstance(realPath + path); img.setAlignment(Element.ALIGN_CENTER); img.scalePercent(60); img.setAlignment(Element.ALIGN_TOP); cell.addElement(img); } table.addCell(cell); cell = new PdfPCell(); cell.setColspan(4); cell.setBorder(0); p = new Paragraph("DELIVERY ORDER", blackBoldFontheading); p.setAlignment(Element.ALIGN_CENTER); cell.addElement(p); table.addCell(cell); cell = new PdfPCell(); cell.setColspan(4); cell.setBorder(0); p = new Paragraph("DATE PRINTED : " + DateUtils.formatStringDateToAppFormatMMM(new Date()), blackFontForAR); p.setAlignment(Element.ALIGN_RIGHT); cell.addElement(p); table.addCell(cell); cell = new PdfPCell(); cell.setBorderWidthBottom(0f); p = new Paragraph(8f, "CONSIGNEE NAME", blackFontForAR); cell.addElement(p); table.addCell(cell); cell = new PdfPCell(); cell.setBorder(0); table.addCell(cell); cell = new PdfPCell(); cell.setBorderWidthBottom(0f); p = new Paragraph(8f, "DATE:", blackFontForAR); cell.addElement(p); table.addCell(cell); cell = new PdfPCell(); cell.setBorderWidthBottom(0f); p = new Paragraph(8f, "REF:", blackFontForAR); cell.addElement(p); table.addCell(cell); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append(CommonUtils.isNotEmpty(bl.getConsigneeName()) ? bl.getConsigneeName() : ""); stringBuilder.append("\n"); stringBuilder.append(CommonUtils.isNotEmpty(bl.getConsigneeAddress()) ? bl.getConsigneeAddress() : ""); cell = new PdfPCell(); cell.setRowspan(2); cell.setBorderWidthTop(0f); p = new Paragraph(8f, stringBuilder.toString(), blackFont); cell.addElement(p); table.addCell(cell); cell = new PdfPCell(); cell.setBorder(0); table.addCell(cell); cell = new PdfPCell(); cell.setBorderWidthTop(0f); p = new Paragraph(8f, deliveryDate, blackFont); cell.addElement(p); table.addCell(cell); cell = new PdfPCell(); cell.setBorderWidthTop(0f); p = new Paragraph(8f, "04-" + bl.getFileNo(), blackFont); cell.addElement(p); table.addCell(cell); cell = new PdfPCell(); cell.setBorder(0); table.addCell(cell); cell = new PdfPCell(); cell.setBorder(0); cell.setColspan(2); p = new Paragraph(8f, "THE MERCHANDISE DESCRIBED BELOW WILL BE ENTERED AND FORWARDED AS FOLLOWS:", blackFontForAR); p.setAlignment(Element.ALIGN_LEFT); cell.addElement(p); table.addCell(cell); return table; }
From source file:com.hris.payroll.reports.AdvancesReportPdf.java
public AdvancesReportPdf(int branchId, Date payrollDate, String reportType) { this.branchId = branchId; this.payrollDate = payrollDate; this.reportType = reportType; Document document = null;//from w w w . ja v a 2 s .c om Rectangle pageSize = new Rectangle(318, 825); try { document = new Document(PageSize.A4.rotate(), 37, 37, 37, 37); PdfWriter writer = PdfWriter.getInstance(document, outputStream); document.open(); int tradeId = cs.getTradeIdByBranchId(branchId); int corporateId = cs.getCorporateIdByTradeId(tradeId); Paragraph reportHeader = new Paragraph(); reportHeader.setAlignment(Element.ALIGN_LEFT); reportHeader.add(new Phrase(cs.getCorporateById(corporateId).toUpperCase(), header)); document.add(reportHeader); reportHeader = new Paragraph(); reportHeader.setAlignment(Element.ALIGN_LEFT); reportHeader.add(new Phrase("Trade: " + cs.getTradeById(tradeId).toUpperCase(), header)); document.add(reportHeader); reportHeader = new Paragraph(); reportHeader.setAlignment(Element.ALIGN_LEFT); reportHeader.add(new Phrase("Branch: " + cs.getBranchById(getBranchId()).toUpperCase(), header)); document.add(reportHeader); reportHeader = new Paragraph(); reportHeader.setAlignment(Element.ALIGN_LEFT); reportHeader.add(new Phrase("Advances Type: " + getReportType(), content)); document.add(reportHeader); reportHeader = new Paragraph(); reportHeader.setAlignment(Element.ALIGN_LEFT); reportHeader.add(new Phrase("Payroll Period: " + CommonUtil.changeDateFormat( ps.findPayrollRegisterByBranch(getBranchId(), getPayrollDate()).getPayrollDate().toString()), content)); document.add(reportHeader); reportHeader = new Paragraph(); reportHeader.setAlignment(Element.ALIGN_LEFT); reportHeader.add(new Phrase("Cut-off Date: " + CommonUtil.changeDateFormat(ps.findPayrollRegisterByBranch(getBranchId(), getPayrollDate()) .getAttendancePeriodFrom().toString()) + " - " + CommonUtil.changeDateFormat(ps.findPayrollRegisterByBranch(getBranchId(), getPayrollDate()) .getAttendancePeriodTo().toString()), content)); document.add(reportHeader); document.add(Chunk.NEWLINE); document.add(Chunk.NEWLINE); PdfPTable table = new PdfPTable(3); // table.setWidthPercentage(100); table.setTotalWidth(new float[] { 180, 120, 300 }); table.setHorizontalAlignment(Element.ALIGN_CENTER); table.getDefaultCell().setBorder(Rectangle.NO_BORDER); PdfPCell cellLabel = new PdfPCell(); Paragraph parLabel = new Paragraph(); parLabel.add(new Phrase("EMPLOYEE", boldFont)); parLabel.setAlignment(Element.ALIGN_LEFT); cellLabel.addElement(parLabel); cellLabel.setVerticalAlignment(Element.ALIGN_MIDDLE); cellLabel.setBorder(Rectangle.BOTTOM); table.addCell(cellLabel); cellLabel = new PdfPCell(); parLabel = new Paragraph(); parLabel.add(new Phrase("AMOUNT", boldFont)); parLabel.setAlignment(Element.ALIGN_RIGHT); cellLabel.addElement(parLabel); cellLabel.setVerticalAlignment(Element.ALIGN_MIDDLE); cellLabel.setBorder(Rectangle.BOTTOM); table.addCell(cellLabel); cellLabel = new PdfPCell(); parLabel = new Paragraph(); parLabel.add(new Phrase("PARTICULARS", boldFont)); parLabel.setAlignment(Element.ALIGN_LEFT); cellLabel.addElement(parLabel); cellLabel.setPaddingLeft(20); cellLabel.setVerticalAlignment(Element.ALIGN_MIDDLE); cellLabel.setBorder(Rectangle.BOTTOM); table.addCell(cellLabel); String middlename; double grandTotalAmount = 0; double subTotalAmount; int prCounter = 0; int advancesCounter; for (PayrollRegister pr : ps.findByBranch(getBranchId(), getPayrollDate())) { if (pr.getMiddlename().isEmpty() || pr.getMiddlename() == null) { middlename = ""; } else { middlename = pr.getMiddlename().toUpperCase(); } String employee = pr.getLastname().toUpperCase() + ", " + pr.getFirstname().toUpperCase() + " " + middlename; subTotalAmount = 0; advancesCounter = 0; for (Advances a : as.findByPayroll(pr.getPayrollId(), getReportType())) { cellLabel = new PdfPCell(); parLabel = new Paragraph(); if (advancesCounter == 0) { parLabel.add(new Phrase(employee, content)); } else { parLabel.add(new Phrase("", content)); } parLabel.setAlignment(Element.ALIGN_LEFT); cellLabel.addElement(parLabel); cellLabel.setVerticalAlignment(Element.ALIGN_MIDDLE); cellLabel.setBorder(Rectangle.NO_BORDER); table.addCell(cellLabel); cellLabel = new PdfPCell(); parLabel = new Paragraph(); parLabel.add(new Phrase(CommonUtil.formatNumValue(a.getAmount()), content)); parLabel.setAlignment(Element.ALIGN_RIGHT); cellLabel.addElement(parLabel); cellLabel.setVerticalAlignment(Element.ALIGN_MIDDLE); subTotalAmount = subTotalAmount + a.getAmount(); advancesCounter++; if (advancesCounter == as.findByPayroll(pr.getPayrollId(), getReportType()).size()) { cellLabel.setBorder(Rectangle.BOTTOM); } else { cellLabel.setBorder(Rectangle.NO_BORDER); } table.addCell(cellLabel); cellLabel = new PdfPCell(); parLabel = new Paragraph(); parLabel.add(new Phrase(a.getParticulars(), content)); parLabel.setAlignment(Element.ALIGN_LEFT); cellLabel.addElement(parLabel); cellLabel.setPaddingLeft(20); cellLabel.setVerticalAlignment(Element.ALIGN_MIDDLE); cellLabel.setBorder(Rectangle.NO_BORDER); table.addCell(cellLabel); } if (subTotalAmount != 0) { subTotal(table, subTotalAmount); } grandTotalAmount = grandTotalAmount + subTotalAmount; prCounter++; } grandTotal(table, grandTotalAmount); document.add(table); } catch (DocumentException ex) { Logger.getLogger(AdvancesReportPdf.class.getName()).log(Level.SEVERE, null, ex); } finally { document.close(); } }
From source file:com.hris.payroll.reports.AdvancesReportPdf.java
private void subTotal(PdfPTable table, double subTotalAmount) { PdfPCell cellLabel = new PdfPCell(); Paragraph parLabel = new Paragraph(); parLabel.add(new Phrase("", content)); parLabel.setAlignment(Element.ALIGN_LEFT); cellLabel.addElement(parLabel);//ww w .j ava 2 s .c om cellLabel.setVerticalAlignment(Element.ALIGN_MIDDLE); cellLabel.setBorder(Rectangle.BOTTOM); cellLabel.setPaddingBottom(10); table.addCell(cellLabel); cellLabel = new PdfPCell(); parLabel = new Paragraph(); parLabel.add(new Phrase( "SUB TOTAL: " + CommonUtil.formatNumValue(CommonUtil.roundOffToTwoDecimalPlaces(subTotalAmount)), content)); parLabel.setAlignment(Element.ALIGN_RIGHT); cellLabel.addElement(parLabel); cellLabel.setVerticalAlignment(Element.ALIGN_MIDDLE); cellLabel.setBorder(Rectangle.BOTTOM); cellLabel.setPaddingBottom(10); table.addCell(cellLabel); cellLabel = new PdfPCell(); parLabel = new Paragraph(); parLabel.add(new Phrase("", content)); parLabel.setAlignment(Element.ALIGN_LEFT); cellLabel.addElement(parLabel); cellLabel.setPaddingLeft(20); cellLabel.setVerticalAlignment(Element.ALIGN_MIDDLE); cellLabel.setBorder(Rectangle.BOTTOM); cellLabel.setPaddingBottom(10); table.addCell(cellLabel); }
From source file:com.hris.payroll.reports.AdvancesReportPdf.java
private void grandTotal(PdfPTable table, double grandTotalAmount) { // PdfPCell cellLabel = new PdfPCell(); // Paragraph parLabel = new Paragraph(); // parLabel.add(new Phrase("", content)); // parLabel.setAlignment(Element.ALIGN_LEFT); // cellLabel.addElement(parLabel); // cellLabel.setVerticalAlignment(Element.ALIGN_MIDDLE); // cellLabel.setBorder(Rectangle.BOTTOM); // cellLabel.setPaddingBottom(10); // table.addCell(cellLabel); PdfPCell cellLabel = new PdfPCell(); Paragraph parLabel = new Paragraph(); parLabel.add(new Phrase( "GRAND TOTAL: " + CommonUtil.formatNumValue(CommonUtil.roundOffToTwoDecimalPlaces(grandTotalAmount)), content));//w w w.j a v a2s . c om parLabel.setAlignment(Element.ALIGN_RIGHT); cellLabel.addElement(parLabel); cellLabel.setColspan(2); cellLabel.setVerticalAlignment(Element.ALIGN_MIDDLE); cellLabel.setBorder(Rectangle.BOTTOM); cellLabel.setPaddingBottom(10); table.addCell(cellLabel); cellLabel = new PdfPCell(); parLabel = new Paragraph(); parLabel.add(new Phrase("", content)); parLabel.setAlignment(Element.ALIGN_LEFT); cellLabel.addElement(parLabel); cellLabel.setPaddingLeft(20); cellLabel.setVerticalAlignment(Element.ALIGN_MIDDLE); cellLabel.setBorder(Rectangle.BOTTOM); cellLabel.setPaddingBottom(10); table.addCell(cellLabel); }