コード例 #1
0
ファイル: TMUtils.java プロジェクト: carriercomm/broadband
  // BEGIN EarlyTerminationChargeCalculations
  public static Map<String, Object> earlyTerminationDatesCalculation(
      Date serviceGivenDate, Date terminationDate) {
    Map<String, Object> map = new HashMap<String, Object>();
    Calendar calHalfAnYearAfterServiceGivenDate = Calendar.getInstance(Locale.CHINA);
    Calendar calLegalTerminationDate = Calendar.getInstance(Locale.CHINA);

    calHalfAnYearAfterServiceGivenDate.setTime(serviceGivenDate);
    calHalfAnYearAfterServiceGivenDate.add(Calendar.MONTH, 6);
    map.put(
        "charge_amount",
        terminationDate.getTime() > calHalfAnYearAfterServiceGivenDate.getTime().getTime()
            ? 99d
            : 199d);

    calLegalTerminationDate.setTime(serviceGivenDate);
    calLegalTerminationDate.add(Calendar.MONTH, 12);
    calLegalTerminationDate.add(Calendar.DAY_OF_MONTH, 1);
    map.put("legal_termination_date", calLegalTerminationDate.getTime());

    String serviceGivenDateStr = TMUtils.dateFormatYYYYMMDD(serviceGivenDate);
    String terminationDateStr = TMUtils.dateFormatYYYYMMDD(terminationDate);
    Integer serviceGivenDateMonth =
        Integer.parseInt(
            serviceGivenDateStr.substring(
                serviceGivenDateStr.indexOf("-") + 1, serviceGivenDateStr.lastIndexOf("-")));
    Integer terminationDateMonth =
        Integer.parseInt(
            terminationDateStr.substring(
                terminationDateStr.indexOf("-") + 1, terminationDateStr.lastIndexOf("-")));
    map.put("months_between_begin_end", terminationDateMonth - serviceGivenDateMonth);

    return map;
  }
コード例 #2
0
 public String getDue_date_str() {
   if (this.getDue_date() != null) {
     this.setDue_date_str(TMUtils.dateFormatYYYYMMDD(this.getDue_date()));
   } else {
     this.setDue_date_str("");
   }
   return due_date_str;
 }
コード例 #3
0
ファイル: TMUtils.java プロジェクト: carriercomm/broadband
  // Retrieve Non-Area code phone number
  public static String retrieveNonAreaCodeVoIPNumber(String phone_number) {

    phone_number = TMUtils.formatPhoneNumber(phone_number);

    if (phone_number.startsWith("064")) {

      phone_number = phone_number.substring(3);

    } else if (phone_number.startsWith("64")) {

      phone_number = phone_number.substring(2);
    }

    phone_number = TMUtils.formatPhoneNumber(phone_number);

    return phone_number;
  }
コード例 #4
0
ファイル: TMUtils.java プロジェクト: carriercomm/broadband
  // Retrieve Area code phone number
  public static String retrieveAreaCodeVoIPNumber(String phone_number) {

    phone_number = TMUtils.formatPhoneNumber(phone_number);

    if (phone_number.startsWith("064")) {

      phone_number = phone_number.substring(1);
    }

    phone_number = TMUtils.formatPhoneNumber(phone_number);

    System.out.println();
    System.out.println("phone_number: " + phone_number);
    System.out.println();

    return phone_number;
  }
コード例 #5
0
ファイル: TMUtils.java プロジェクト: carriercomm/broadband
  // BEGIN Rental Charge Fee
  public static Double getRentalChargeFee(Date startFrom, Double monthlyFee) {

    Double finalChargeFee = 0d;
    Double dailyFee = 0d;
    Integer servedDay = 0;
    Integer maxDay = 0;
    Integer startDay = 0;
    Calendar cal = Calendar.getInstance();
    cal.setTime(startFrom);
    String startFromStr = TMUtils.dateFormatYYYYMMDD(cal.getTime());
    startDay = Integer.parseInt(startFromStr.substring(startFromStr.lastIndexOf("-") + 1));
    maxDay = cal.getMaximum(Calendar.DATE);
    dailyFee = TMUtils.bigDivide(monthlyFee, maxDay);
    servedDay = maxDay - startDay + 1;
    finalChargeFee = TMUtils.bigMultiply(dailyFee, servedDay);

    return finalChargeFee;
  }
コード例 #6
0
ファイル: TMUtils.java プロジェクト: carriercomm/broadband
  // BEGIN TerminationRefundCalculations
  public static Map<String, Object> terminationRefundCalculations(
      Date terminatedDate, Double monthlyCharge) {
    Map<String, Object> map = new HashMap<String, Object>();
    SimpleDateFormat sdf = new SimpleDateFormat("dd");
    Date lastDate = TMUtils.getLastDateOfMonth(terminatedDate);
    Integer maxDay = Integer.parseInt(sdf.format(lastDate));
    Integer terminatedDay = Integer.parseInt(sdf.format(terminatedDate));
    Integer remainingDays = maxDay - terminatedDay;

    BigDecimal bigMaxDay = new BigDecimal(maxDay);
    BigDecimal bigMonthlyCharge = new BigDecimal(monthlyCharge);
    BigDecimal dailyCharge = bigMonthlyCharge.divide(bigMaxDay, 5, BigDecimal.ROUND_DOWN);
    BigDecimal bigRemainingDays = new BigDecimal(remainingDays);

    map.put("remaining_days", remainingDays);
    map.put("refund_amount", dailyCharge.multiply(bigRemainingDays).doubleValue());
    map.put("last_date_of_month", lastDate);

    return map;
  }
コード例 #7
0
 public String getPaid_date_str() {
   this.setPaid_date_str(TMUtils.dateFormatYYYYMMDD(this.getPaid_date()));
   return paid_date_str;
 }
コード例 #8
0
 public String getCreate_date_str() {
   create_date_str = TMUtils.dateFormatYYYYMMDD(this.getCreate_date());
   return create_date_str;
 }
コード例 #9
0
ファイル: TMUtils.java プロジェクト: carriercomm/broadband
  // Billing
  public static void thisWeekBillingStatistic(List<StatisticBilling> statisticBilling) {
    Calendar cal = Calendar.getInstance(Locale.CHINA);
    cal.setFirstDayOfWeek(Calendar.MONDAY); // Monday as first day

    StatisticBilling statistic = new StatisticBilling();
    cal.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
    statistic.setBillingDate(cal.getTime());
    statistic.setBillingWeekDate_str(
        "Mon. " + TMUtils.dateFormatYYYYMMDD(statistic.getBillingDate()));
    statistic.setBillingAmount(0d);
    statisticBilling.add(statistic);

    statistic = null;
    statistic = new StatisticBilling();
    cal.set(Calendar.DAY_OF_WEEK, Calendar.TUESDAY);
    statistic.setBillingDate(cal.getTime());
    statistic.setBillingWeekDate_str(
        "Tues. " + TMUtils.dateFormatYYYYMMDD(statistic.getBillingDate()));
    statistic.setBillingAmount(0d);
    statisticBilling.add(statistic);

    statistic = null;
    statistic = new StatisticBilling();
    cal.set(Calendar.DAY_OF_WEEK, Calendar.WEDNESDAY);
    statistic.setBillingDate(cal.getTime());
    statistic.setBillingWeekDate_str(
        "Wed. " + TMUtils.dateFormatYYYYMMDD(statistic.getBillingDate()));
    statistic.setBillingAmount(0d);
    statisticBilling.add(statistic);

    statistic = null;
    statistic = new StatisticBilling();
    cal.set(Calendar.DAY_OF_WEEK, Calendar.THURSDAY);
    statistic.setBillingDate(cal.getTime());
    statistic.setBillingWeekDate_str(
        "Thur. " + TMUtils.dateFormatYYYYMMDD(statistic.getBillingDate()));
    statistic.setBillingAmount(0d);
    statisticBilling.add(statistic);

    statistic = null;
    statistic = new StatisticBilling();
    cal.set(Calendar.DAY_OF_WEEK, Calendar.FRIDAY);
    statistic.setBillingDate(cal.getTime());
    statistic.setBillingWeekDate_str(
        "Fri. " + TMUtils.dateFormatYYYYMMDD(statistic.getBillingDate()));
    statistic.setBillingAmount(0d);
    statisticBilling.add(statistic);

    statistic = null;
    statistic = new StatisticBilling();
    cal.set(Calendar.DAY_OF_WEEK, Calendar.SATURDAY);
    statistic.setBillingDate(cal.getTime());
    statistic.setBillingWeekDate_str(
        "Sat. " + TMUtils.dateFormatYYYYMMDD(statistic.getBillingDate()));
    statistic.setBillingAmount(0d);
    statisticBilling.add(statistic);

    statistic = null;
    statistic = new StatisticBilling();
    cal.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY);
    statistic.setBillingDate(cal.getTime());
    statistic.setBillingWeekDate_str(
        "Sun. " + TMUtils.dateFormatYYYYMMDD(statistic.getBillingDate()));
    statistic.setBillingAmount(0d);
    statisticBilling.add(statistic);
  }
コード例 #10
0
ファイル: TMUtils.java プロジェクト: carriercomm/broadband
  /**
   * Methods from Calendar BEGIN
   *
   * @param registerCustomers
   */
  public static void thisWeekDateForRegisterStatistic(List<StatisticCustomer> registerCustomers) {
    Calendar cal = Calendar.getInstance(Locale.CHINA);
    cal.setFirstDayOfWeek(Calendar.MONDAY); // Monday as first day

    StatisticCustomer statistic = new StatisticCustomer();
    cal.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
    statistic.setRegisterDate(cal.getTime());
    statistic.setRegisterWeekDate_str(
        "Mon. " + TMUtils.dateFormatYYYYMMDD(statistic.getRegisterDate()));
    statistic.setRegisterCount(0);
    registerCustomers.add(statistic);

    statistic = null;
    statistic = new StatisticCustomer();
    cal.set(Calendar.DAY_OF_WEEK, Calendar.TUESDAY);
    statistic.setRegisterDate(cal.getTime());
    statistic.setRegisterWeekDate_str(
        "Tues. " + TMUtils.dateFormatYYYYMMDD(statistic.getRegisterDate()));
    statistic.setRegisterCount(0);
    registerCustomers.add(statistic);

    statistic = null;
    statistic = new StatisticCustomer();
    cal.set(Calendar.DAY_OF_WEEK, Calendar.WEDNESDAY);
    statistic.setRegisterDate(cal.getTime());
    statistic.setRegisterWeekDate_str(
        "Wed. " + TMUtils.dateFormatYYYYMMDD(statistic.getRegisterDate()));
    statistic.setRegisterCount(0);
    registerCustomers.add(statistic);

    statistic = null;
    statistic = new StatisticCustomer();
    cal.set(Calendar.DAY_OF_WEEK, Calendar.THURSDAY);
    statistic.setRegisterDate(cal.getTime());
    statistic.setRegisterWeekDate_str(
        "Thur. " + TMUtils.dateFormatYYYYMMDD(statistic.getRegisterDate()));
    statistic.setRegisterCount(0);
    registerCustomers.add(statistic);

    statistic = null;
    statistic = new StatisticCustomer();
    cal.set(Calendar.DAY_OF_WEEK, Calendar.FRIDAY);
    statistic.setRegisterDate(cal.getTime());
    statistic.setRegisterWeekDate_str(
        "Fri. " + TMUtils.dateFormatYYYYMMDD(statistic.getRegisterDate()));
    statistic.setRegisterCount(0);
    registerCustomers.add(statistic);

    statistic = null;
    statistic = new StatisticCustomer();
    cal.set(Calendar.DAY_OF_WEEK, Calendar.SATURDAY);
    statistic.setRegisterDate(cal.getTime());
    statistic.setRegisterWeekDate_str(
        "Sat. " + TMUtils.dateFormatYYYYMMDD(statistic.getRegisterDate()));
    statistic.setRegisterCount(0);
    registerCustomers.add(statistic);

    statistic = null;
    statistic = new StatisticCustomer();
    cal.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY);
    statistic.setRegisterDate(cal.getTime());
    statistic.setRegisterWeekDate_str(
        "Sun. " + TMUtils.dateFormatYYYYMMDD(statistic.getRegisterDate()));
    statistic.setRegisterCount(0);
    registerCustomers.add(statistic);
  }
コード例 #11
0
  private void pageHeader(PdfWriter writer)
      throws MalformedURLException, IOException, DocumentException {
    Integer colspan = 15;
    PdfPTable headerTable = newTable().columns(colspan).totalWidth(510F).o();

    // logo & start
    Image logo =
        Image.getInstance("pdf" + File.separator + "img" + File.separator + "logo_top_final.png");
    logo.scaleAbsolute(171f, 45f);
    logo.setAbsolutePosition(44, 760);
    writer.getDirectContent().addImage(logo);

    Phrase t1 = new Phrase("Statement / Tax Invoice", ITextFont.arial_normal_14);
    Phrase t2 =
        new Phrase(
            "GST Registration Number: " + this.getCompanyDetail().getGst_registration_number(),
            ITextFont.lucida_sans_unicode_9);
    PdfContentByte canvas = writer.getDirectContentUnder();
    ColumnText.showTextAligned(canvas, Element.ALIGN_LEFT, t1, 44, 744, 0);
    ColumnText.showTextAligned(canvas, Element.ALIGN_LEFT, t2, 44, 730, 0);

    /*
     * header table begin
     */
    addEmptyCol(headerTable, 34F, colspan);
    addCol(headerTable, this.getCompanyDetail().getName())
        .colspan(colspan)
        .font(ITextFont.arial_normal_8)
        .alignH("r")
        .o();
    addCol(headerTable, this.getCompanyDetail().getBilling_address())
        .colspan(colspan)
        .font(ITextFont.arial_normal_8)
        .alignH("r")
        .o();
    addCol(headerTable, "Tel: " + this.getCompanyDetail().getTelephone())
        .colspan(colspan)
        .font(ITextFont.arial_normal_8)
        .alignH("r")
        .o();
    addCol(headerTable, this.getCompanyDetail().getDomain())
        .colspan(colspan)
        .font(ITextFont.arial_normal_8)
        .alignH("r")
        .o();
    addCol(headerTable, " ")
        .colspan(colspan)
        .borderColor("b", titleBGColor)
        .borderWidth("b", 3F)
        .o();
    /*
     * header table end
     */
    /*
     * invoice basics begin
     */
    addEmptyCol(headerTable, 14F, colspan);
    addEmptyCol(headerTable, 4F, colspan - 4);
    addCol(headerTable, "Customer Id: ").colspan(2).font(ITextFont.arial_bold_8).o();
    addCol(headerTable, this.getCo().getCustomer_id().toString())
        .colspan(2)
        .font(ITextFont.arial_bold_8)
        .alignH("r")
        .o();
    addEmptyCol(headerTable, 4F, colspan - 4);
    addCol(headerTable, "Invoice No: ").colspan(2).font(ITextFont.arial_bold_8).o();
    addCol(headerTable, this.getEtc().getId().toString())
        .colspan(2)
        .font(ITextFont.arial_bold_8)
        .alignH("r")
        .o();
    addEmptyCol(headerTable, 4F, colspan - 4);
    addCol(headerTable, "Date: ").colspan(2).font(ITextFont.arial_bold_8).o();
    addCol(headerTable, TMUtils.retrieveMonthAbbrWithDate(this.getEtc().getCreate_date()))
        .colspan(2)
        .font(ITextFont.arial_bold_8)
        .alignH("r")
        .o();
    addEmptyCol(headerTable, colspan);

    /*
     * invoice basics end
     */
    // complete the table
    headerTable.completeRow();
    // write the table to an absolute position
    PdfContentByte paymentSlipTableCanvas = writer.getDirectContent();
    headerTable.writeSelectedRows(0, -1, 41, 810, paymentSlipTableCanvas);
  }
コード例 #12
0
  public String create() throws DocumentException, MalformedURLException, IOException {
    Document document = new Document(PageSize.A4);

    // Output PDF Path, e.g.: early_termination_charge_60089.pdf
    String outputFile =
        TMUtils.createPath(
            "broadband"
                + File.separator
                + "customers"
                + File.separator
                + this.co.getCustomer_id()
                + File.separator
                + "early_termination_charge_"
                + this.getEtc().getId()
                + ".pdf");

    PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(outputFile));
    document.open();

    /*
     *
     *  FIRST PAGE BEGIN
     *
     */
    super.setGlobalBorderWidth(globalBorderWidth);

    // BASIC INFO
    document.add(createCustomerBasicInfo());

    document.add(createEarlyTerminationChargeDetail());

    /*
     * PAYMENT SLIP TABLE BEGIN
     */

    // CARTOON
    Image cartoon =
        Image.getInstance("pdf" + File.separator + "img" + File.separator + "cartoon_done.png");
    cartoon.scaleAbsolute(80f, 40.5f);
    cartoon.setAbsolutePosition(50, 165);
    writer.getDirectContent().addImage(cartoon);

    { // createPaymentSlip
      PdfPTable paymentSlipTable = newTable().columns(5).totalWidth(535F).o();
      Image img =
          Image.getInstance(
              "pdf" + File.separator + "img" + File.separator + "scissor_separator.png");
      img.setWidthPercentage(100);
      addCol(paymentSlipTable, " ").colspan(5).image(img).o();

      // WHITE TITLE
      addEmptyRow(paymentSlipTable, 4);

      addCol(paymentSlipTable, "Payment Slip")
          .rowspan(4)
          .font(ITextFont.arial_bold_10)
          .paddingTo("t", 6F)
          .o();

      // LIGHT GRAY TITLE
      addCol(paymentSlipTable, " ")
          .bgColor(new BaseColor(234, 234, 234))
          .borderColor(BaseColor.WHITE)
          .border("r", 1F)
          .o();
      addCol(paymentSlipTable, " ")
          .bgColor(new BaseColor(234, 234, 234))
          .borderColor(BaseColor.WHITE)
          .border("r", 1F)
          .o();
      addCol(paymentSlipTable, " ").bgColor(new BaseColor(234, 234, 234)).o();

      // LIGHT GRAY CONTENT
      addCol(paymentSlipTable, "Customer ID")
          .font(ITextFont.arial_bold_8)
          .bgColor(new BaseColor(234, 234, 234))
          .borderColor(BaseColor.WHITE)
          .border("r", 1F)
          .indent(14F)
          .o();
      addCol(paymentSlipTable, "Invoice Number")
          .font(ITextFont.arial_bold_8)
          .bgColor(new BaseColor(234, 234, 234))
          .borderColor(BaseColor.WHITE)
          .border("r", 1F)
          .indent(14F)
          .o();
      addCol(paymentSlipTable, "Due Date")
          .font(ITextFont.arial_bold_8)
          .bgColor(new BaseColor(234, 234, 234))
          .indent(14F)
          .o();

      // LIGHT GRAY VALUE
      addCol(paymentSlipTable, this.getCo().getCustomer_id().toString())
          .font(ITextFont.arial_normal_6)
          .bgColor(new BaseColor(234, 234, 234))
          .borderColor(BaseColor.WHITE)
          .border("r", 1F)
          .paddingTo("t", 6F)
          .indent(14F)
          .o();
      addCol(paymentSlipTable, this.etc.getId().toString())
          .font(ITextFont.arial_normal_7)
          .bgColor(new BaseColor(234, 234, 234))
          .borderColor(BaseColor.WHITE)
          .border("r", 1F)
          .paddingTo("t", 6F)
          .indent(14F)
          .o();
      addCol(paymentSlipTable, TMUtils.retrieveMonthAbbrWithDate(this.etc.getDue_date()))
          .font(ITextFont.arial_normal_7)
          .bgColor(new BaseColor(234, 234, 234))
          .paddingTo("t", 6F)
          .indent(14F)
          .o();
      addCol(paymentSlipTable, " ")
          .bgColor(new BaseColor(234, 234, 234))
          .borderColor(BaseColor.WHITE)
          .border("r", 1F)
          .o();
      addCol(paymentSlipTable, " ")
          .bgColor(new BaseColor(234, 234, 234))
          .borderColor(BaseColor.WHITE)
          .border("r", 1F)
          .o();
      addCol(paymentSlipTable, " ").bgColor(new BaseColor(234, 234, 234)).o();

      // SEPARATOR BEGIN
      addEmptyCol(paymentSlipTable, 2F, 5);
      // SEPARATOR END

      // SECOND SECTION
      addCol(paymentSlipTable, "Paying By Direct Credit")
          .colspan(2)
          .font(ITextFont.arial_normal_8)
          .indent(4F)
          .o();
      addCol(paymentSlipTable, "Total amount due before")
          .rowspan(2)
          .font(ITextFont.arial_normal_white_8)
          .bgColor(totleChequeAmountBGColor)
          .paddingTo("t", 8F)
          .indent(14F)
          .o();
      addCol(paymentSlipTable, this.getEtc().getDue_date_str())
          .rowspan(2)
          .font(ITextFont.arial_normal_white_8)
          .bgColor(totleChequeAmountBGColor)
          .paddingTo("t", 8F)
          .indent(32F)
          .o();
      // input box begin
      addCol(
              paymentSlipTable,
              TMUtils.fillDecimalPeriod(String.valueOf(this.etc.getCharge_amount())))
          .rowspan(2)
          .font(ITextFont.arial_normal_8)
          .bgColor(BaseColor.WHITE)
          .borderColor(totleChequeAmountBGColor)
          .borderZoom(8F)
          .alignH("r")
          .o();
      // input box end
      addCol(paymentSlipTable, "Bank: " + this.getCompanyDetail().getBank_name())
          .colspan(2)
          .font(ITextFont.arial_normal_8)
          .indent(4F)
          .o();
      addCol(paymentSlipTable, "Name of Account: " + this.getCompanyDetail().getBank_account_name())
          .colspan(2)
          .font(ITextFont.arial_normal_8)
          .indent(4F)
          .o();
      addCol(paymentSlipTable, "Total amount due after")
          .rowspan(2)
          .font(ITextFont.arial_normal_white_8)
          .bgColor(totleChequeAmountBGColor)
          .paddingTo("t", 8F)
          .indent(14F)
          .o();
      addCol(paymentSlipTable, this.getEtc().getDue_date_str())
          .rowspan(2)
          .font(ITextFont.arial_normal_white_8)
          .bgColor(totleChequeAmountBGColor)
          .paddingTo("t", 8F)
          .indent(32F)
          .o();
      // input box begin
      addCol(
              paymentSlipTable,
              TMUtils.fillDecimalPeriod(String.valueOf(this.etc.getTotal_payable_amount())))
          .rowspan(2)
          .font(ITextFont.arial_normal_8)
          .bgColor(BaseColor.WHITE)
          .borderColor(totleChequeAmountBGColor)
          .borderZoom(8F)
          .alignH("r")
          .o();
      // input box end
      addCol(
              paymentSlipTable,
              "Account Number: " + this.getCompanyDetail().getBank_account_number())
          .colspan(2)
          .font(ITextFont.arial_normal_8)
          .indent(4F)
          .o();

      // THIRD SECTION
      addEmptyCol(paymentSlipTable, 1F, 5);

      // SEPARATOR BEGIN
      // SEPARATOR END

      addCol(paymentSlipTable, "Paying by cheques")
          .colspan(3)
          .font(ITextFont.arial_normal_white_8)
          .bgColor(totleChequeAmountBGColor)
          .paddingTo("t", 4F)
          .indent(4F)
          .o();
      addCol(paymentSlipTable, "ENCLOSED AMOUNT")
          .colspan(2)
          .font(ITextFont.arial_bold_white_10)
          .bgColor(totleChequeAmountBGColor)
          .paddingTo("t", 4F)
          .indent(40F)
          .o();
      addCol(
              paymentSlipTable,
              "Please make cheques payable to " + this.companyDetail.getName() + " and")
          .colspan(3)
          .font(ITextFont.arial_normal_white_8)
          .bgColor(totleChequeAmountBGColor)
          .indent(4F)
          .o();

      // BEGIN BOX
      addCol(paymentSlipTable, " ")
          .colspan(2)
          .rowspan(4)
          .bgColor(BaseColor.WHITE)
          .paddingTo("l", 42F)
          .paddingTo("t", 6F)
          .borderColor(totleChequeAmountBGColor)
          .border("r", 20F)
          .o();
      // END BOX

      addCol(paymentSlipTable, "write your Name and Phone Number on the back of your cheque.")
          .colspan(3)
          .font(ITextFont.arial_normal_white_8)
          .bgColor(totleChequeAmountBGColor)
          .indent(4F)
          .o();
      addCol(paymentSlipTable, " ").colspan(3).bgColor(totleChequeAmountBGColor).o();
      addCol(paymentSlipTable, "Please post it with this payment slip to")
          .colspan(3)
          .font(ITextFont.arial_normal_white_8)
          .bgColor(totleChequeAmountBGColor)
          .indent(4F)
          .o();
      addCol(
              paymentSlipTable,
              this.getCompanyDetail().getName()
                  + "   "
                  + this.getCompanyDetail().getBilling_address())
          .colspan(3)
          .font(ITextFont.arial_normal_white_8)
          .bgColor(totleChequeAmountBGColor)
          .indent(4F)
          .o();
      addCol(paymentSlipTable, "** PLEASE DO NOT SEND CASH")
          .colspan(2)
          .font(ITextFont.arial_normal_white_8)
          .bgColor(totleChequeAmountBGColor)
          .indent(40F)
          .o();
      addEmptyCol(paymentSlipTable, 2F, 5);
      // complete the table
      paymentSlipTable.completeRow();
      // write the table to an absolute position
      PdfContentByte paymentSlipTableCanvas = writer.getDirectContent();
      paymentSlipTable.writeSelectedRows(
          0,
          -1,
          (PageSize.A4.getWidth() - paymentSlipTable.getTotalWidth()) / 2,
          paymentSlipTable.getTotalHeight() + 28,
          paymentSlipTableCanvas);
      /*
       * PAYMENT SLIP TABLE END
       */
    }

    // FIRST PAGE'S HEADER
    pageHeader(writer);
    /*
     *
     *  FIRST PAGE END
     *
     */

    // CLOSE DOCUMENT
    document.close();
    return outputFile;
  }
コード例 #13
0
  // BEGIN EARLY TERMINATION CHARGE DETAIL
  private PdfPTable createEarlyTerminationChargeDetail() {
    PdfPTable chargeDetailTable = new PdfPTable(15);
    chargeDetailTable.setWidthPercentage(96);
    addCol(chargeDetailTable, "Recent Invoice Detail")
        .colspan(15)
        .bgColor(titleBGColor)
        .font(ITextFont.arial_bold_white_10)
        .paddingV(4F)
        .paddingTo("l", 10F)
        .o();
    addEmptyCol(chargeDetailTable, 10F, 15);
    addCol(chargeDetailTable, "Service Given Date")
        .colspan(3)
        .font(ITextFont.arial_bold_8)
        .alignH("c")
        .o();
    addCol(chargeDetailTable, "Service Terminated Date")
        .colspan(3)
        .font(ITextFont.arial_bold_8)
        .alignH("c")
        .o();
    addCol(chargeDetailTable, "Description")
        .colspan(3)
        .font(ITextFont.arial_bold_8)
        .alignH("c")
        .o();
    addCol(chargeDetailTable, "Charge Amount")
        .colspan(3)
        .font(ITextFont.arial_bold_8)
        .alignH("r")
        .o();
    addCol(chargeDetailTable, "Total Payable Amount")
        .colspan(3)
        .font(ITextFont.arial_bold_8)
        .alignH("r")
        .o();
    addEmptyCol(chargeDetailTable, 6F, 15);
    addLineCol(chargeDetailTable, 15, titleBorderColor, 1F);
    addEmptyCol(chargeDetailTable, 6F, 15);
    addCol(
            chargeDetailTable,
            TMUtils.retrieveMonthAbbrWithDate(this.getEtc().getService_given_date()))
        .colspan(3)
        .font(ITextFont.arial_normal_8)
        .alignH("c")
        .o();
    addCol(
            chargeDetailTable,
            TMUtils.retrieveMonthAbbrWithDate(this.getEtc().getTermination_date()))
        .colspan(3)
        .font(ITextFont.arial_normal_8)
        .alignH("c")
        .o();
    addCol(chargeDetailTable, "early termination detail")
        .colspan(3)
        .font(ITextFont.arial_normal_8)
        .alignH("c")
        .o();
    addCol(
            chargeDetailTable,
            TMUtils.fillDecimalPeriod(String.valueOf(this.getEtc().getCharge_amount())))
        .colspan(3)
        .font(ITextFont.arial_bold_8)
        .alignH("r")
        .o();
    addCol(chargeDetailTable, "").colspan(3).font(ITextFont.arial_bold_8).alignH("r").o();

    addEmptyCol(chargeDetailTable, 10F, 15);
    addLineCol(chargeDetailTable, 15, titleBorderColor, 1F);
    addEmptyCol(chargeDetailTable, 6F, 15);
    addCol(
            chargeDetailTable,
            "Total amount due defore "
                + TMUtils.retrieveMonthAbbrWithDate(this.getEtc().getDue_date())
                + " :")
        .colspan(12)
        .font(ITextFont.arial_normal_8)
        .alignH("r")
        .o();
    addCol(
            chargeDetailTable,
            TMUtils.fillDecimalPeriod(String.valueOf(this.getEtc().getCharge_amount()))
                + " (inc GST)")
        .colspan(3)
        .font(ITextFont.arial_bold_8)
        .alignH("r")
        .o();
    addCol(
            chargeDetailTable,
            "Total amount due after "
                + TMUtils.retrieveMonthAbbrWithDate(this.getEtc().getDue_date())
                + " :")
        .colspan(12)
        .font(ITextFont.arial_normal_8)
        .alignH("r")
        .o();
    addCol(
            chargeDetailTable,
            TMUtils.fillDecimalPeriod(String.valueOf(this.getEtc().getTotal_payable_amount()))
                + " (inc GST)")
        .colspan(3)
        .font(ITextFont.arial_bold_8)
        .alignH("r")
        .o();

    addEmptyCol(chargeDetailTable, 10F, 15);
    addCol(chargeDetailTable, "Plan Detail")
        .colspan(15)
        .bgColor(titleBGColor)
        .font(ITextFont.arial_bold_white_10)
        .paddingV(4F)
        .paddingTo("l", 10F)
        .o();
    addEmptyCol(chargeDetailTable, 10F, 15);
    addCol(chargeDetailTable, "Plan End Date")
        .colspan(3)
        .font(ITextFont.arial_bold_8)
        .alignH("c")
        .o();
    addCol(chargeDetailTable, "").colspan(12).o();
    addEmptyCol(chargeDetailTable, 6F, 15);
    addLineCol(chargeDetailTable, 15, titleBorderColor, 1F);
    addEmptyCol(chargeDetailTable, 6F, 15);
    addCol(
            chargeDetailTable,
            TMUtils.retrieveMonthAbbrWithDate(this.getEtc().getLegal_termination_date()))
        .colspan(3)
        .font(ITextFont.arial_normal_8)
        .alignH("c")
        .o();
    addCol(chargeDetailTable, "").colspan(12).o();

    return chargeDetailTable;
  }