Пример #1
0
 public static void calcSklad(QueryDataSet stavka, StorageDataSet stanje) {
   if (!hr.restart
       .util
       .lookupData
       .getlookupData()
       .raLocate(stanje, "CART", stavka.getInt("CART") + "")) {
     System.err.println("OOOPS:: nisam nasao stanje za cart = " + stavka.getInt("CART"));
     return;
   }
   LinkClass lc = LinkClass.getLinkClass();
   raKalkulBDDoc rKBD = new raKalkulBDDoc();
   rKBD.setVrzal(stanje.getString("CSKL"));
   rKBD.setWhat_kind_of_document("IZD");
   rKBD.mode = 'N';
   // System.out.println("STANJE :: "+stanje);
   //            stavka.setBigDecimal("ZC",stanje.getBigDecimal("ZC"));
   //            stavka.setBigDecimal("NC",stanje.getBigDecimal("NC"));
   //            stavka.setBigDecimal("VC",stanje.getBigDecimal("VC"));
   //            stavka.setBigDecimal("MC",stanje.getBigDecimal("MC"));
   //            stavka.post();
   lc.TransferFromDB2Class(stavka, rKBD.stavka);
   lc.TransferFromDB2Class(stanje, rKBD.stanje);
   // System.out.println("prije "+rKBD.stavka);
   rKBD.kalkSkladPart();
   // System.out.println("poslije kalkSkladPart "+rKBD.stavka);
   rKBD.KalkulacijaStanje(stavka.getString("VRDOK"));
   // System.out.println("poslije KalkulacijaStanje"+rKBD.stavka);
   lc.TransferFromClass2DB(stanje, rKBD.stanje);
   lc.TransferFromClass2DB(stavka, rKBD.stavka);
 }
Пример #2
0
  public void firstESC() {
    //  	jbChart.setVisible(false);

    if (doubleClicked) {
      doubleClicked = false;
      this.killAllReports();
      this.addReport(
          "hr.restart.robno.repStatsMonths",
          "hr.restart.robno.repStatsMonths",
          "StatsMonths",
          "bla bla bla");

      jpKup.setCpar("");

      changeIcon(1);

      monthSet = monthSetCache;

      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));

      setDataSetAndSums(
          monthSet,
          new String[] {
            "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "UKUPNO"
          });
    } else super.firstESC();
  }
Пример #3
0
 public int getPJ(int cpar) {
   QueryDataSet qds = new QueryDataSet();
   String qStr = "select max(pj) as PJ from pjpar where cpar = " + cpar;
   Aus.refilter(qds, qStr);
   if (qds.getRowCount() > 0) return qds.getInt("PJ");
   return 0;
 }
Пример #4
0
  public void prepareVtPred(String cradnal, int rbsrn, boolean single) {
    sds = new StorageDataSet();
    sds.setColumns(dm.getVTPred().cloneColumns());
    sds.open();
    sds.insertRow(false);
    initParams();
    QueryDataSet materijal = selectIzdatnice(cradnal, rbsrn, single);
    for (materijal.first(); materijal.inBounds(); materijal.next()) {
      if (ld.raLocate(dm.getSklad(), "CSKL", materijal.getString("CSKL"))) {
        if (dm.getSklad().getString("TIPSKL").equalsIgnoreCase("M")) {
          sds.setBigDecimal(
              "MAT_I", sds.getBigDecimal("MAT_I").add(materijal.getBigDecimal("IRAZ")));

        } else if (dm.getSklad().getString("TIPSKL").equalsIgnoreCase("P")) {
          sds.setBigDecimal(
              "PRO_I", sds.getBigDecimal("PRO_I").add(materijal.getBigDecimal("IRAZ")));
        } else if (dm.getSklad().getString("TIPSKL").equalsIgnoreCase("R")) {
          sds.setBigDecimal(
              "ROB_I", sds.getBigDecimal("ROB_I").add(materijal.getBigDecimal("IRAZ")));
        } else if (dm.getSklad().getString("TIPSKL").equalsIgnoreCase("L")) {
          sds.setBigDecimal(
              "POL_I", sds.getBigDecimal("POL_I").add(materijal.getBigDecimal("IRAZ")));
        }
      } else {
        throw new RuntimeException(
            "Skladište " + materijal.getString("CSKL") + " nisam uspio pronaæi sa raLocate !!! ");
      }
    }
    sds.setBigDecimal("USL_I", iznosTroskovaUsluge(cradnal, rbsrn));
    faktorizacija();
  }
Пример #5
0
  private void performMatching() {
    QueryDataSet sks = null, pok = null;
    Int2 run = new Int2();
    String lastcpar = "";
    total.clear();

    for (int row = 0; row < model.getRowCount(); row++)
      if (model.isRowSelected(row)) {
        MatchableCollection mc = (MatchableCollection) model.getValueAt(row, 0);
        String mkey = mc.getRow(0).getMasterKey();
        String cpar = mkey.substring(0, mkey.indexOf('$'));
        if (!cpar.equals(lastcpar)) {
          if (sks != null && raTransaction.saveChangesInTransaction(new QueryDataSet[] {sks, pok}))
            total = total.add(run);
          run.clear();
          sks = dM.getDataModule().getSkstavke();
          Skstavke.getDataModule()
              .setFilter(
                  Aus.getKnjigCond()
                      .and(Aus.getFreeYearCond())
                      .and(Condition.equal("CPAR", Aus.getNumber(lastcpar = cpar))));
          sks.open();
          pok = Pokriveni.getDataModule().getFilteredDataSet("1=0");
          pok.open();
        }
        PotentialMatch pm = new PotentialMatch();
        for (int i = 0; i < mc.getRowCount(); i++) pm.addStavka(mc.getRow(i));
        for (int i = 0; i < mc.getMatch().getRowCount(); i++) pm.addStavka(mc.getMatch().getRow(i));
        run = run.add(pm.realize(sks, pok));
      }
    if (sks != null && R2Handler.saveChangesInTransaction(new QueryDataSet[] {sks, pok}))
      total = total.add(run);
    dM.getDataModule().getSynchronizer().markAsDirty("pokriveni");
  }
Пример #6
0
 /**
  * Pokrece pilot-beanshell skripte za ubacivanje podataka iz stranih baza Potrebno je prijaviti
  * reportext sa NASLOVOM kao naziv klase za knjizenje, te aplikacijum sisfun npr. IME=1,
  * NASLOV=hr.restart.robno.frmKnjRobno, URL=robnoloader.sql, APP=sisfun i sve skripte sa tim
  * naslovom ce se izvrsiti prije validacija() metode u NASLOV klasi sortirane by IME (pazi string
  * sort!)
  *
  * @return
  */
 private boolean runPreloader() {
   try {
     String cname = this.getClass().getName();
     // executeReport(java.net.URL rep, String title, Window owner)
     QueryDataSet preloaders =
         Reportext.getDataModule()
             .getFilteredDataSet(
                 Condition.whereAllEqual(
                     new String[] {"NASLOV", "APP"}, new String[] {cname, "sisfun"}));
     preloaders.open();
     if (preloaders.getRowCount() == 0) return true;
     preloaders.setSort(new SortDescriptor("IME"));
     for (preloaders.first(); preloaders.inBounds(); preloaders.next()) {
       //
       // raPilot.executeReport(Aus.findFileAnywhere(preloaders.getString("URL")).toURL(),cname,
       // this );
       Interpreter interpreter = new Interpreter();
       Object ret =
           interpreter.eval(
               FileHandler.readFile(
                   Aus.findFileAnywhere(preloaders.getString("URL")).getAbsolutePath()));
       return ((Boolean) ret).booleanValue();
     }
   } catch (Exception e) {
     e.printStackTrace();
     return false;
   }
   return true;
 }
Пример #7
0
  //  public raFilterPj() {}
  public QueryDataSet getClone(String uvijetS) {
    int uvijet = -1;
    hr.restart.baza.dM dm = hr.restart.baza.dM.getDataModule();
    try {
      uvijet = Integer.parseInt(uvijetS);
    } catch (Exception e) {
      uvijet = -1;
    }

    QueryDataSet za_vratiti =
        hr.restart.util.Util.getNewQueryDataSet(aSS.getQuery4rFP4getClone(uvijet), false);
    za_vratiti.close();
    za_vratiti.setColumns(dm.getPjpar().cloneColumns());
    za_vratiti.open();
    /*
        za_vratiti.setQuery(new QueryDescriptor(dm.getDatabase1(),
                            aSS.getQuery4rFP4getClone(uvijet)));
        za_vratiti.open();
        za_vratiti.interactiveLocate(String.valueOf("1"),"PJ",com.borland.dx.dataset.Locate.FIRST,true);
    */
    return za_vratiti;
  }
Пример #8
0
  public File getAttachment() {
    File dir = new File(System.getProperty("user.dir") + File.separator + "dumps");
    if (dir.exists() && !dir.isDirectory()) dir.delete();
    if (!dir.exists()) dir.mkdir();

    QueryDataSet knjs = Orgstruktura.getDataModule().getKnjig();
    knjs.open();
    lookupData.getlookupData().raLocate(knjs, "CORG", OrgStr.getKNJCORG());

    String prefix = getMailProperties().getProperty("dump.name", knjs.getString("NAZIV"));
    String dumpFileName =
        dir.getAbsolutePath()
            + File.separator
            + prefix
            + "-dbdump-"
            + new java.sql.Date(System.currentTimeMillis())
            + ".zi_";
    File plainDumpFile = new File(dumpFileName + "__plain.tmp");
    File dumpFile = new File(dumpFileName);
    raDbaseCreator.dumpTo(plainDumpFile);
    DesEncrypter enc = new DesEncrypter(getFrom());
    enc.encrypt(plainDumpFile, dumpFile);
    return dumpFile;
  }
Пример #9
0
 public String getKnjHpBroj() {
   return knjig.getString("HPBROJ");
 }
Пример #10
0
 public String getKnjAdresa() {
   return knjig.getString("ADRESA");
 }
Пример #11
0
 public String getKnjNaziv() {
   return knjig.getString("NAZIV");
 }
Пример #12
0
  private void makeRepSet(QueryDataSet obrada, QueryDataSet arhiva) {
    repSet = new StorageDataSet();
    repSet.setColumns(obrada.cloneColumns());
    repSet.open();

    repSet.insertRow(false);

    repSet.setBigDecimal(
        "SATI",
        (obrada.getBigDecimal("SATI").add(arhiva.getBigDecimal("SATI")))
            .setScale(0, java.math.BigDecimal.ROUND_HALF_UP)); // dadd
    repSet.setBigDecimal(
        "BRUTO",
        (obrada.getBigDecimal("BRUTO") /*.add(arhiva.getBigDecimal("BRUTO"))*/)
            .setScale(0, java.math.BigDecimal.ROUND_HALF_UP));
    repSet.setBigDecimal(
        "NETO",
        (obrada.getBigDecimal("NETO").add(arhiva.getBigDecimal("NETO")))
            .setScale(0, java.math.BigDecimal.ROUND_HALF_UP)); // dadd
    repSet.setBigDecimal(
        "DOPRINOSI",
        (obrada.getBigDecimal("DOPRINOSI").add(arhiva.getBigDecimal("DOPRINOSI")))
            .setScale(0, java.math.BigDecimal.ROUND_HALF_UP));
    repSet.setBigDecimal(
        "NETO2",
        (obrada.getBigDecimal("NETO2").add(arhiva.getBigDecimal("NETO2")))
            .setScale(0, java.math.BigDecimal.ROUND_HALF_UP));
    repSet.setBigDecimal(
        "PORIPRIR",
        (obrada.getBigDecimal("PORIPRIR").add(arhiva.getBigDecimal("PORIPRIR")))
            .setScale(0, java.math.BigDecimal.ROUND_HALF_UP));

    //    System.out.println(obrada.getBigDecimal("BMIN") + "
    // obrada.getBigDecimal(\"BMIN\").compareTo(arhiva.getBigDecimal(\"BMIN\")) >= 0 "+
    // arhiva.getBigDecimal("BMIN")+ " ; " +
    // (obrada.getBigDecimal("BMIN").compareTo(arhiva.getBigDecimal("BMIN")) >= 0));
    //    System.out.println("arhiva.getBigDecimal(\"BMIN\").compareTo(new
    // java.math.BigDecimal(\"0.00\")) != 0 " + (arhiva.getBigDecimal("BMIN").compareTo(new
    // java.math.BigDecimal("0.00")) != 0));

    if (obrada.getBigDecimal("BMIN").compareTo(arhiva.getBigDecimal("BMIN")) <= 0
        && arhiva.getBigDecimal("BMIN").compareTo(new java.math.BigDecimal("0.00")) != 0) {
      //      System.out.println("obrada nema redova ili obrada manja oda arhive i arhiva nije
      // nula");
      repSet.setBigDecimal(
          "BMIN", arhiva.getBigDecimal("BMIN").setScale(0, java.math.BigDecimal.ROUND_HALF_UP));
    } else {
      //      System.out.println("nesto ne stima!!! ili ???");
      repSet.setBigDecimal(
          "BMIN", obrada.getBigDecimal("BMIN").setScale(0, java.math.BigDecimal.ROUND_HALF_UP));
    }

    if (obrada.getBigDecimal("BMAX").compareTo(arhiva.getBigDecimal("BMAX")) >= 0) {
      repSet.setBigDecimal(
          "BMAX", obrada.getBigDecimal("BMAX").setScale(0, java.math.BigDecimal.ROUND_HALF_UP));
      maxBrutoTableName = "kumulrad";
      primanjaBrutoTableName = "primanjaobr";
      pomocnaBrut = "orgpl";
    } else {
      repSet.setBigDecimal(
          "BMAX", arhiva.getBigDecimal("BMAX").setScale(0, java.math.BigDecimal.ROUND_HALF_UP));
      maxBrutoTableName = "kumulradarh";
      primanjaBrutoTableName = "primanjaarh";
      pomocnaBrut = "Kumulorgarh";
    }

    if (obrada.getBigDecimal("NMIN").compareTo(arhiva.getBigDecimal("NMIN")) <= 0
        && arhiva.getBigDecimal("NMIN").compareTo(new java.math.BigDecimal("0")) != 0) {
      repSet.setBigDecimal(
          "NMIN", arhiva.getBigDecimal("NMIN").setScale(0, java.math.BigDecimal.ROUND_HALF_UP));
    } else {
      repSet.setBigDecimal(
          "NMIN", obrada.getBigDecimal("NMIN").setScale(0, java.math.BigDecimal.ROUND_HALF_UP));
    }

    if (obrada.getBigDecimal("NMAX").compareTo(arhiva.getBigDecimal("NMAX")) >= 0) {
      repSet.setBigDecimal(
          "NMAX", obrada.getBigDecimal("NMAX").setScale(0, java.math.BigDecimal.ROUND_HALF_UP));
      maxNetoTableName = "kumulrad";
      primanjaNetoTableName = "primanjaobr";
      pomocnaNet = "orgpl";
    } else {
      repSet.setBigDecimal(
          "NMAX", arhiva.getBigDecimal("NMAX").setScale(0, java.math.BigDecimal.ROUND_HALF_UP));
      maxNetoTableName = "kumulradarh";
      primanjaNetoTableName = "primanjaarh";
      pomocnaNet = "Kumulorgarh";
    }
  }
Пример #13
0
  private void maxBN() { // java.sql.Timestamp _od, java.sql.Timestamp _do) {
    //    System.out.println("od " + _od);
    //    System.out.println("do " + _do);

    String qst3Sub1 = "", qst4Sub1 = "";
    if (maxBrutoTableName.equals("kumulradarh")) {
      qst3Sub1 =
          "SELECT max(primanjaarh.bruto) as bruto FROM primanjaarh, Kumulorgarh "
              + "WHERE cradnik in ( "
              + "SELECT cradnik FROM kumulradarh WHERE bruto = ( "
              + "SELECT max(kumulradarh.bruto) "
              + "FROM kumulradarh, Kumulorgarh "
              + "WHERE kumulradarh.godobr = kumulorgarh.godobr "
              + "AND kumulradarh.mjobr = kumulorgarh.mjobr "
              + "AND kumulradarh.rbrobr = kumulorgarh.rbrobr "
              + "AND kumulradarh.cvro = kumulorgarh.cvro "
              + "AND kumulradarh.corg = kumulorgarh.corg "
              + "AND kumulorgarh.datumispl between '"
              + _od
              + "' "
              + "AND '"
              + _do
              + "' "
              + ") group by cradnik) "
              + "AND primanjaarh.godobr = kumulorgarh.godobr "
              + "AND primanjaarh.mjobr = kumulorgarh.mjobr "
              + "AND primanjaarh.rbrobr = kumulorgarh.rbrobr "
              + "AND primanjaarh.corg = kumulorgarh.corg "
              + "AND kumulorgarh.datumispl between '"
              + _od
              + "' "
              + "    AND '"
              + _do
              + "'";

      qst4Sub1 =
          "SELECT max(primanjaarh.neto) as neto FROM primanjaarh, Kumulorgarh "
              + "WHERE cradnik in ( "
              + "SELECT cradnik FROM kumulradarh WHERE netopk = ( "
              + "SELECT max(kumulradarh.netopk) "
              + "FROM kumulradarh, Kumulorgarh "
              + "WHERE kumulradarh.godobr = kumulorgarh.godobr "
              + "AND kumulradarh.mjobr = kumulorgarh.mjobr "
              + "AND kumulradarh.rbrobr = kumulorgarh.rbrobr "
              + "AND kumulradarh.cvro = kumulorgarh.cvro "
              + "AND kumulradarh.corg = kumulorgarh.corg "
              + "AND kumulorgarh.datumispl between '"
              + _od
              + "' "
              + "AND '"
              + _do
              + "' "
              + ")) "
              + "AND primanjaarh.godobr = kumulorgarh.godobr "
              + "AND primanjaarh.mjobr = kumulorgarh.mjobr "
              + "AND primanjaarh.rbrobr = kumulorgarh.rbrobr "
              + "AND primanjaarh.corg = kumulorgarh.corg "
              + "AND kumulorgarh.datumispl between '"
              + _od
              + "' "
              + "    AND '"
              + _do
              + "'";
    } else {
      qst3Sub1 =
          "SELECT max(primanjaobr.bruto) as bruto FROM Primanjaobr, Orgpl "
              + "WHERE primanjaobr.corg = orgpl.corg "
              + "AND Orgpl.datumispl between '"
              + _od
              + "' "
              + "AND '"
              + _do
              + "' ";

      qst4Sub1 =
          "SELECT max(primanjaobr.neto) as neto FROM Primanjaobr, Orgpl "
              + "WHERE primanjaobr.corg = orgpl.corg "
              + "AND Orgpl.datumispl between '"
              + _od
              + "' "
              + "AND '"
              + _do
              + "' ";
    }

    String qst3 = qst3Sub1;
    String qst4 = qst4Sub1;

    if (!raIzvjestaji.getPrimanjaWhQueryIzv(raIzvjestaji.ID_020).equals("")) {
      qst3 =
          qst3.concat(" and not ".concat(raIzvjestaji.getPrimanjaWhQueryIzv(raIzvjestaji.ID_020)));
      qst4 =
          qst4.concat(" and not ".concat(raIzvjestaji.getPrimanjaWhQueryIzv(raIzvjestaji.ID_020)));
    }
    if (!raIzvjestaji.getPrimanjaWhQueryIzv(raIzvjestaji.ID_030).equals("")) {
      qst3 =
          qst3.concat(" and not ".concat(raIzvjestaji.getPrimanjaWhQueryIzv(raIzvjestaji.ID_030)));
      qst4 =
          qst4.concat(" and not ".concat(raIzvjestaji.getPrimanjaWhQueryIzv(raIzvjestaji.ID_030)));
    }
    if (!raIzvjestaji.getPrimanjaWhQueryIzv(raIzvjestaji.ID_040).equals("")) {
      qst3 =
          qst3.concat(" and not ".concat(raIzvjestaji.getPrimanjaWhQueryIzv(raIzvjestaji.ID_040)));
      qst4 =
          qst4.concat(" and not ".concat(raIzvjestaji.getPrimanjaWhQueryIzv(raIzvjestaji.ID_040)));
    }
    if (!raIzvjestaji.getPrimanjaWhQueryIzv(raIzvjestaji.ID_050).equals("")) {
      qst3 =
          qst3.concat(" and not ".concat(raIzvjestaji.getPrimanjaWhQueryIzv(raIzvjestaji.ID_050)));
      qst4 =
          qst4.concat(" and not ".concat(raIzvjestaji.getPrimanjaWhQueryIzv(raIzvjestaji.ID_050)));
    }

    System.out.println("\nqst3 - " + qst3);
    System.out.println("\nqst4 - " + qst4 + "\n");

    QueryDataSet brut02QDS = Util.getNewQueryDataSet(qst3);
    QueryDataSet neto02QDS = Util.getNewQueryDataSet(qst4);

    bruto10 = brut02QDS.getBigDecimal("BRUTO").setScale(0, java.math.BigDecimal.ROUND_HALF_UP);
    neto12 = neto02QDS.getBigDecimal("NETO").setScale(0, java.math.BigDecimal.ROUND_HALF_UP);

    //    System.out.println("\nbruto10 : " + bruto10);
    //    System.out.println("neto12  : " + neto12);
  }
Пример #14
0
 public String getKnjMatbroj() {
   return knjig.getString("MATBROJ");
 }
Пример #15
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"
        });
  }
Пример #16
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"
        });
  }
Пример #17
0
  public BigDecimal iznosTroskovaUsluge(String cradnal, int rbsrn) {

    BigDecimal suma = Aus.zero2;
    QueryDataSet rns =
        Rnser.getDataModule().getTempSet("cradnal='" + cradnal + "' and rbsid=" + rbsrn);
    rns.open();
    for (rns.first(); rns.inBounds(); rns.next()) {
      suma = suma.add(rns.getBigDecimal("VRI"));
    }

    if (rns.rowCount() == 0) {
      String selectRN =
          "select cart,kol from stdoki where cradnal = '"
              + cradnal
              + "' and vrdok='RNL' and rbsid="
              + rbsrn;
      QueryDataSet radninalog = hr.restart.util.Util.getNewQueryDataSet(selectRN, true);
      QueryDataSet normativUs =
          Aut.getAut().expandArt(radninalog.getInt("CART"), radninalog.getBigDecimal("KOL"), false);

      for (normativUs.first(); normativUs.inBounds(); normativUs.next()) {
        if (raVart.isUsluga(normativUs.getInt("CART"))) {
          // Aut.getAut().artTipa(normativUs.getInt("CART"),"U")) {
          suma =
              suma.add(dm.getArtikli().getBigDecimal("NC"))
                  .multiply(normativUs.getBigDecimal("KOL"));
        }
      }
    }

    return suma;
  }
Пример #18
0
 public String getKnjMjesto() {
   return knjig.getString("MJESTO");
 }
Пример #19
0
 public String getKnjZiro() {
   return knjig.getString("ZIRO");
 }
Пример #20
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++;
    }
  }
Пример #21
0
  public boolean Validacija() {
    if (!super.Validacija()) return false;
    rcc.EnabDisabAll(jPanel1, false);
    fondSati =
        raIzvjestaji.getFond(fieldSet.getShort("GODINAOD"), fieldSet.getShort("MJESECOD"), true)
            .satiUk;
    gomj = fieldSet.getShort("GODINAOD") * 100 + fieldSet.getShort("MJESECOD");
    _od =
        java.sql.Timestamp.valueOf(
            fieldSet.getShort("GODINAOD")
                + "-"
                + fieldSet.getShort("MJESECOD")
                + "-01 00:00:00.00");

    _do = Util.getUtil().getLastSecondOfDay(Util.getUtil().getLastDayOfMonth(_od));

    /*java.sql.Timestamp.valueOf(fieldSet.getShort("GODINAOD") + "-" +
    fieldSet.getShort("MJESECOD") + "-31 23:59:59.99");*/

    String qst1 =
        "select sum(kumulrad.sati) as sati, sum(kumulrad.bruto) as bruto, sum(kumulrad.neto) as neto,"
            + " sum(kumulrad.doprinosi) as doprinosi,"
            + " sum(kumulrad.neto2) as neto2, sum(kumulrad.poriprir) as poriprir,"
            + " min(kumulrad.bruto) as bmin, max(kumulrad.bruto) as bmax, min(kumulrad.netopk) as nmin, "
            + " max(kumulrad.netopk) as nmax"
            + " from kumulrad, radnici where radnici.cradnik = kumulrad.cradnik "
            +
            //                  "AND radnici.corg = orgpl.corg " +
            "AND "
            + getWhereQuery("radnici");
    //                  +" AND (orgpl.datumispl between '" + _od + "'"+
    //                  " AND '" + _do + "')" ;

    String qst2 =
        "select sum(kumulradarh.sati) as sati, sum(kumulradarh.bruto) as bruto, sum(kumulradarh.neto) as neto,"
            + " sum(kumulradarh.doprinosi) as doprinosi,"
            + " sum(kumulradarh.neto2) as neto2, sum(kumulradarh.poriprir) as poriprir,"
            + " min(kumulradarh.bruto) as bmin, max(kumulradarh.bruto) as bmax, min(kumulradarh.netopk) as nmin, "
            + " max(kumulradarh.netopk) as nmax"
            + " from kumulradarh, radnici, Kumulorgarh WHERE kumulradarh.cradnik = radnici.cradnik"
            + " AND kumulradarh.godobr = kumulorgarh.godobr AND kumulradarh.mjobr = kumulorgarh.mjobr"
            + " AND kumulradarh.rbrobr = kumulorgarh.rbrobr AND kumulradarh.cvro = kumulorgarh.cvro"
            + " AND kumulradarh.corg = kumulorgarh.corg AND radnici.corg = kumulorgarh.corg AND "
            + getWhereQuery("radnici")
            + " AND kumulorgarh.datumispl between '"
            + _od
            + "' AND '"
            + _do
            + "' ";

    System.out.println("\nobradaQDS query : " + qst1);
    System.out.println("\narhivaQDS query : " + qst2 + "\n");

    QueryDataSet obradaQDS = Util.getNewQueryDataSet(qst1);
    QueryDataSet arhivaQDS = Util.getNewQueryDataSet(qst2);

    makeRepSet(obradaQDS, arhivaQDS);

    maxBN(); // _od, _do);

    bruto0 = arhivaQDS.getBigDecimal("BRUTO").setScale(0, java.math.BigDecimal.ROUND_HALF_UP);

    try {
      if (frmParam
          .getParam(
              "pl",
              "splbrrad",
              "F",
              "SPL: broj radnika se dobiva iz (F)onda sati ili brojanjem (R)adnika")
          .equalsIgnoreCase("R")) {
        brojRadnika = calcBrojRadnika();
      } else {
        brojRadnika =
            repSet.getBigDecimal("SATI").divide(fondSati, 2, java.math.BigDecimal.ROUND_HALF_UP);
      }
    } catch (Exception ex) {
      ex.printStackTrace();
      brojRadnika = new java.math.BigDecimal("0");
    }
    return true;
  }
Пример #22
0
  public void start() {
    if (getCskl() == null) {
      raProcess.fail();
      throw new IllegalArgumentException("Cskl mora biti postavljen");
    }
    System.out.println("DOStoIZD.start() :: cskl = " + getCskl() + ", datum = " + getDatumDo());
    QueryDataSet izd_stdoki_greske = stdoki.getDataModule().getTempSet(Condition.nil);
    izd_stdoki_greske.open();
    msg("Dohvat stanja ...");
    qstanje =
        Stanje.getDataModule()
            .getTempSet(
                Condition.whereAllEqual(
                    new String[] {"CSKL", "GOD"}, new String[] {getCskl(), getGodina()}));
    qstanje.open();
    setBrdok();
    msg("Obrada dokumenata ...");
    getIzdFromDosStdoki();
    msg("Provjera kolièina ...");
    if (!raIZD.isStanjeExist4allDS(izd_stdoki, izd_stdoki_greske, getGodina(), getCskl(), true)) {
      JOptionPane.showMessageDialog(null, "Za neke artikle ne postoje zalihe na skladištu.");
      frmTableDataView dw = new frmTableDataView(false, false);
      dw.setDataSet(izd_stdoki_greske);
      dw.setVisibleCols(new int[] {3, 4, 5, 6, 7, 8, 9, 11});
      dw.show();
      raProcess.fail();
      // test
      //      dw = new frmTableDataView(false, false);
      //      dw.setDataSet(izd_stdoki);
      //      dw.show();
    } else {
      msg("Snimanje promjena ...");
      // test
      // test
      //      frmTableDataView dw = new frmTableDataView(false, false);
      //      dw.setDataSet(izd_stdoki);
      //      dw.show();
      //
      //      dw = new frmTableDataView(false, false);
      //      dw.setDataSet(izd_doki);
      //      dw.show();
      //
      //      dw = new frmTableDataView(false, false);
      //      dw.setDataSet(dos_doki);
      //      dw.show();
      // endtest

      // seq!!!!
      Valid.getValid().setSeqFilter(seqO);
      dM.getDataModule().getSeq().setDouble("BROJ", brdok);
      //      raTransaction.saveChangesInTransaction(new QueryDataSet[] {
      //          dos_doki,
      //          izd_doki,
      //          izd_stdoki,
      //          dM.getDataModule().getSeq()});

      final QueryDataSet[] qdses =
          new QueryDataSet[] {dos_doki, izd_doki, izd_stdoki, dM.getDataModule().getSeq()};

      new raLocalTransaction() {
        public boolean transaction() {
          for (int i = 0; i < qdses.length; i++) {
            raTransaction.saveChanges(qdses[i]);
          }
          for (Iterator iterator = dos_stdoki_sets.iterator(); iterator.hasNext(); ) {
            QueryDataSet qds = (QueryDataSet) iterator.next();
            raTransaction.saveChanges(qds);
          }
          return true;
        }
      }.execTransaction();
      msg("Rekalkulacija stanja");
      BatchRekalkulacijaStanja.start(getCskl(), getGodina());
    }
  }