Example usage for com.itextpdf.text Paragraph setAlignment

List of usage examples for com.itextpdf.text Paragraph setAlignment

Introduction

In this page you can find the example usage for com.itextpdf.text Paragraph setAlignment.

Prototype

public void setAlignment(int alignment) 

Source Link

Document

Sets the alignment of this paragraph.

Usage

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;/*from w ww  . j  a v a  2 s  .  c  o  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  w  w w  .j av  a  2s  . c  om*/
    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(",");
    }/*from w ww .  jav  a  2s  . co  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("-");
        }/*from   ww w .j av 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;
    table = new PdfPTable(1);
    table.setWidthPercentage(100f);//from   w  w  w  .  ja  v a  2  s.  c  om
    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;
}

From source file:com.gp.cong.logisoft.lcl.report.LclVoyageNotificationPdfCreator.java

public PdfPTable voyContent(String voyContent) throws DocumentException, Exception {
    Paragraph pHeading = null;
    table = new PdfPTable(1);
    table.setWidthPercentage(100f);//  w  w  w  .j ava2  s  .  co  m
    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, "Voyage Comments", mainHeadingQuote);
    pHeading.setAlignment(Element.ALIGN_CENTER);
    cell1.addElement(pHeading);
    //company Name
    PdfPTable ntable1 = new PdfPTable(2);
    ntable1.setWidthPercentage(100f);
    ntable1.setWidths(new float[] { 0.1f, 5f });
    ntable1.addCell(createEmptyCell(0, 0.1f, 2));

    ntable1.addCell(createEmptyCell(0, 1f, 0));
    cell = new PdfPCell();
    cell.setBorder(0);
    pHeading = new Paragraph(8f, "" + voyContent.toUpperCase(), blackContentBoldFont);
    cell.addElement(pHeading);
    ntable1.addCell(cell);

    ntable1.addCell(createEmptyCell(0, 2f, 2));
    cell1.addElement(ntable1);
    table.addCell(cell1);
    return table;
}

From source file:com.gp.cong.logisoft.lcl.report.LclVoyageNotificationPdfCreator.java

public PdfPTable thankyouMsg(String contextPath) throws DocumentException, Exception {
    BaseFont palationRomanBase = BaseFont.createFont(contextPath + "/ttf/palabi.ttf", BaseFont.IDENTITY_H,
            BaseFont.EMBEDDED);//w w w .j a v a 2 s  .c o  m
    Font palatinoRomanSmallFont = new Font(palationRomanBase, 8.5f, Font.ITALIC, new BaseColor(00, 102, 12));
    table = new PdfPTable(1);
    table.setWidthPercentage(100f);
    table.addCell(createEmptyCell(0, 10f, 0));
    cell = new PdfPCell();
    cell.setBorder(0);
    Paragraph pContent = new Paragraph(8f,
            "Thank you for choosing Econocaribe Consolidators, Inc. for your international shipping needs. \n Please contact us if you have any questions at 1-866-ECONO-IT (866-326-6648) or visit us at www.econocaribe.com.",
            palatinoRomanSmallFont);
    pContent.setAlignment(Element.ALIGN_CENTER);
    cell.addElement(pContent);
    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  ww .  j  av a 2  s  . c  o 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;// w  w w . ja v  a 2s.  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);/*from ww  w.  j  a v  a  2 s  .c o  m*/
    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);
}