Пример #1
0
  protected void racunica(QueryDataSet tmpSet) {
    String misec;

    tmpSet.first();

    if (getCkup().equalsIgnoreCase("")) {
      this.killAllReports();
      this.addReport(
          "hr.restart.robno.repStatsMonths",
          "hr.restart.robno.repStatsMonths",
          "StatsMonths",
          "bla bla bla");
      do {
        misec = tmpSet.getTimestamp("DATDOK").toString().substring(5, 7);
        if (!lookupData.getlookupData().raLocate(monthSet, "CPAR", tmpSet.getInt("CPAR") + "")) {
          monthSet.insertRow(false);
          monthSet.setInt("CPAR", tmpSet.getInt("CPAR"));
          monthSet.setBigDecimal(misec, tmpSet.getBigDecimal("IPRODSP"));
          monthSet.setBigDecimal("UKUPNO", tmpSet.getBigDecimal("IPRODSP"));
        } else {
          monthSet.setBigDecimal(
              misec, monthSet.getBigDecimal(misec).add(tmpSet.getBigDecimal("IPRODSP")));
          monthSet.setBigDecimal(
              "UKUPNO", monthSet.getBigDecimal("UKUPNO").add(tmpSet.getBigDecimal("IPRODSP")));
        }

      } while (tmpSet.next());

      monthSet.getColumn("CART").setVisible(0);
      monthSet.getColumn("CART1").setVisible(0);
      monthSet.getColumn("BC").setVisible(0);
      monthSet.getColumn("NAZART").setVisible(0);

      if (fieldSet.getString("SLJED").equals("CPAR")) {
        monthSet.setSort(new SortDescriptor(new String[] {fieldSet.getString("SLJED")}));

      } else {
        monthSet.setSort(
            new SortDescriptor(new String[] {fieldSet.getString("SLJED")}, true, true));

        this.addReport(
            "hr.restart.robno.RepStatParMonthsChart",
            "hr.restart.robno.RepStatParMonthsChart",
            "Top lista kupaca mjeseèno - grafikon");
      }

    } else {
      this.killAllReports();
      this.addReport(
          "hr.restart.robno.repStatsMonthsArt",
          "hr.restart.robno.repStatsMonths",
          "StatsMonthsArt",
          "bla bla bla");

      do {
        misec = tmpSet.getTimestamp("DATDOK").toString().substring(5, 7);
        if (!lookupData.getlookupData().raLocate(monthSet, "CART", tmpSet.getInt("CART") + "")) {
          monthSet.insertRow(false);
          monthSet.setInt("CART", tmpSet.getInt("CART"));
          monthSet.setString("CART1", tmpSet.getString("CART1"));
          monthSet.setString("BC", tmpSet.getString("BC"));
          monthSet.setString("NAZART", tmpSet.getString("NAZART"));
          monthSet.setBigDecimal(misec, tmpSet.getBigDecimal("IPRODSP"));
          monthSet.setBigDecimal("UKUPNO", tmpSet.getBigDecimal("IPRODSP"));
        } else {
          monthSet.setBigDecimal(
              misec, monthSet.getBigDecimal(misec).add(tmpSet.getBigDecimal("IPRODSP")));
          monthSet.setBigDecimal(
              "UKUPNO", monthSet.getBigDecimal("UKUPNO").add(tmpSet.getBigDecimal("IPRODSP")));
        }
      } while (tmpSet.next());

      monthSet.getColumn("CART").setVisible(0);
      monthSet.getColumn("CART1").setVisible(0);
      monthSet.getColumn("BC").setVisible(0);
      monthSet.getColumn("CPAR").setVisible(0);
      monthSet.getColumn(Aut.getAut().getCARTdependable("CART", "CART1", "BC")).setVisible(1);

      monthSet.setSort(new SortDescriptor(new String[] {"UKUPNO"}, true, true));
    }

    monthSet.first();
    dm.getPartneri().open();
    String[] mpb =
        new String[] {"01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"};

    do {
      for (int i = 0; i < mpb.length; i++) {
        monthSetGraph.insertRow(false);
        monthSetGraph.setInt("CPAR", monthSet.getInt("CPAR"));

        if (lookupData
            .getlookupData()
            .raLocate(dm.getPartneri(), "CPAR", monthSet.getInt("CPAR") + "")) {
          monthSetGraph.setString("NAZPAR", dm.getPartneri().getString("NAZPAR"));
        } else {
          monthSetGraph.setString("NAZPAR", "");
        }
        monthSetGraph.setBigDecimal("UKUPNO", monthSet.getBigDecimal("UKUPNO"));

        monthSetGraph.setString("MJESEC", mpb[i]);
        monthSetGraph.setBigDecimal("IZNOS", monthSet.getBigDecimal(mpb[i]));
      }
    } while (monthSet.next());

    monthSetGraph.setSort(new SortDescriptor(new String[] {"UKUPNO", "CPAR"}, true, true));

    monthSet.last();
    setDataSetAndSums(
        monthSet,
        new String[] {
          "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "UKUPNO"
        });
  }
Пример #2
0
  public void okPress() {

    // to be changed
    //  	jbChart.setVisible(true);

    String selectString = getUpit();

    QueryDataSet tmpSet = ut.getNewQueryDataSet(selectString);

    if (tmpSet.isEmpty()) setNoDataAndReturnImmediately();

    monthSet = new QueryDataSet();

    monthSet.setColumns(
        new Column[] {
          dm.createIntColumn("CART", "Šifra"),
          dm.createStringColumn("CART1", "Oznaka", 20),
          dm.createStringColumn("BC", "Barcode", 20),
          dm.createStringColumn("NAZART", "Naziv artikla", 50),
          dm.createIntColumn("CPAR", "Kupac"),
          dm.createBigDecimalColumn("01", moonshine[0], 2),
          dm.createBigDecimalColumn("02", moonshine[1], 2),
          dm.createBigDecimalColumn("03", moonshine[2], 2),
          dm.createBigDecimalColumn("04", moonshine[3], 2),
          dm.createBigDecimalColumn("05", moonshine[4], 2),
          dm.createBigDecimalColumn("06", moonshine[5], 2),
          dm.createBigDecimalColumn("07", moonshine[6], 2),
          dm.createBigDecimalColumn("08", moonshine[7], 2),
          dm.createBigDecimalColumn("09", moonshine[8], 2),
          dm.createBigDecimalColumn("10", moonshine[9], 2),
          dm.createBigDecimalColumn("11", moonshine[10], 2),
          dm.createBigDecimalColumn("12", moonshine[11], 2),
          dm.createBigDecimalColumn("UKUPNO", "Ukupno", 2)
        });

    monthSetGraph = new QueryDataSet();

    monthSetGraph.setColumns(
        new Column[] {
          dm.createIntColumn("CPAR", "Kupac"),
          dm.createStringColumn("NAZPAR", "Naziv partnera", 50),
          dm.createStringColumn("MJESEC", "Mjesec", 2),
          dm.createBigDecimalColumn("IZNOS", "Iznos", 2),
          dm.createBigDecimalColumn("UKUPNO", "Ukupno", 2)
        });

    monthSet.open();
    monthSetGraph.open();

    tmpSet.first();
    String misec;
    isIspis = true;

    try {
      racunica(tmpSet);
    } catch (Exception ex) {
      //      ex.printStackTrace();
      setNoDataAndReturnImmediately();
    }

    monthSet.last();
    setDataSetAndSums(
        monthSet,
        new String[] {
          "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "UKUPNO"
        });
  }