Exemplo n.º 1
0
  private void getIzdFromDosStdoki() {
    dos_stdoki_sets = new HashSet();
    izd_doki = doki.getDataModule().getTempSet(Condition.nil);
    izd_doki.open();
    izd_stdoki = stdoki.getDataModule().getTempSet(Condition.nil);
    izd_stdoki.open();

    dos_doki =
        doki.getDataModule()
            .getTempSet(
                Condition.whereAllEqual(
                            new String[] {"CSKL", "VRDOK", "GOD", "STATUS"},
                            new String[] {cskl, "DOS", getGodina(), "N"})
                        .and(Condition.till("DATDOK", getDatumDo()))
                    + " ORDER BY CSKL, VRDOK, GOD, BRDOK");
    dos_doki.setMetaDataUpdate(
        MetaDataUpdate.TABLENAME
            + MetaDataUpdate.PRECISION
            + MetaDataUpdate.SCALE
            + MetaDataUpdate.SEARCHABLE);
    dos_doki.open();
    for (dos_doki.first(); dos_doki.inBounds(); dos_doki.next()) {
      izd_doki.insertRow(false);
      dM.copyColumns(dos_doki, izd_doki); // 1 za 1 da ne kompliciramo
      izd_doki.setString("VRDOK", "IZD");
      izd_doki.setInt("BRDOK", brdok); // **************
      izd_doki.setTimestamp("DATDOK", getDatumDo());
      izd_doki.post();
      //      hr.restart.robno.Util.getUtil().getBrojDokumenta(izd_doki);
      izd_doki.post();
      dos_doki.setString("STATUS", "P"); // Prenesen?
      QueryDataSet dos_stdoki =
          stdoki
              .getDataModule()
              .getTempSet(
                  Condition.whereAllEqual(
                      new String[] {"CSKL", "VRDOK", "GOD", "BRDOK"}, dos_doki));
      dos_stdoki.open();
      for (dos_stdoki.first(); dos_stdoki.inBounds(); dos_stdoki.next()) {
        izd_stdoki.insertRow(false);
        dM.copyColumns(dos_stdoki, izd_stdoki);
        izd_stdoki.setString("VRDOK", "IZD");
        izd_stdoki.setInt("BRDOK", izd_doki.getInt("BRDOK"));
        izd_stdoki.setString("VEZA", dos_stdoki.getString("ID_STAVKA"));
        // c/p iz raIz*
        izd_stdoki.setString(
            "ID_STAVKA",
            raControlDocs.getKey(
                izd_stdoki, new String[] {"cskl", "vrdok", "god", "brdok", "rbsid"}, "stdoki"));
        dos_stdoki.setString("VEZA", izd_stdoki.getString("ID_STAVKA"));
        izd_stdoki.setString("CSKLART", izd_stdoki.getString("CSKL"));
        calcSklad(izd_stdoki, qstanje);
        izd_stdoki.post();
        dos_stdoki.post();
        // System.out.println(izd_stdoki);
      }
      dos_stdoki_sets.add(dos_stdoki);
      brdok++;
    }
  }
Exemplo n.º 2
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"
        });
  }