private List<RowModel> populateMonths() {
    List<Map> ds1 = (List<Map>) dataSources.get(0);
    List<RowModel> rowModels = new ArrayList<RowModel>();
    Map<String, Double> mRowModel = new HashMap<String, Double>();
    RowModel rowModel;
    Map ds = null;
    for (int j = 0; j < ds1.size(); j++) {
      ds = ds1.get(j);
      mRowModel = existsRowModel(mRowModel, "01Jan", (Double) ds.get("JAN"));
      mRowModel = existsRowModel(mRowModel, "02Feb", (Double) ds.get("FEB"));
      mRowModel = existsRowModel(mRowModel, "03Mar", (Double) ds.get("MAR"));
      mRowModel = existsRowModel(mRowModel, "04Apr", (Double) ds.get("APR"));
      mRowModel = existsRowModel(mRowModel, "05Mei", (Double) ds.get("MEI"));
      mRowModel = existsRowModel(mRowModel, "06Jun", (Double) ds.get("JUN"));
      mRowModel = existsRowModel(mRowModel, "07Jul", (Double) ds.get("JUL"));
      mRowModel = existsRowModel(mRowModel, "08Ags", (Double) ds.get("AGUS"));
      mRowModel = existsRowModel(mRowModel, "09Sep", (Double) ds.get("SEP"));
      mRowModel = existsRowModel(mRowModel, "10Okt", (Double) ds.get("OKT"));
      mRowModel = existsRowModel(mRowModel, "11Nov", (Double) ds.get("NOV"));
      mRowModel = existsRowModel(mRowModel, "12Dec", (Double) ds.get("DES"));
    }

    String key = null;
    Iterator iterator = mRowModel.keySet().iterator();
    while (iterator.hasNext()) {
      key = (String) iterator.next();
      rowModels.add(new RowModel(key, mRowModel.get(key)));
    }
    return rowModels;
  }
  private JasperReportBuilder build() {
    List ds1 = (List) dataSources.get(0);
    List<RowModel> rowModels = populateMonths();
    Collections.sort(
        rowModels,
        new Comparator<RowModel>() {
          @Override
          public int compare(RowModel o1, RowModel o2) {
            return o1.getId().compareTo(o2.getId());
          }
        });

    TextColumnBuilder<String> tcbMonth = col.column("Month", "key", type.stringType());
    TextColumnBuilder<Double> tcbTotal = BRG.columnDb("Total", "value");

    Bar3DChartBuilder monthChart =
        cht.bar3DChart()
            .setTitle(config.getReportTitle())
            .setCategory(tcbMonth)
            .addSerie(cht.serie(tcbTotal));

    TextColumnBuilder<String> tcbDescription =
        col.column("Airlane", new WordSimpleExpression("AIR_NAME"))
            .setDataType(type.stringType())
            .addProperty(JasperProperty.EXPORT_XLS_FIT_WIDTH, "true")
            .addProperty(JasperProperty.EXPORT_XLS_WRAP_TEXT, "false");
    // Column Table
    TextColumnBuilder<Double> tcbJanAmt = BRG.columnDb("Jan", "JAN");
    TextColumnBuilder<Double> tcbFebAmt = BRG.columnDb("Feb", "FEB");
    TextColumnBuilder<Double> tcbMarAmt = BRG.columnDb("Mar", "MAR");
    TextColumnBuilder<Double> tcbAprAmt = BRG.columnDb("Apr", "APR");
    TextColumnBuilder<Double> tcbMeiAmt = BRG.columnDb("Mei", "MEI");
    TextColumnBuilder<Double> tcbJunAmt = BRG.columnDb("Jun", "JUN");
    TextColumnBuilder<Double> tcbJulAmt = BRG.columnDb("Jul", "JUL");
    TextColumnBuilder<Double> tcbAgsAmt = BRG.columnDb("Agus", "AGUS");
    TextColumnBuilder<Double> tcbSepAmt = BRG.columnDb("Sep", "SEP");
    TextColumnBuilder<Double> tcbOktAmt = BRG.columnDb("Okt", "OKT");
    TextColumnBuilder<Double> tcbNovAmt = BRG.columnDb("Nop", "NOV");
    TextColumnBuilder<Double> tcbDecAmt = BRG.columnDb("Des", "DES");
    TextColumnBuilder<Double> tcbQ1Amt = BRG.columnDb("Q1", "Q1");
    TextColumnBuilder<Double> tcbQ2Amt = BRG.columnDb("Q2", "Q2");
    TextColumnBuilder<Double> tcbQ3Amt = BRG.columnDb("Q3", "Q3");
    TextColumnBuilder<Double> tcbQ4Amt = BRG.columnDb("Q4", "Q4");

    JasperExpression<Double> sms1Expression = exp.jasperSyntax("$F{Q1} + $F{Q2}", Double.class);
    JasperExpression<Double> sms2Expression = exp.jasperSyntax("$F{Q3} + $F{Q4}", Double.class);

    TextColumnBuilder<Double> tcbSms1Amt =
        BRG.columnDb("Semester 1", sms1Expression).setDataType(Rpt_Templates.currencyTypeDb);
    TextColumnBuilder<Double> tcbSms2Amt =
        BRG.columnDb("Semester 2", sms2Expression).setDataType(Rpt_Templates.currencyTypeDb);

    JasperReportBuilder jrb1 = BRG.report2();
    jrb1.fields(field("AIR_NAME", type.stringType()));
    jrb1.setTemplate(Rpt_Templates.reportTemplate);
    jrb1.setPageFormat(PageType.LEGAL, PageOrientation.LANDSCAPE);
    jrb1.setDataSource(ds1);
    jrb1.columns(
        tcbDescription,
        tcbJanAmt,
        tcbFebAmt,
        tcbMarAmt,
        tcbAprAmt,
        tcbMeiAmt,
        tcbJunAmt,
        tcbJulAmt,
        tcbAgsAmt,
        tcbSepAmt,
        tcbOktAmt,
        tcbNovAmt,
        tcbDecAmt);
    jrb1.subtotalsAtSummary(
        sbt.text("Total", tcbDescription),
        sbt.sum(tcbJanAmt),
        sbt.sum(tcbFebAmt),
        sbt.sum(tcbMarAmt),
        sbt.sum(tcbAprAmt),
        sbt.sum(tcbMeiAmt),
        sbt.sum(tcbJunAmt),
        sbt.sum(tcbJulAmt),
        sbt.sum(tcbAgsAmt),
        sbt.sum(tcbSepAmt),
        sbt.sum(tcbOktAmt),
        sbt.sum(tcbNovAmt),
        sbt.sum(tcbDecAmt));

    JasperReportBuilder jrb2 = BRG.report2();
    jrb2.setDataSource(rowModels);
    jrb2.title(
        cmp.verticalList(
            cmp.verticalGap(5),
            cmp.horizontalFlowList(monthChart, commentBox(config.getComment()))
                .setPositionType(ComponentPositionType.FIX_RELATIVE_TO_TOP),
            cmp.verticalGap(5)));

    JasperReportBuilder jrb3 = BRG.report2();
    jrb3.fields(field("AIR_NAME", type.stringType()));
    jrb3.setTemplate(Rpt_Templates.reportTemplate);
    jrb3.setDataSource(ds1);
    jrb3.columns(tcbDescription, tcbQ1Amt, tcbQ2Amt, tcbQ3Amt, tcbQ4Amt);
    jrb3.subtotalsAtSummary(
        sbt.text("Total", tcbDescription),
        sbt.sum(tcbQ1Amt),
        sbt.sum(tcbQ2Amt),
        sbt.sum(tcbQ3Amt),
        sbt.sum(tcbQ4Amt));

    JasperReportBuilder jrb4 = BRG.report2();
    jrb4.fields(field("AIR_NAME", type.stringType()));
    jrb4.setTemplate(Rpt_Templates.reportTemplate);
    jrb4.setDataSource(ds1);
    jrb4.fields(field("Q1", type.doubleType()));
    jrb4.fields(field("Q2", type.doubleType()));
    jrb4.fields(field("Q3", type.doubleType()));
    jrb4.fields(field("Q4", type.doubleType()));
    jrb4.columns(tcbDescription, tcbSms1Amt, tcbSms2Amt);
    jrb4.subtotalsAtSummary(
        sbt.text("Total", tcbDescription), sbt.sum(tcbSms1Amt), sbt.sum(tcbSms2Amt));

    JasperReportBuilder jrb0 = BRG.report2();
    jrb0.setTemplate(Rpt_Templates.reportTemplate);
    jrb0.setPageFormat(PageType.A4, PageOrientation.LANDSCAPE);
    jrb0.title(
        Rpt_Templates.createTitleComponent(config.getReportTitle()),
        cmp.verticalList(
            cmp.subreport(jrb2),
            cmp.subreport(jrb1),
            cmp.pageBreak(),
            cmp.subreport(jrb3),
            cmp.pageBreak(),
            cmp.subreport(jrb4)));

    return jrb0;
  }