示例#1
0
 private void initDataSet() {
   dataSet.addColumn((Column) dm.getVrstenaloga().getColumn("CVRNAL").clone());
   dataSet.addColumn((Column) dm.getNalozi().getColumn("DATUMKNJ").clone());
   Column clDATUMDO = (Column) dm.getNalozi().getColumn("DATUMKNJ").clone();
   clDATUMDO.setColumnName("DATUMDO");
   dataSet.addColumn(clDATUMDO);
   Column clNK = new Column("NK", "Na\u010Din knjiženja", Variant.STRING);
   clNK.setDefault("K");
   dataSet.addColumn(clNK);
 }
示例#2
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);
 }
示例#3
0
  private void jbInit() throws Exception {
    tots.setColumns(
        new Column[] {
          dM.createBigDecimalColumn("TOT", 2),
          dM.createBigDecimalColumn("POK", 2),
          dM.createBigDecimalColumn("SAL", 2),
          dM.createBigDecimalColumn("TOTPV", 2),
          dM.createBigDecimalColumn("POKPV", 2),
          dM.createBigDecimalColumn("SALPV", 2)
        });
    tots.open();
    tots.insertRow(false);

    jraTot.setDataSet(tots);
    jraTot.setColumnName("TOT");
    jraPok.setDataSet(tots);
    jraPok.setColumnName("POK");
    jraOst.setDataSet(tots);
    jraOst.setColumnName("SAL");
    jlTot.setHorizontalAlignment(JLabel.CENTER);
    jlPok.setHorizontalAlignment(JLabel.CENTER);
    jlOst.setHorizontalAlignment(JLabel.CENTER);
    jraTotPv.setDataSet(tots);
    jraTotPv.setColumnName("TOTPV");
    jraPokPv.setDataSet(tots);
    jraPokPv.setColumnName("POKPV");
    jraOstPv.setDataSet(tots);
    jraOstPv.setColumnName("SALPV");
    setLayout(lay);
    lay.setWidth(475);
    lay.setHeight(80);
    add(jlUk, new XYConstraints(15, 20, -1, -1));
    add(jraTot, new XYConstraints(150, 20, 100, -1));
    add(jraPok, new XYConstraints(255, 20, 100, -1));
    add(jraOst, new XYConstraints(360, 20, 100, -1));
    add(jlTot, new XYConstraints(150, 4, 100, -1));
    add(jlPok, new XYConstraints(255, 4, 100, -1));
    add(jlOst, new XYConstraints(360, 4, 100, -1));
    add(jlUkPv, new XYConstraints(15, 50, -1, -1));
    add(jraTotPv, new XYConstraints(150, 50, 100, -1));
    add(jraPokPv, new XYConstraints(255, 50, 100, -1));
    add(jraOstPv, new XYConstraints(360, 50, 100, -1));
    setBorder(BorderFactory.createRaisedBevelBorder());
  }
示例#4
0
 private void setBrdok() {
   StorageDataSet dsq = new StorageDataSet();
   dsq.addColumn(doki.getDataModule().getColumn("VRDOK").cloneColumn());
   dsq.addColumn(doki.getDataModule().getColumn("CSKL").cloneColumn());
   dsq.addColumn(doki.getDataModule().getColumn("GOD").cloneColumn());
   dsq.open();
   dsq.setString("VRDOK", "IZD");
   dsq.setString("CSKL", getCskl());
   dsq.setString("GOD", getGodina());
   seqO = hr.restart.robno.Util.getUtil().getSeqString(dsq);
   brdok = Valid.getValid().findSeqInt(seqO, false);
 }
示例#5
0
 public void resetDefaults() {
   rcbNK.setSelectedIndex(0);
   dataSet.empty();
   dataSet.setTimestamp("DATUMKNJ", vl.getToday());
   dataSet.setTimestamp("DATUMDO", vl.getToday());
 }
示例#6
0
 public BigDecimal getSaldo() {
   return tots.getBigDecimal("SAL");
 }
示例#7
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";
    }
  }
示例#8
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();
  }
示例#9
0
 private void faktorizacija() {
   sds.setBigDecimal("MAT_F", faktormat);
   sds.setBigDecimal(
       "MAT_FI",
       (sds.getBigDecimal("MAT_I").multiply(faktormat).setScale(2, BigDecimal.ROUND_HALF_UP)));
   sds.setBigDecimal("PRO_F", faktorpro);
   sds.setBigDecimal(
       "PRO_FI",
       (sds.getBigDecimal("PRO_I").multiply(faktorpro).setScale(2, BigDecimal.ROUND_HALF_UP)));
   sds.setBigDecimal("ROB_F", faktorrob);
   sds.setBigDecimal(
       "ROB_FI",
       (sds.getBigDecimal("ROB_I").multiply(faktorrob).setScale(2, BigDecimal.ROUND_HALF_UP)));
   sds.setBigDecimal("USL_F", faktorusl);
   sds.setBigDecimal(
       "USL_FI",
       (sds.getBigDecimal("USL_I").multiply(faktorusl).setScale(2, BigDecimal.ROUND_HALF_UP)));
   sds.setBigDecimal("POL_F", faktorost);
   sds.setBigDecimal(
       "POL_FI",
       (sds.getBigDecimal("POL_I").multiply(faktorost).setScale(2, BigDecimal.ROUND_HALF_UP)));
   sds.setBigDecimal(
       "TOTAL",
       sds.getBigDecimal("MAT_FI")
           .add(sds.getBigDecimal("PRO_FI"))
           .add(sds.getBigDecimal("ROB_FI"))
           .add(sds.getBigDecimal("USL_FI"))
           .add(sds.getBigDecimal("POL_FI")));
 }
示例#10
0
 public BigDecimal getSaldoPv() {
   return tots.getBigDecimal("SALPV");
 }
示例#11
0
 public BigDecimal getTotalPv() {
   return tots.getBigDecimal("TOTPV");
 }
示例#12
0
 public BigDecimal getPokrivenoPv() {
   return tots.getBigDecimal("POKPV");
 }
示例#13
0
 public void addPokrivenoPv(BigDecimal pokPv) {
   setPokrivenoPv(tots.getBigDecimal("POKPV").add(pokPv));
 }
示例#14
0
 public void setPokrivenoPv(BigDecimal pokPv) {
   tots.setBigDecimal("POKPV", pokPv);
   if (isTotalDefined()) tots.setBigDecimal("SALPV", tots.getBigDecimal("TOTPV").subtract(pokPv));
 }
示例#15
0
 public void initTotal(BigDecimal total) {
   tots.setBigDecimal("TOT", total);
   tots.setBigDecimal("POK", raSaldaKonti.n0);
   tots.setBigDecimal("SAL", total);
 }
示例#16
0
 /**
  * Vraæa < '2002-10-16' ako je zadani datumdo na ekranu 15. listopada 2002. godine, tako da bi
  * query mogao zvuèati ovako: SELECT * FROM nesto WHERE KNJIG = + OrgStr.getKnjCorg() + AND DATOBR
  * + getDatumDoSQL()
  */
 public String getDatumDoSQL() {
   return " < '"
       + new java.sql.Date(Util.getUtil().addDays(dataSet.getTimestamp("DATUMDO"), 1).getTime())
           .toString()
       + "'";
 }
示例#17
0
 public void initTotalPv(BigDecimal totalPv) {
   tots.setBigDecimal("TOTPV", totalPv);
   tots.setBigDecimal("POKPV", raSaldaKonti.n0);
   tots.setBigDecimal("SALPv", totalPv);
 }
示例#18
0
 public BigDecimal getProIzn() {
   return sds.getBigDecimal("TOTAL");
 }
示例#19
0
 public boolean isTotalDefined() {
   return tots.getBigDecimal("TOT").signum() != 0;
 }
示例#20
0
  private String getUpit() {
    String selStr =
        "select artikli.cart, artikli.cart1, artikli.bc, artikli.nazart, doki.cpar, doki.datdok, stdoki.kol, stdoki.jm, stdoki.IPRODSP ";

    //    if (fieldSet.getString("SLJED").equalsIgnoreCase("RUC")){
    //      selStr += "(stdoki.iprodbp-stdoki.inab) as ruc ";
    //    } else if (fieldSet.getString("SLJED").equalsIgnoreCase("POR")){
    //      selStr += "(stdoki.iprodsp - stdoki.iprodbp) as por ";
    //    } else {
    //      selStr += "stdoki.IPRODSP ";
    //    }

    String inq;
    StorageDataSet corgs =
        hr.restart.zapod.OrgStr.getOrgStr().getOrgstrAndKnjig(fieldSet.getString("CORG"));
    if (corgs.rowCount() == 0) inq = "1=1";
    else if (corgs.rowCount() == 1) inq = "DOKI.CSKL = '" + fieldSet.getString("CORG") + "'";
    else
      inq =
          "(DOKI.CSKL in "
              + hr.restart.zapod.OrgStr.getOrgStr().getInQuery(corgs, "DOKI.CSKL")
              + ") ";
    hr.restart.baza.Condition oj = hr.restart.baza.Condition.in("DOKI.VRDOK", TypeDoc.araj_docsOJ);
    String exInClude =
        "AND (("
            + oj
            + " AND "
            + inq
            + ") OR ("
            + oj.not()
            + " AND DOKI.CSKL = '"
            + getCskl()
            + "')) ";

    String artikliFilter;

    if (fieldSet.getString("VRART").equals("") || fieldSet.getString("VRART").equals("X"))
      artikliFilter = "";
    else artikliFilter = " AND ARTIKLI.VRART='" + fieldSet.getString("VRART") + "' ";

    String carting = "";
    if (!rpcart.findCART(podgrupe).equals("")) {
      carting = " AND " + rpcart.findCART(podgrupe);
    }

    String ckupca = "";

    if (!getCkup().equals("")) ckupca = "and doki.cpar='" + getCkup() + "' ";

    selStr +=
        " from doki,stdoki,artikli,partneri WHERE doki.cskl = stdoki.cskl AND doki.vrdok = stdoki.vrdok AND doki.god = stdoki.god "
            + "AND doki.brdok = stdoki.brdok AND stdoki.cart = artikli.cart AND doki.cpar = partneri.cpar and doki.god='"
            + hr.restart.robno.Aut.getAut().getKnjigodRobno()
            + "' AND doki.vrdok not in ('PON','NDO','NKU','RNL','REV','PRV','OTR','INM','INV','IZD','TRE','ZAH') "
            + exInClude
            + ckupca
            + artikliFilter
            + carting
            + " order by datdok";

    // REMARK!!
    // nešto što sam primjetio, a moglo bi dobro doæi kad se bude implementirao nabavljaè je da
    // postoji i CPAR kolona u tablici artikli
    // i predstavlja dobavljaèa za taj artikl.

    //    System.out.println("\n\n"+selStr+"\n\n");

    return selStr;
  }
示例#21
0
 public void setPokriveno(BigDecimal pok) {
   tots.setBigDecimal("POK", pok);
   if (isTotalDefined()) tots.setBigDecimal("SAL", tots.getBigDecimal("TOT").subtract(pok));
 }
示例#22
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;
  }
示例#23
0
 public void addPokriveno(BigDecimal pok) {
   setPokriveno(tots.getBigDecimal("POK").add(pok));
 }