Exemplo n.º 1
0
  private BigDecimal calcBrojRadnika() {
    String q1 =
        "select count('') "
            + " from kumulrad, radnici, orgpl where radnici.cradnik = kumulrad.cradnik AND radnici.corg = orgpl.corg AND "
            + getWhereQuery("radnici")
            + " AND (orgpl.datumispl between '"
            + _od
            + "'"
            + " AND '"
            + _do
            + "')";

    String q2 =
        "select count(*) "
            + " 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("4count:" + q1);

    return new BigDecimal(Valid.getValid().getSetCount(Util.getNewQueryDataSet(q1), 0));
  }
Exemplo n.º 2
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);
 }
Exemplo n.º 3
0
 public boolean Validacija(char mode) {
   if (vl.isEmpty(jpDetail.jlrBrojdok)) return false;
   if (getRaQueryDataSet().getBigDecimal("IZNOS").signum() <= 0) {
     jpDetail.jraIznos.requestFocus();
     JOptionPane.showMessageDialog(
         this.getWindow(), "Pogrešan iznos uplate!", "Greška", JOptionPane.ERROR_MESSAGE);
     return false;
   }
   if (mode == 'N') {
     vl.execSQL(
         "SELECT MAX(rbr) AS num FROM kamupl WHERE knjig='"
             + getRaQueryDataSet().getString("KNJIG")
             + "' AND brojdok='"
             + getRaQueryDataSet().getString("BROJDOK")
             + "' AND cpar="
             + getRaQueryDataSet().getInt("CPAR"));
     vl.RezSet.open();
     if (vl.RezSet.rowCount() > 0) getRaQueryDataSet().setInt("RBR", vl.RezSet.getInt("NUM") + 1);
     else getRaQueryDataSet().setInt("RBR", 1);
   }
   return true;
 }
Exemplo n.º 4
0
 public void SetFokus(char mode) {
   if (mode == 'I') jpDetail.jraIznos.requestFocus();
   else if (mode == 'N') {
     pres.copySelValues();
     partnerChanged();
     getRaQueryDataSet().setTimestamp("DATDOK", vl.getToday());
     if (cpar == 0) {
       jpDetail.jlrCpar.forceFocLost();
       jpDetail.jlrCpar.requestFocus();
     } else {
       jpDetail.jlrNazpar.setText(nazpar);
       //        getRaQueryDataSet().setInt("CPAR", cpar);
       //        jpDetail.jlrCpar.forceFocLost();
       rcc.setLabelLaF(jpDetail.jlrCpar, false);
       rcc.setLabelLaF(jpDetail.jlrNazpar, false);
       rcc.setLabelLaF(jpDetail.jbSelCpar, false);
       jpDetail.jlrBrojdok.requestFocus();
     }
   }
 }
Exemplo n.º 5
0
 public String getDatumIsp() {
   return rdu.dataFormatter(val.getToday());
 }
Exemplo n.º 6
0
public class repMarza implements sg.com.elixir.reportwriter.datasource.IDataProvider {

  _Main main;
  repMemo rpm = repMemo.getrepMemo();
  DataSet ds = dlgPregledRUC.getInstance().getJPTV().getDataSet();
  hr.restart.baza.dM dm = hr.restart.baza.dM.getDataModule();
  raDateUtil rdu = raDateUtil.getraDateUtil();
  String[] colname = new String[] {""};
  String param = dlgPregledRUC.getInstance().getParam();
  repUtil ru = repUtil.getrepUtil();
  hr.restart.util.Valid val = hr.restart.util.Valid.getValid();

  public repMarza() {}

  public repMarza(int idx) {
    ds.goToRow(idx);
  }

  public java.util.Enumeration getData() {
    return new java.util.Enumeration() {
      {
        ds.open();
        ru.setDataSet(ds);
      }

      int indx = 0;

      public Object nextElement() {

        return new repMarza(indx++);
      }

      public boolean hasMoreElements() {
        return (indx < ds.getRowCount());
      }
    };
  }

  public void close() {}

  public String getNazArt() {
    return ds.getString("NAZART");
  }

  public String getNazSklad() {
    String cskl = ds.getString("CSKL");
    lookupData.getlookupData().raLocate(dm.getSklad(), new String[] {"CSKL"}, new String[] {cskl});
    return dm.getSklad().getString("NAZSKL");
  }

  public int getIdx() {
    return ds.getRow() + 1;
  }

  public String getSifra() {
    if (param.equals("CART")) {
      return ds.getInt("CART") + "";
    } else if (param.equals("CART1")) {
      return ds.getString("CART1");
    } else {
      return ds.getString("BC");
    }
  }

  public String getCSKL() {
    return ds.getString("CSKL");
  }

  public String getJM() {
    return ds.getString("JM");
  }

  public double getNC() {
    return ds.getBigDecimal("NC").doubleValue();
  }

  public double getVC() {
    return ds.getBigDecimal("VC").doubleValue();
  }

  public double getMarza() {
    return ds.getBigDecimal("MARZA").doubleValue();
  }

  public double getRuc() {
    return ds.getBigDecimal("RUC").doubleValue();
  }

  public String getFirstLine() {
    return rpm.getFirstLine();
  }

  public String getSecondLine() {
    return rpm.getSecondLine();
  }

  public String getThirdLine() {
    return rpm.getThirdLine();
  }

  public String getDatumIsp() {
    return rdu.dataFormatter(val.getToday());
  }

  public String getCaption() {
    return "";
    // return (ds.getString("KOLPD")+ " do " + ds.getString("KOLZD"));
  }
}
Exemplo n.º 7
0
public class jpDistListDetail extends JPanel {

  raCommonClass rcc = raCommonClass.getraCommonClass();
  dM dm = dM.getDataModule();
  Valid vl = Valid.getValid();

  frmDistList fdl;
  JPanel jpDetail = new JPanel();

  XYLayout lay = new XYLayout();
  JLabel jlAdr = new JLabel();
  JLabel jlFax = new JLabel();
  JLabel jlKol = new JLabel();
  JLabel jlNaziv = new JLabel();
  JLabel jlPar = new JLabel();

  JraButton jbSelCpar = new JraButton();

  JraTextField jraAdr = new JraTextField();
  JraTextField jraEmadr = new JraTextField();
  JraTextField jraFax = new JraTextField();
  JraTextField jraKol = new JraTextField();
  JraTextField jraMj = new JraTextField();
  JraTextField jraNaziv = new JraTextField();
  JraTextField jraPbr = new JraTextField();
  JraTextField jraTelfax = new JraTextField();
  JlrNavField jlrCpar = new JlrNavField();
  JlrNavField jlrNazpar = new JlrNavField();

  public jpDistListDetail(frmDistList f) {
    try {
      fdl = f;
      jbInit();
    } catch (Exception e) {
      e.printStackTrace();
    }
  }

  public void BindComponents(DataSet ds) {
    jraAdr.setDataSet(ds);
    jraEmadr.setDataSet(ds);
    jraFax.setDataSet(ds);
    jraKol.setDataSet(ds);
    jraMj.setDataSet(ds);
    jraNaziv.setDataSet(ds);
    jraPbr.setDataSet(ds);
    jraTelfax.setDataSet(ds);
    jlrCpar.setDataSet(ds);
  }

  private void jbInit() throws Exception {
    jpDetail.setLayout(lay);
    lay.setWidth(546);
    lay.setHeight(200);

    jlAdr.setText("Adresa");
    jlFax.setText("Tel/fax/e-mail");
    jlKol.setText("Kolièine");
    jlNaziv.setText("Naziv");
    jlPar.setText("Partner");
    jraAdr.setColumnName("ADR");
    jraEmadr.setColumnName("EMADR");
    jraFax.setColumnName("TEL");
    jraKol.setColumnName("KOL");
    jraMj.setColumnName("MJ");
    jraNaziv.setColumnName("NAZIV");
    jraPbr.setColumnName("PBR");
    jraTelfax.setColumnName("TELFAX");

    jlrCpar.setColumnName("CPAR");
    jlrCpar.setColNames(new String[] {"NAZPAR"});
    jlrCpar.setTextFields(new JTextComponent[] {jlrNazpar});
    jlrCpar.setVisCols(new int[] {0, 1});
    jlrCpar.setSearchMode(0);
    jlrCpar.setRaDataSet(dm.getPartneri());
    jlrCpar.setNavButton(jbSelCpar);

    jlrNazpar.setColumnName("NAZPAR");
    jlrNazpar.setNavProperties(jlrCpar);
    jlrNazpar.setSearchMode(1);

    //	***************
    jpDetail.add(jbSelCpar, new XYConstraints(510, 20, 21, 21));
    jpDetail.add(jlAdr, new XYConstraints(15, 95, -1, -1));
    jpDetail.add(jlFax, new XYConstraints(15, 120, -1, -1));
    jpDetail.add(jlKol, new XYConstraints(15, 150, -1, -1));
    jpDetail.add(jlNaziv, new XYConstraints(15, 70, -1, -1));
    jpDetail.add(jlPar, new XYConstraints(15, 20, -1, -1));
    jpDetail.add(jlrCpar, new XYConstraints(150, 20, 75, -1));
    jpDetail.add(jlrNazpar, new XYConstraints(230, 20, 275, -1));
    jpDetail.add(jraAdr, new XYConstraints(150, 95, 200, -1));
    jpDetail.add(jraEmadr, new XYConstraints(360, 120, 145, -1));
    jpDetail.add(jraFax, new XYConstraints(150, 120, 100, -1));
    jpDetail.add(jraKol, new XYConstraints(150, 150, 85, -1));
    jpDetail.add(jraMj, new XYConstraints(410, 95, 95, -1));
    jpDetail.add(jraNaziv, new XYConstraints(150, 70, 355, -1));
    jpDetail.add(jraPbr, new XYConstraints(355, 95, 50, -1));
    jpDetail.add(jraTelfax, new XYConstraints(255, 120, 100, -1));

    BindComponents(fdl.getDetailSet());

    this.add(jpDetail, BorderLayout.CENTER);
  }
}
Exemplo n.º 8
0
/**
 * Title:
 *
 * <p>Description:
 *
 * <p>Copyright: Copyright (c) 2003
 *
 * <p>Company:
 *
 * @author unascribed
 * @version 1.0
 */
public class raOptimisticMatch {
  private static raOptimisticMatch inst = new raOptimisticMatch();
  private Valid vl = Valid.getValid();

  // mapa svih mapa:
  // kljucevi su (partner$konto$valuta$godina$uloga),
  // a vrijednosti mape salda na popis dokumenata.
  private HashMap master = new HashMap();
  private JTable table;
  private JPanel contents;
  private raNavBar nav;
  private OKpanel okp;
  private MatchTableModel model;
  private JraComboBox cbox;
  private JraDialog win;
  private double threshold = 0.60;
  private String ignore = " -./,";

  private raOptimisticMatch() {
    try {
      init();
    } catch (Exception e) {
      e.printStackTrace();
    }
  }

  public static boolean find(int depth) {
    return find(depth, Condition.none);
  }

  // extra je dodatni condition koji se moze poslati, npr. samo kupci, samo jedna godina itd.
  public static boolean find(int depth, Condition extra) {
    return inst.findAll(depth, extra);
  }

  public static void setMarkThreshold(double factor) {
    inst.threshold = factor;
  }

  public static void setIgnoreChars(String chars) {
    inst.ignore = chars;
  }

  static double getFactor() {
    return inst.threshold;
  }

  static String getIgnore() {
    return inst.ignore;
  }

  private boolean findAll(int maxDepth, Condition cond) {
    // nadji sve stavke koje zadovoljavaju uvjet, a nisu pokrivene.
    DataSet ds =
        Skstavke.getDataModule()
            .getTempSet(
                Aus.getKnjigCond()
                    .and(cond)
                    .and(Aus.getFreeYearCond())
                    .and(Condition.equal(raSaldaKonti.colPok(), "N")));

    // ako je metoda pozvana iz raProcess sustava, iskoristi ga
    if (!raProcess.isRunning()) ds.open();
    else {
      raProcess.setMessage("Dohvat nepokrivenih stavaka salda konti ...", true);
      raProcess.openScratchDataSet(ds);
    }

    // najprije prevrti cijeli dataset i prebaci sve stavke u MatchRow,
    // te ih napuni u LinkedList iz kojih cemo ih izbacivati kad i ako
    // pronadjemo kombinaciju u kojoj se moze pokriti.
    LinkedList stavke = new LinkedList();
    for (ds.first(); ds.inBounds(); ds.next()) stavke.addLast(new MatchRow(ds));

    // pocni raditi kombinacije. Najprije svaka stavka pojedinacno,
    // onda sve do 'maxDepth' stavki po kombinaciji. Prati i potrosnju
    // objekata da ne predje neku razumnu granicu.
    int slots = 0, collections = 0;
    master.clear();
    for (int depth = 1; depth <= maxDepth; depth++) {
      if (raProcess.isRunning())
        raProcess.setMessage("Provjera moguæeg pokrivanja stupnja " + depth + " ...", false);

      // prodji kroz sve preostale stavke i puni glavnu mapu,
      // koja se sastoji od po jedne mape salda na popis dokumenata za
      // svaku razlicitu kombinaciju cpar$konto$valuta$godina$uloga
      // koja postoji u nadjenim stavkama. Jebeno.
      for (Iterator st = stavke.iterator(); st.hasNext(); ) {
        MatchRow mr = (MatchRow) st.next();
        if (raProcess.isRunning()) raProcess.checkClosing();

        // probaj naci vec postojecu grupu salda za ovaj kljuc ili napravi novu
        SaldoGroup salda = (SaldoGroup) master.get(mr.getMasterKey());
        if (salda == null) master.put(mr.getMasterKey(), salda = new SaldoGroup());

        // Inicijaliziraj listu kombinacija koja ce se kasnije ubaciti u mapu salda.
        // Kombinacije se ne mogu odmah ubacivati u mapu jer se po njoj iterira, pa
        // bi to rezultiralo gadnim kolizijama. Ako je depth 1, onda se napravi
        // kombinacija od samo teukce stavke, inace se prolazi kroz cijelu mapu
        // salda i priprema dodavanje novih kombinacija duljine depth.
        ArrayList toAdd = new ArrayList();
        if (depth == 1) toAdd.add(new MatchableCollection(mr));
        else
          for (Iterator it = salda.slotIterator(); it.hasNext(); ) {
            SaldoSlot ss = (SaldoSlot) it.next();
            if (raProcess.isRunning()) raProcess.checkClosing();

            // prodji koz sve kombinacije u ovom slotu (koje imaju taj saldo)
            // i pripremi dodavanje po jedne nove kombinacije za svaku koja
            // ima depth-1 clanova, i koja je istog tipa kao nova stavka
            // (tip racuni ili uplate), te koja vec nije u toj kombinaciji.
            for (int i = 0; i < ss.getCollectionCount(); i++) {
              MatchableCollection mc = ss.getCollection(i);
              if (mc.checkAdd(mr, depth)) toAdd.add(mc.copyAndExtend(mr));
            }
          }

        // i na kraju ubaci sve pripremljene kombinacije iz liste toAdd
        // u odgovarajuce slotove mape salda.
        slots -= salda.countSlots();
        for (int i = 0; i < toAdd.size(); i++) {
          MatchableCollection mc = (MatchableCollection) toAdd.get(i);
          if (raProcess.isRunning()) raProcess.checkClosing();

          // probaj naci postojeci saldo slot ili napravi novog ako ga nema,
          // te dodaj ovu kombinaciju u njega.
          SaldoSlot ss = (SaldoSlot) salda.getSlot(mc.getMatchSaldo());
          if (ss == null) salda.addSlot(mc.getMatchSaldo(), ss = new SaldoSlot());
          ss.addCollection(mc);
          mc.setOwner(ss);
        }
        slots += salda.countSlots();
        collections += toAdd.size();
        if (collections > 100000) break;
      }
      if (collections > 100000) break;

      // ako se stavka vec nalazi u nekoj kombinaciji koja se moze pokriti,
      // nema potrebe traziti daljnje kombinacije s njom, tj kombinacije s
      // vise clanova. Cilj je da se minimiziraju visestruka pokrivanja.
      for (Iterator st = stavke.iterator(); st.hasNext(); ) {
        MatchRow mr = (MatchRow) st.next();
        if (mr.isMatchable()) st.remove();
      }
    }

    // na kraju balade, u glavnoj mapi imamo mnostvo mapa (za svaki kljuc
    // cpar$konto$valuta$godina$uloga po jedna) u cijim slotovima se
    // potencijalno nalaze kombinacije stavaka koje se mogu medjusobno
    // pokriti. Sve te kombinacije bit ce ponudjene za pokrivanje, grupirane
    // po saldu. No najprije treba izbaciti iz mape sve one slotove kod kojih
    // nema bar po jedna kombinacija tipa uplate i jedna tipa racun.
    for (Iterator it = master.values().iterator(); it.hasNext(); ) {
      SaldoGroup salda = (SaldoGroup) it.next();
      for (Iterator s = salda.slotIterator(); s.hasNext(); ) {
        SaldoSlot ss = (SaldoSlot) s.next();
        if (!ss.isMatchable()) s.remove();
      }
      if (salda.countSlots() == 0) it.remove();
    }

    // medju preostalim mapama probaj naci najbolje matcheve.
    for (Iterator it = master.values().iterator(); it.hasNext(); ) {
      SaldoGroup salda = (SaldoGroup) it.next();
      for (Iterator s = salda.slotIterator(); s.hasNext(); ) {
        SaldoSlot ss = (SaldoSlot) s.next();
        for (int i = 0; i < ss.getCollectionCount(); i++) {
          MatchableCollection mi = ss.getCollection(i);
          mi.findRepresentations();
          double now;
          for (int j = 0; j < ss.getCollectionCount(); j++) {
            MatchableCollection mj = ss.getCollection(j);
            if (mi.isRacunTip() != mj.isRacunTip()
                && (now = mi.getMatchFactor(mj)) > mi.getMatchedFactor()
                && now > mj.getMatchedFactor()
                && now > mi.getMaxMatchStrength()
                && now > mj.getMaxMatchStrength()) mi.setMatch(mj);
          }
        }
      }
      salda.findMarks();
    }
    return master.size() > 0;
  }

  public static boolean isAnythingFound() {
    return inst.master.size() > 0;
  }

  public static void showResultDialog(Container owner, String title) {
    inst.showResults(owner, title);
  }

  public void showResults(Container parent, String title) {
    Container realparent = null;

    if (parent instanceof JComponent) realparent = ((JComponent) parent).getTopLevelAncestor();
    else if (parent instanceof Window) realparent = parent;

    if (realparent instanceof Dialog) win = new JraDialog((Dialog) realparent, title, true);
    else if (realparent instanceof Frame) win = new JraDialog((Frame) realparent, title, true);
    else win = new JraDialog((Frame) null, title, true);
    win.setContentPane(contents);
    ((MatchTableModel) table.getModel()).fillData(master);
    win.pack();
    win.setLocationRelativeTo(parent);
    win.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
    win.addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            CancelPress();
          }
        });
    win.addKeyListener(
        new KeyAdapter() {
          public void keyTyped(KeyEvent e) {
            if (e.getKeyChar() == e.VK_ESCAPE) {
              CancelPress();
              e.consume();
            }
          }

          public void keyPressed(KeyEvent e) {
            if (e.getKeyCode() == e.VK_A && e.getModifiers() == e.CTRL_MASK) {
              ((Action) table.getActionMap().get("selectAll")).actionPerformed(null);
              e.consume();
            }
          }
        });
    int dd = ToolTipManager.sharedInstance().getDismissDelay();
    ToolTipManager.sharedInstance().setDismissDelay(10000);
    okp.registerOKPanelKeys(win);
    table.scrollRectToVisible(new Rectangle(0, 0, 10, 10));
    if (table.isEditing()) table.removeEditor();
    win.show();
    ToolTipManager.sharedInstance().setDismissDelay(dd);
  }

  private Rectangle srect = new Rectangle();
  private Point spoint = new Point();

  private void paintSections(Graphics g) {
    int rmin, rmax, rh = table.getRowHeight();
    MatchTableModel model = (MatchTableModel) table.getModel();
    g.getClipBounds(srect);
    spoint.setLocation(0, srect.y);
    rmin = table.rowAtPoint(spoint);
    if (rmin < 0) rmin = 0;
    spoint.setLocation(0, srect.y + srect.height);
    rmax = table.rowAtPoint(spoint);
    if (rmax < 0) rmax = table.getRowCount() - 1;
    for (int i = rmin; i <= rmax; i++) {
      if (model.isRowHeader(i)) {
        if (model.isRowHeader2(i)) {
          g.clearRect(0, rh * i, table.getWidth(), rh - 1);
          g.drawString(
              model.getDescription(i),
              1,
              rh * i + table.getFontMetrics(table.getFont()).getAscent());
        } else g.clearRect(0, rh * i, table.getWidth(), rh * 2 - 1);
      }
    }
  }

  private void init() throws Exception {
    model = new MatchTableModel();
    cbox = new JraComboBox();
    cbox.setRenderer(
        new BasicComboBoxRenderer() {
          public Component getListCellRendererComponent(
              JList l, Object val, int idx, boolean sel, boolean foc) {
            if (sel && idx >= 0 && val instanceof MatchableCollection)
              l.setToolTipText(((MatchableCollection) val).getToolTipText());
            return super.getListCellRendererComponent(l, val, idx, sel, foc);
          }
        });
    table =
        new JTable(model) {
          public void paintChildren(Graphics g) {
            super.paintChildren(g);
            paintSections(g);
          }

          public void changeSelection(int row, int col, boolean toggle, boolean extend) {
            int scrow = row;
            int oldrow = getSelectedRow();
            int oldcol = getSelectedColumn();
            int maxrow = model.getRowCount() - 2;
            if (model.isRowHeader(row) && (toggle || extend)) return;
            if (oldrow != -1 && model.isRowHeader(row)) {
              if (oldrow < row) while (row < maxrow && model.isRowHeader(++row)) ;
              else while (row > 0 && model.isRowHeader(--row)) ;
              if (model.isRowHeader(row))
                if (oldrow < row) while (row > 0 && model.isRowHeader(--row)) ;
                else while (row < maxrow && model.isRowHeader(++row)) ;
              if (model.isRowHeader(row)) row = oldrow;
            }
            if (scrow < 2) scrow = 0;
            else if (scrow <= maxrow) scrow = row;
            getSelectionModel().setSelectionInterval(row, row);
            //        super.changeSelection(row, col, false, false);
            if (oldrow < 0) oldrow = row;
            if ((toggle || extend) && (col == oldcol || row != oldrow)) {
              if (!extend) selectOrToggle(row, true);
              else {
                int beg = (oldrow > row ? row : oldrow), end = oldrow + row - beg;
                if (beg == end && extend) return;
                for (int i = beg; i <= end; i++) selectOrToggle(i, toggle);
              }
              repaint();
            }
            if (getAutoscrolls()) {
              Rectangle cellRect = getCellRect(scrow, 0, true);
              if (cellRect != null) scrollRectToVisible(cellRect);
            }
          }

          private void selectOrToggle(int row, boolean toggle) {
            if (toggle) model.toggleRowSelected(row);
            else model.setRowSelected(row, true);
          }
        };
    table.setColumnSelectionAllowed(false);
    table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    for (int i = 0; i < model.m_columns.length; i++)
      table.getColumnModel().getColumn(i).setPreferredWidth(model.m_columns[i].m_width);
    table
        .getColumnModel()
        .getColumn(1)
        .setCellEditor(
            new DefaultCellEditor(cbox) {
              public Component getTableCellEditorComponent(
                  JTable t, Object v, boolean sel, int row, int col) {
                cbox.setModel(new DefaultComboBoxModel(model.getMatchOptions(row)));
                cbox.setToolTipText(
                    v instanceof MatchableCollection
                        ? ((MatchableCollection) v).getToolTipText()
                        : null);
                return super.getTableCellEditorComponent(t, v, sel, row, col);
              }
            });
    table.setDefaultRenderer(
        Object.class,
        new DefaultTableCellRenderer() {
          private javax.swing.border.Border emptyBorder =
              BorderFactory.createEmptyBorder(0, 2, 0, 2);
          private Color m = null;
          private Color g = Color.green.darker().darker().darker();

          private Color halfTone(Color cFrom, Color cTo, float factor) {
            return new Color(
                (int) (cFrom.getRed() * (1 - factor) + cTo.getRed() * factor),
                (int) (cFrom.getGreen() * (1 - factor) + cTo.getGreen() * factor),
                (int) (cFrom.getBlue() * (1 - factor) + cTo.getBlue() * factor));
          }

          public Component getTableCellRendererComponent(
              JTable t, Object v, boolean sel, boolean foc, int row, int col) {
            super.getTableCellRendererComponent(t, v, sel, false, row, col);
            setOpaque(true);
            setBorder(emptyBorder);
            if (model.isRowSelected(row)) {
              if (m == null) m = halfTone(Color.yellow, t.getBackground(), 0.75f);
              super.setBackground(sel ? g : m);
            } else super.setBackground(sel ? t.getSelectionBackground() : t.getBackground());
            int rc = t.convertColumnIndexToModel(col);
            if (rc == 2) setHorizontalAlignment(JLabel.TRAILING);
            else {
              setHorizontalAlignment(JLabel.LEADING);
              if (rc == 0 || rc == 1) setToolTipText(model.getToolTip(row, col));
            }
            return this;
          }
        });

    table.setRowHeight(21);
    table.setPreferredScrollableViewportSize(
        new Dimension(740, table.getPreferredScrollableViewportSize().height));
    /*    table.getActionMap().put("select-all", new AbstractAction() {
      if (e.getKeyCode() == e.VK_A && e.getModifiers() == e.CTRL_MASK) {
        for (int i = 0; i < model.getRowCount(); i++)
          model.toggleRowSelected(i);
        table.repaint();
        e.consume();
      }
    });*/

    table
        .getActionMap()
        .put(
            "selectAll",
            new AbstractAction() {
              public void actionPerformed(ActionEvent e) {
                if (table.isEditing()) table.removeEditor();
                for (int i = 0; i < model.getRowCount(); i++) model.toggleRowSelected(i);
                table.repaint();
              }
            });
    table.addKeyListener(
        new KeyAdapter() {
          public void keyPressed(KeyEvent e) {
            if (e.getKeyCode() == e.VK_ENTER && table.getSelectedRow() >= 0) {
              model.toggleRowSelected(table.getSelectedRow());
              table.repaint();
            }
          }
        });

    contents = new JPanel(new BorderLayout());
    okp =
        new OKpanel() {
          public void jBOK_actionPerformed() {
            OKPress();
          }

          public void jPrekid_actionPerformed() {
            CancelPress();
          }
        };
    JPanel pd = new JPanel(null);
    pd.setLayout(new BoxLayout(pd, BoxLayout.X_AXIS));

    JButton all = new JraButton();
    all.setText("Oznaèi sve");
    all.setIcon(raImages.getImageIcon(raImages.IMGALIGNJUSTIFY));
    all.setPreferredSize(new Dimension(120, 25));
    all.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            for (int i = 0; i < model.getRowCount(); i++) model.setRowSelected(i, true);
            table.repaint();
          }
        });
    okp.add(all, BorderLayout.WEST);

    contents.add(new JraScrollPane(table));
    contents.add(okp, BorderLayout.SOUTH);
    okp.registerOKPanelKeys(table);
  }

  private Int2 total = new Int2();

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

  private void OKPress() {
    Window owner = win.getOwner();
    if (table.isEditing()) table.removeEditor();
    if (win != null) {
      win.dispose();
      win = null;
    }
    raProcess.runChild(
        owner,
        new Runnable() {
          public void run() {
            performMatching();
          }
        });
    if (total.one == 0 && raProcess.isCompleted())
      JOptionPane.showMessageDialog(
          owner, "Nema stavaka za pokrivanje!", "Poruka", JOptionPane.INFORMATION_MESSAGE);
    else if (total.one > 0)
      JOptionPane.showMessageDialog(
          owner,
          Aus.getNumDep(
                  total.one,
                  "Pokriven " + total.one + " saldo",
                  "Pokrivena " + total.one + " salda",
                  "Pokriveno " + total.one + " salda")
              + " na ukupno "
              + Aus.getNum(total.two, "stavci.", "stavke.", "stavaka."),
          "Poruka",
          JOptionPane.INFORMATION_MESSAGE);
  }

  private void CancelPress() {
    if (JOptionPane.showConfirmDialog(
            win,
            "Izlazak iz pokrivanja? " + "(Odabir se gubi)",
            "Potvrda izlaza",
            JOptionPane.OK_CANCEL_OPTION)
        == JOptionPane.CANCEL_OPTION) return;

    if (table.isEditing()) table.removeEditor();
    if (win != null) {
      win.dispose();
      win = null;
    }
  }
}
Exemplo n.º 9
0
// public class repKPR implements raReportData
// {//sg.com.elixir.reportwriter.datasource.IDataProvider {
public class repKPR_NextGeneration implements raReportData {

  /** @todo for future use ovo ode gori :)) */
  _Main main;

  repMemo rpm = repMemo.getrepMemo();
  upKPR_NextGeneration upk = upKPR_NextGeneration.getInstance();
  //  upKPR upK = upKPR.getInstance();
  DataSet ds = upk.getRepSet();
  dM dm = dM.getDataModule();
  raDateUtil rdu = raDateUtil.getraDateUtil();
  String[] colname = new String[] {""};
  repUtil ru = repUtil.getrepUtil();
  Valid val = Valid.getValid();
  static int start;

  public repKPR_NextGeneration() {
    ds.open();
    ru.setDataSet(ds);
    //    hr.restart.util.sysoutTEST syst = new hr.restart.util.sysoutTEST(false);
    //    syst.prn(ds);
  }
  /*
    public repKPR(int idx) {
      ds.goToRow(idx);
    }

    public java.util.Enumeration getData() {

      return new java.util.Enumeration() {
        int indx;
        {
          ds.open();
          ru.setDataSet(ds);

          if (ds.getShort("RBR") == 0){
            start = 1;
            indx = 1;
          } else {
            start = 0;
            indx = 0;
          }

        }

        public Object nextElement() {
          return new repKPR(indx++);
        }
        public boolean hasMoreElements() {
          return (indx < ds.getRowCount());
        }
      };
    }
    public void close() {}
  */

  public raReportData getRow(int i) {
    ds.goToRow(i);
    return this;
  }

  public int getRowCount() {
    return ds.rowCount();
  }

  public void close() {
    ru.setDataSet(null);
    ds = null;
  }

  public String getBRDOK() {
    return ds.getInt("BRDOK") + "";
  }

  public String getDATDOK() {
    return rdu.dataFormatter(ds.getTimestamp("DATUM"));
  }

  public String getVRDOK() {
    return ds.getString("VRDOK");
  }

  public double getSUMZAD() {
    return ds.getBigDecimal("ZAD").doubleValue();
  }

  public double getSUMRAZ() {
    return ds.getBigDecimal("RAZ").doubleValue();
  }

  public String getKOLND() {
    return ds.getString("OPIS");
  }

  public int getFAKE() {
    return ((ds.getRow() - start) / 44);
  }

  public String getCSKL() {
    return ds.getString("KOLSK");
  }

  public String getNSKL() {
    return ds.getString("KOLNSK");
  }

  public int getRBR() {
    return ds.getInt("RBR");
  }

  public double getDONOSZAD() {
    return upk.getDonosZad();
  }

  public double getDONOSRAZ() {
    return upk.getDonosRaz();
  }

  public String getFirstLine() {
    return rpm.getFirstLine();
  }

  public String getSecondLine() {
    return rpm.getSecondLine();
  }

  public String getThirdLine() {
    return rpm.getThirdLine();
  }

  public String getNSPRAVOSOB() {
    String nspo = "";
    if (lookupData
        .getlookupData()
        .raLocate(dm.getOrgstruktura(), "CORG", hr.restart.zapod.OrgStr.getKNJCORG())) {
      nspo =
          dm.getOrgstruktura().getString("NAZIV")
              + ", "
              + dm.getOrgstruktura().getString("ADRESA")
              + ", "
              + dm.getOrgstruktura().getString("HPBROJ")
              + " "
              + dm.getOrgstruktura().getString("MJESTO");
    } else nspo = rpm.getFirstLine() + " " + rpm.getSecondLine() + ", " + rpm.getThirdLine();
    return nspo;
  }

  public String getPRODAVAONICA() {
    String pj = "";

    if (lookupData
        .getlookupData()
        .raLocate(
            dm.getSklad(),
            "CSKL",
            ds.getString(
                "CSKL"))) { // lookupData.getlookupData().raLocate(dm.getOrgstruktura(),"CORG",dm.getSklad().getString("CORG"))){
      pj = /*dm.getOrgstruktura().getString("NAZIV") + ", " +
           dm.getOrgstruktura().getString("ADRESA") + ", " +
           dm.getOrgstruktura().getString("HPBROJ") + " " +
           dm.getOrgstruktura().getString("MJESTO");*/ dm.getSklad().getString("NAZSKL");
    }
    return pj;
  }

  public String getPOSLGOD() {
    String pg = "";
    lookupData.getlookupData().raLocate(dm.getSklad(), "CSKL", ds.getString("CSKL"));
    pg = dm.getSklad().getString("GODINA");
    return pg;
  }

  public String getDatumIsp() {
    return rdu.dataFormatter(val.getToday());
  }
}
Exemplo n.º 10
0
public class repIspPOS_Total
    implements raReportData { // sg.com.elixir.reportwriter.datasource.IDataProvider {

  _Main main;
  DataSet ds = ispPOS_Total.getispPOS_Total().getReportQDS();
  static BigDecimal suma = ispPOS_Total.getispPOS_Total().getSum();

  hr.restart.baza.dM dm = hr.restart.baza.dM.getDataModule();
  raDateUtil rdu = raDateUtil.getraDateUtil();
  Valid vl = Valid.getValid();

  String[] colname = new String[] {""};
  repUtil ru = repUtil.getrepUtil();
  hr.restart.util.Util ut = hr.restart.util.Util.getUtil();
  repMemo re = repMemo.getrepMemo();
  public static double iznosGrupe;
  public static double sumIzGrupe;

  public repIspPOS_Total() {
    ds.open();
    ru.setDataSet(ds);
    sumIzGrupe = 0;
  }

  public raReportData getRow(int i) {
    ds.goToRow(i);
    return this;
  }

  public int getRowCount() {
    return ds.rowCount();
  }

  public void close() {
    ru.setDataSet(null);
    ds = null;
  }

  //  public repIspPOS_Total(int idx) {
  //    if(idx==0){
  //      sumIzGrupe = 0;
  //    }
  //    ds.goToRow(idx);
  //  }
  //
  //  public java.util.Enumeration getData() {
  //    return new java.util.Enumeration() {
  //      {
  //        ds.open();
  //        ru.setDataSet(ds);
  //      }
  //      int indx=0;
  //      public Object nextElement() {
  //
  //        return new repIspPOS_Total(indx++);
  //      }
  //      public boolean hasMoreElements() {
  //        return (indx < ds.getRowCount());
  //      }
  //    };
  //  }
  //
  //  public void close() {
  //  }

  public String getNACINPLACANJA() {
    return ds.getString("NPL");
  }

  public String getVRDOK() {
    return ds.getString("VRSTA");
  }

  public String getBANKA() {
    if (!ds.getString("BANKA").equals("")) {}
    return ds.getString("BANKA");
  }

  public String getNAZIV() {
    return ds.getString("NAZIV");
  }

  public String getNAZIVGRUPE() {
    if (getBANKA().equals("")) {
      return ds.getString("NAZIV");
    }
    return "";
  }

  public double getIZNOS() {
    if (!getBANKA().equals("")) {
      return ds.getBigDecimal("IZNOS").doubleValue();
    }
    return 0;
  }

  public void setIznosGrupe() {
    iznosGrupe = ds.getBigDecimal("IZNOS").doubleValue();
  }

  public double getIZNOSGRUPE() {
    java.util.HashMap hm = ispPOS_Total.getispPOS_Total().getHM();
    System.out.println(ds.getString("NAZIV") + " - " + hm.get(ds.getString("NPL")).toString());
    return Double.parseDouble(hm.get(ds.getString("NPL")).toString());
  }

  public double getSUMIZNOSA() {
    return suma.doubleValue();
  }

  public String getPODNASLOV() {
    if (ispPOS_Total.getispPOS_Total().getRedOdDoDatuma()) {
      return "Razdoblje od "
          + ispPOS_Total.getispPOS_Total().tds.getTimestamp("pocDatum").toString().substring(0, 10)
          + " do "
          + ispPOS_Total.getispPOS_Total().tds.getTimestamp("zavDatum").toString().substring(0, 10);
    }
    return "Ra\u010Duni od "
        + String.valueOf(ispPOS_Total.getispPOS_Total().tds.getInt("pocBroj"))
        + ". do "
        + String.valueOf(ispPOS_Total.getispPOS_Total().tds.getInt("zavBroj") + ".");
  }

  public String getFirstLine() {
    return re.getFirstLine();
  }

  public String getSecondLine() {
    return re.getSecondLine();
  }

  public String getThirdLine() {
    return re.getThirdLine();
  }

  public String getDatumIsp() {
    return rdu.dataFormatter(vl.getToday());
  }
}
Exemplo n.º 11
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());
    }
  }
Exemplo n.º 12
0
 private boolean myValid() {
   if (vl.isEmpty(jpGetVrnal.jlrCVRNAL)) return false;
   if (vl.isEmpty(jtDATUMKNJ)) return false;
   if (vl.isEmpty(jtDATUMDO)) return false;
   return true;
 }
Exemplo n.º 13
0
public class frmKnjizenje extends JraDialog implements ResetEnabled {
  private raKnjizenje knjizenje = null;
  private int progSteps = 100;
  hr.restart.baza.dM dm;
  Valid vl = Valid.getValid();
  Util ut = Util.getUtil();
  lookupData ld = lookupData.getlookupData();
  JPanel jpCommon = new JPanel();
  JPanel jp = new JPanel();
  XYLayout xYLCommon = new XYLayout();
  jpGetVrsteNaloga jpGetVrnal = new jpGetVrsteNaloga();
  StorageDataSet dataSet = new StorageDataSet();
  JraTextField jtDATUMKNJ = new JraTextField();
  JLabel jlDATUMKNJ = new JLabel();
  JraTextField jtDATUMDO = new JraTextField();
  JLabel jlDATUMDO = new JLabel();
  raComboBox rcbNK = new raComboBox();
  hr.restart.sisfun.raDelayWindow dwin = null;
  OKpanel okpanel =
      new OKpanel() {
        public void jBOK_actionPerformed() {
          okPressed();
        }

        public void jPrekid_actionPerformed() {
          cancelPress();
        }
      };
  JButton jbIspis = new JButton("Ispis", raImages.getImageIcon(raImages.IMGPRINT));
  private boolean fake;
  /**
   * ekran za knjizenje koji se extenda i onda se u toj klasi pripremaju podaci za glavnu knjigu i
   * to ovako:
   *
   * <pre>
   * Najjednostavniji primjer
   * public boolean okPress() {
   *   if (!getKnjizenje().startKnjizenje(this)) return false;
   *   QueryDataSet setzaknjizenje = Util.getNewQueryDataSet("SELECT * FROM nekestavke WHERE (cnaloga is null or cnaloga = '')"+
   *      " AND DATDOK < '"+new java.sql.Date(Util.getUtil().addDays(dataSet.getTimestamp("DATUMDO"),1).getTime()).toString()+"'";
   *   if (setzaknjizenje.getRowCount() == 0) {
   *      getKnjizenje().setErrorMessage("Nema podataka za knjiženje");
   *      return false;
   *   }
   *   getKnjizenje().setTransferSet(setzaknjizenje);
   *   getKnjizenje().setInfoKeys(new String[] {"KNJIG","CSKL","VRDOK","STAVKA",...}); //unique key od nekestavke
   *   //getKnjizenje().setInfColName("CNALOGA"); // default pa je nepotrebno
   *   setzaknjizenje.first();
   *   do {
   *     if (!getKnjizenje().newStavka()) return false;
   *       //nova stavka
   *       StorageDataSet stavka = getKnjizenje().getNewStavka(nekestavke); //pod uvjetom da nekestavke ima kolone VRDOK,CSKL,STAVKA i CORG
   *                                                                       //ako nema, postoji getNewStavka(dataSet,corg) ili getNewStavka(brojkonta,corg)
   *       //punjenje nove stavke
   *       stavka.setTimestamp("DATDOK",...);
   *       stavka.setString("OPIS","...");
   *       getKnjizenje().setID(setzaknjizenje.getBigDecimal("ID"));
   *       getKnjizenje().setIP(setzaknjizenje.getBigDecimal("IP"));
   *       .
   *       .
   *       .
   *       .
   *
   *     if (!getKnjizenje().saveStavka()) return false;
   *   } while (setzaknjizenje.next());
   *   if (!getKnjizenje().saveAll()) return false;
   *   return true;
   * }
   *
   *
   * Primjer knjizenja iz master detaila (salda konti racuni) - istestirano i radi:
   *
   * public class frmKnjSKRac extends frmKnjizenje {
   *   QueryDataSet skstavke;
   *   StorageDataSet saveui;
   *   hr.restart.db.raPreparedStatement ps_updstavkeUI;
   *   String[] skstavkeKeys = new String[] {"KNJIG", "CPAR", "STAVKA", "CSKL", "VRDOK", "BROJDOK", "BROJIZV"};
   *   String[] uistavkeKeys = new String[] {"KNJIG", "CPAR", "STAVKA", "CSKL", "VRDOK", "BROJDOK", "RBS"};
   *
   *   public frmKnjSKRac() {
   *    // Prepared statement za naknadno updatanje cgkstavke u uistavke jer ne mogu dobiti kompletan set za transfer
   *    // nego samo po odredjenoj skstavci pa ih dodajem u posebnu tabelu (saveui) koju raKnjizenje azurira
   *    // i nakon toga azuriram prave uistavke preko te tabele.
   *     ps_updstavkeUI = new raPreparedStatement("uistavke",raPreparedStatement.UPDATE);
   *     saveui = new StorageDataSet();
   *     saveui.setColumns(dm.getUIstavke().cloneColumns());
   *     saveui.open();
   *   }
   *
   *   public boolean okPress() throws Exception {
   *     String qry = "SELECT * FROM skstavke WHERE (cgkstavke is null or cgkstavke = '') AND DATDOK < '"
   *         +new java.sql.Date(Util.getUtil().addDays(dataSet.getTimestamp("DATUMDO"),1).getTime()).toString()+"'";
   *     skstavke = Util.getNewQueryDataSet(qry);
   *     if (skstavke.getRowCount() == 0) {
   *       getKnjizenje().setErrorMessage("Nema podataka za knjiženje");
   *       throw new Exception("Nema podataka za knjiženje"); // nema nista za knjizenje
   *     }
   *     //tablica u koju dodajem stavke koje se prenose u gk i preko koje ce azurirati cgkstavke
   *     saveui.empty();
   *     //pocetak knjizenja
   *     if (!getKnjizenje().startKnjizenje(this)) return false;
   *     //setiranje transfer infa
   *     getKnjizenje().setTransferSet(saveui);
   *     getKnjizenje().setInfoKeys(uistavkeKeys);
   *     getKnjizenje().setInfColName("CGKSTAVKE"); // default je CNALOGA
   *     //petlja-nje
   *     skstavke.first();
   *     do {
   *       QueryDataSet uistavke = getUIStavke(skstavke);
   *       if (uistavke.getRowCount() > 0) {
   *         do {
   *           //dodajem u set za prijenos
   *           saveui.insertRow(false);
   *           uistavke.copyTo(saveui);
   *           saveui.post();
   *           //nova stavka
   *           StorageDataSet stavka = getKnjizenje().getNewStavka(uistavke);
   *           //punjenje nove stavke
   *           stavka.setTimestamp("DATDOK",skstavke.getTimestamp("DATDOK"));
   *           //ako je rbs od uistavke 1 onda ona prezentira skstavku i treba drugacije napuniti
   *           if (uistavke.getInt("RBS") == 1) {
   *             stavka.setString("OPIS",skstavke.getString("OPIS"));
   *             stavka.setString("BROJDOK",skstavke.getString("BROJDOK"));
   *             stavka.setInt("CPAR",skstavke.getInt("CPAR"));
   *           } else {
   *             if (getKnjizenje().isLastKontoZbirni()) {
   *               stavka.setString("OPIS","Protukonta dokumenata");
   *             } else {
   *               stavka.setString("OPIS","Protukonto dokumenta "+skstavke.getString("BROJDOK"));
   *             }
   *           }
   *           getKnjizenje().setID(uistavke.getBigDecimal("ID"));
   *           getKnjizenje().setIP(uistavke.getBigDecimal("IP"));
   *           //snima stavku i azurira transfer info, ako ne uspije prekida se knjizenje
   *           if (!getKnjizenje().saveStavka()) return false;
   *           if (uistavke.getInt("RBS") == 1) {
   *             //ako smo na skstavki napuni info
   *             getKnjizenje().setTransferSet(skstavke);
   *             getKnjizenje().setInfoKeys(skstavkeKeys);
   *             getKnjizenje().addTransferInfo(getKnjizenje().cGK);
   *             //vracanje set infa uistavaka
   *             getKnjizenje().setTransferSet(saveui);
   *             getKnjizenje().setInfoKeys(uistavkeKeys);
   *           }
   *         } while (uistavke.next());
   *       }
   *     } while (skstavke.next());
   *     return getKnjizenje().saveAll();
   *   }
   *   public boolean commitTransfer() {
   *     super.commitTransfer();
   *     if (saveui.getRowCount() == 0) return true;
   *     return new raLocalTransaction() {
   *       public boolean transaction() throws Exception {
   *         saveui.first();
   *         do {
   *           try {
   *             ps_updstavkeUI.setKeys(saveui);
   *             ps_updstavkeUI.setValues(saveui);
   *             ps_updstavkeUI.execute();
   *           }
   *           catch (Exception ex) {
   *             ex.printStackTrace();
   *             throw ex;
   *           }
   *         } while (saveui.next());
   *         return true;
   *       }}.execTransaction();
   *   }
   *   public static QueryDataSet getUIStavke(QueryDataSet skstavke) {
   *     return Util.getNewQueryDataSet(
   *         "SELECT * FROM uistavke WHERE KNJIG = '" + skstavke.getString("KNJIG") +
   *         "' AND CPAR = " + skstavke.getInt("CPAR") +
   *         " AND VRDOK = '" + skstavke.getString("VRDOK") +
   *         "' AND BROJDOK = '" + skstavke.getString("BROJDOK")+"'");
   *   }
   * }
   * </pre>
   */
  public frmKnjizenje() {
    this(false);
  }

  public frmKnjizenje(boolean _fake) {
    super(frmGK.getStartFrame(), false);
    try {
      // optimizacija
      frmNalozi.getFrmNalozi();
      jbInit();
      setFake(_fake);
    } catch (Exception e) {
      e.printStackTrace();
    }
  }

  private void jbInit() throws Exception {
    dm = hr.restart.baza.dM.getDataModule();
    initDataSet();
    jpGetVrnal.setDataSet(dataSet);
    jtDATUMKNJ.setColumnName("DATUMKNJ");
    jtDATUMKNJ.setDataSet(dataSet);
    jtDATUMKNJ.setHorizontalAlignment(SwingConstants.CENTER);
    jlDATUMKNJ.setText("Datum knjiženja");
    jtDATUMDO.setColumnName("DATUMDO");
    jtDATUMDO.setDataSet(dataSet);
    jtDATUMDO.setHorizontalAlignment(SwingConstants.CENTER);
    jtDATUMDO.setHelpText("Unesite zadnji datum dokumenata koje knjižite");
    jlDATUMDO.setText("Knjižiti do dana");
    rcbNK.setRaColumn("NK");
    rcbNK.setDataSet(dataSet);
    rcbNK.setRaItems(
        new String[][] {
          {"Zbrojiti stavke prema kontnom planu", "K"},
          {"Zbrojiti stavke po kontima i org. jedinicama", "Z"},
          {"Svaka stavka pojedina\u010Dno", "P"}
        });
    xYLCommon.setHeight(100);
    jp.setLayout(new BorderLayout());
    jpCommon.setLayout(xYLCommon);
    jpCommon.add(jpGetVrnal, new XYConstraints(0, 0, -1, 41));
    jpCommon.add(jlDATUMKNJ, new XYConstraints(15, 45, -1, -1));
    jpCommon.add(jtDATUMKNJ, new XYConstraints(150, 45, 100, -1));
    jpCommon.add(jlDATUMDO, new XYConstraints(15, 70, -1, -1));
    jpCommon.add(jtDATUMDO, new XYConstraints(150, 70, 100, -1));
    jpCommon.add(rcbNK, new XYConstraints(255, 70, 265, -1));
    jp.add(jpCommon, BorderLayout.NORTH);
    jp.add(okpanel, BorderLayout.SOUTH);
    getContentPane().add(jp, BorderLayout.CENTER);
    addComponentListener(
        new ComponentAdapter() {
          public void componentShown(ComponentEvent e) {
            initInputValues();
            SetFokus();
          }
        });
    jbIspis.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            fake = true;
            okPressed();
          }
        });
    okpanel.addResetButton(this);
    okpanel.add(jbIspis, BorderLayout.WEST);
    okpanel.registerOKPanelKeys(this);
  }

  /** Zove se prije SetFokus() i postavlja datume na današnji i combobox na prvu stavku */
  private boolean first = true;

  public void initInputValues() {
    rcbNK.setSelectedIndex(rcbNK.getSelectedIndex());
    if (first) resetDefaults();
    first = false;
  }

  public void resetDefaults() {
    rcbNK.setSelectedIndex(0);
    dataSet.empty();
    dataSet.setTimestamp("DATUMKNJ", vl.getToday());
    dataSet.setTimestamp("DATUMDO", vl.getToday());
  }

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

  public boolean Validacija() {
    return true;
  }

  public void setFake(boolean _fake) {
    fake = _fake;
    rcbNK.setVisible(fake);
    jbIspis.setVisible(!fake);
    if (fake) okpanel.change_jBOK("Ispis", raImages.IMGPRINT);
  }

  public boolean getFake() {
    return fake;
  }

  boolean isRealFake() {
    return !jbIspis.isVisible();
  }

  private boolean myValid() {
    if (vl.isEmpty(jpGetVrnal.jlrCVRNAL)) return false;
    if (vl.isEmpty(jtDATUMKNJ)) return false;
    if (vl.isEmpty(jtDATUMDO)) return false;
    return true;
  }

  public void SetFokus() {
    jpGetVrnal.jlrCVRNAL.requestFocus();
  }

  private void okPressed() {
    if (!myValid()) return;
    if (!runPreloader()) return;
    if (!Validacija()) return;
    new knjizThread().start();
  }

  /**
   * Tu se izvrsava kreiranje temeljnice metodama navedenima u primjeru (dokumentacija kostruktora).
   * sve se doga\u0111a u transakciji pa treba paziti na to (qds.saveChanges() ->
   * raTransaction.saveChanges(qds))
   *
   * @return true ako je sve proslo OK, ako vrati false abortira transakciju i javlja da nije
   *     uspjelo
   * @throws Exception za svaki exception sve se rollbacka na pocetak
   */
  public boolean okPress() throws Exception {
    return true;
  }

  /**
   * Izvršava se za vrijeme proknjižavanja temeljnice. Tu je potrebno azurirati status stavaka
   * vanjske evidencije koje su prenesene u datu temeljnicu Ako se ne overrida radi se automatski
   * ako overridas commitTransfer i ne zoves super.commitTransfer() OBAVEZNO POZOVI METODU
   * getKnjizenje().commitTransferSK prije svojeg koda
   *
   * @return true ako je sve proslo OK, ako vrati false abortira operaciju i javlja da nije uspjelo
   */
  public boolean commitTransfer() {
    return getKnjizenje().commitTransfer();
  }

  public void cancelPress() {
    hide();
  }

  public raKnjizenje getKnjizenje() {
    if (knjizenje == null) knjizenje = new raKnjizenje(dataSet);
    knjizenje.fake = fake;
    return knjizenje;
  }

  /**
   * 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()
        + "'";
  }

  public raStatusBar getStatus() {
    raStatusBar status;
    if (hr.restart.start.isMainFrame()) {
      status = hr.restart.mainFrame.getMainFrame().getStatusBar();
    } else {
      status = raLLFrames.getRaLLFrames().getMsgStartFrame().getStatusBar();
    }
    status.setShowDelayWindow(false);
    return status;
  }

  public void setSteps(int steps) {
    progSteps = steps;
  }

  public void setProcessMessage(String msg) {
    setProcessMessage(msg, false);
  }

  public void setProcessMessage(String msg, boolean resize) {
    if (dwin == null) dwin = hr.restart.sisfun.raDelayWindow.show(this, "Obrada", msg);
    else dwin.setMessage(msg, resize, 0);
    getStatus().statusMSG(msg);
  }

  public void clearProcessMessage() {
    if (dwin == null) return;
    dwin.close();
    dwin = null;
  }

  private void showError() {
    //    JOptionPane.showMessageDialog(this,"Knjiženje nije uspjelo! Greška:
    // "+getKnjizenje().getErrorMessage(),"Greška",JOptionPane.ERROR_MESSAGE);
    int ret =
        JOptionPane.showOptionDialog(
            this,
            "Knjiženje nije uspjelo! Greška: " + getKnjizenje().getErrorMessage(),
            "Greška",
            JOptionPane.DEFAULT_OPTION,
            JOptionPane.ERROR_MESSAGE,
            null,
            new String[] {"Ok", "Greške", "Podaci"},
            "Greške");
    if (ret == 1) getKnjizenje().kSk.showErrors();
    if (ret == 2) {
      showData();
    }
  }

  private void showData() {
    sysoutTEST ST = new sysoutTEST(false);
    int odg = 0;
    do {
      odg =
          JOptionPane.showOptionDialog(
              this,
              "Podaci kreirani u tijeku knjiženja ",
              "Podaci",
              JOptionPane.DEFAULT_OPTION,
              JOptionPane.INFORMATION_MESSAGE,
              null,
              new String[] {
                "Izlaz",
                "Stavke temeljnice",
                "Stavke temeljnice za SK",
                "SK dokumenti",
                "Stavke za knjigu URA/IRA",
                "Greške"
              },
              "Izlaz");
      if (odg == 1) {
        ST.showInFrame(getKnjizenje().getStavka(), "Stavke za temeljnice");
        ST.showInFrame(getKnjizenje().getFNalozi().getDetailSet(), "Prave stavke temeljnice");
      } else if (odg == 2) {
        ST.showInFrame(getKnjizenje().getStavkaSK(), "Stavke temeljnice za SK");
      } else if (odg == 3) {
        ST.showInFrame(getKnjizenje().skstavke, "SK dokumenti");
      } else if (odg == 4) {
        ST.showInFrame(getKnjizenje().uistavke, "UI stavke");
      } else if (odg == 5) {
        getKnjizenje().kSk.showErrors();
      }
    } while (odg > 0);
  }

  private void finnishTask() {
    setEnabled(true);
    getStatus().finnishTask();
  }

  private boolean runOkPressTrans() {
    return new raLocalTransaction() {
      public boolean transaction() throws Exception {
        return okPress();
      }
    }.execTransaction();
  }
  /**
   * 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;
  }

  class knjizThread extends Thread {
    public void run() {
      setEnabled(false);
      getStatus().startTask(progSteps, "Knjiženje u tijeku ...");
      setProcessMessage("Knjiženje u tijeku ...");
      getKnjizenje().kSk.clearErrors();
      boolean isOK = runOkPressTrans();
      clearProcessMessage();
      try {
        if (isOK) {
          if (frmNalozi.getFrmNalozi().getPreSelect() == null) {
            finnishTask();
          } else {
            finnishTask();
            //          hide();
            if (fake) { // samo ispis
              frmNalozi.getFrmNalozi().fakeDetail = knjizenje.getStavka();
              frmNalozi.getFrmNalozi().fake = true;
              frmNalozi.getFrmNalozi().Funkcija_ispisa_master();
              frmNalozi.getFrmNalozi().fake = false;
              frmNalozi.getFrmNalozi().fakeDetail = null;
              frmNalozi.getFrmNalozi().obrada.fKnjizenje = null;
            } else {
              frmNalozi.getFrmNalozi().show();
              frmGK.getFrmGK().openNalog();
              setVisible(false);
            }
          }
        } else {
          finnishTask();
          frmNalozi.getFrmNalozi().obrada.fKnjizenje = null;
          showError();
        }
      } catch (Exception ex) {
        ex.printStackTrace();
      }
      fake = isRealFake();
    }
  }
}
Exemplo n.º 14
0
 public void resetDefaults() {
   rcbNK.setSelectedIndex(0);
   dataSet.empty();
   dataSet.setTimestamp("DATUMKNJ", vl.getToday());
   dataSet.setTimestamp("DATUMDO", vl.getToday());
 }
Exemplo n.º 15
0
/**
 * Title: repOrgOS
 *
 * <p>Description:
 *
 * <p>Copyright: Copyright (c) 2002
 *
 * <p>Company:
 *
 * @author unascribed
 * @version 1.0
 */
public class repIspisRekap_2BN implements sg.com.elixir.reportwriter.datasource.IDataProvider {

  _Main main;
  DataSet ds = ispRekap_NextGeneration.getQdsIspis(); // ispRekap.getQdsIspis();
  hr.restart.util.Valid val = hr.restart.util.Valid.getValid();
  hr.restart.baza.dM dm = hr.restart.baza.dM.getDataModule();
  raDateUtil rdu = raDateUtil.getraDateUtil();
  String[] colname = new String[] {""};
  repUtil ru = repUtil.getrepUtil();
  repMemo rpm = repMemo.getrepMemo();

  double osn;
  double isp;
  // static int sumIdx = 0;
  int rowCount = 0;

  public repIspisRekap_2BN() {
    ru.setDataSet(ds);
  }

  public repIspisRekap_2BN(int idx) {
    ds.goToRow(idx);
  }

  public java.util.Enumeration getData() {
    return new java.util.Enumeration() {
      {
        ds.open();
        rowCount = ds.getRowCount();
      }

      int indx = 0;

      public Object nextElement() {
        return new repIspisRekap_2BN(indx++);
      }

      public boolean hasMoreElements() {
        return (indx < ds.getRowCount());
      }
    };
  }

  public void close() {}

  public String getInvBr() {
    return ds.getString("invbroj");
  }

  public int getRowNum() {
    return rowCount;
  }

  /*public String getCOrg()
  {
    return ds.getString("corg");
  }*/

  /* public String getNazOrg()
  {
    ru.setDataSet(ds);
    colname[0] = "corg";
    String rez = ru.getSomething(colname,dm.getOrgstruktura() ,"naziv").toString().trim();
    return rez;
  }*/

  public String getKonto() {
    return ds.getString("brojkonta");
  }

  /*public String getNazKonta()
  {
    ru.setDataSet(ds);
    colname[0] = "brojkonta";
    String rez = ru.getSomething(colname,dm.getKonta() ,"nazivkonta").toString().trim();
    return rez;
  }*/

  public String getSumLabela() {
    return "SVEUKUPNO";
  }

  public double getTRI() {
    return ds.getBigDecimal("TRI").doubleValue();
  }

  public double getCETIRI() {
    return ds.getBigDecimal("CETIRI").doubleValue();
  }

  public double getPET() {
    return ds.getDouble("PET");
  }

  public double getSEST() {
    return ds.getBigDecimal("SEST").doubleValue();
  }

  public double getSEDAM() {
    return ds.getBigDecimal("SEDAM").doubleValue();
  }

  public double getOSAM() {
    return ds.getBigDecimal("OSAM").doubleValue();
  }

  public double getDEVET() {
    return ds.getBigDecimal("DEVET").doubleValue();
  }

  public double getAMOR() {
    return ds.getBigDecimal("AMOR").doubleValue();
  }

  public double getSumeAmor() {
    return ispRekap.sume[10];
  }

  public double getDESET() {
    return ds.getDouble("DESET");
  }

  public double getJEDANAEST() {
    return ds.getDouble("JEDANAEST");
  }

  public double getDVANAEST() {
    return ds.getDouble("DVANAEST");
  }

  public double getSumeTri() {
    return ispRekap.sume[0];
  }

  public double getSumeCetiri() {
    return ispRekap.sume[1];
  }

  public double getSumePet() {
    return ispRekap.sume[2];
  }

  public double getSumeSest() {
    return ispRekap.sume[3];
  }

  public double getSumeSedam() {
    return ispRekap.sume[4];
  }

  public double getSumeOsam() {
    return ispRekap.sume[5];
  }

  public double getSumeDevet() {
    return ispRekap.sume[6];
  }

  public double getSumeDeset() {
    return ispRekap.sume[7];
  }

  public double getSumeJedanaest() {
    return ispRekap.sume[8];
  }

  public double getSumeDvanaest() {
    return ispRekap.sume[9];
  }

  public String getPocDat() {
    String datum = rdu.dataFormatter(ispRekap_NextGeneration.getPocDat());
    return "OSNOVNA SREDSTVA " + datum;
  }

  public String getZavDat() {
    String datum = rdu.dataFormatter(ispRekap_NextGeneration.getZavDat());
    return "OSNOVNA SREDSTVA " + datum;
  }

  public String getFake() {
    return "a";
  }

  public String getFirstLine() {
    return rpm.getFirstLine();
  }

  public String getSecondLine() {
    return rpm.getSecondLine();
  }

  public String getThirdLine() {
    return rpm.getThirdLine();
  }

  public String getDatumIsp() {
    return rdu.dataFormatter(val.getToday());
  }
}
Exemplo n.º 16
0
public class repM4main
    implements raReportData { // sg.com.elixir.reportwriter.datasource.IDataProvider {

  frmM4 fm4 = frmM4.getInstance();
  DataSet ds = fm4.getRep01Set();
  DataSet ps = fm4.getPodaciSet();

  //  hr.restart.baza.dM dm= hr.restart.baza.dM.getDataModule();
  raDateUtil rdu = raDateUtil.getraDateUtil();
  Valid vl = Valid.getValid();

  //  repUtil ru = repUtil.getrepUtil();
  //  hr.restart.util.Util ut =  hr.restart.util.Util.getUtil();
  repMemo re = repMemo.getrepMemo();

  public repM4main() {
    //    ru.setDataSet(ds);
  }

  public raReportData getRow(int i) {
    ds.goToRow(i);
    return this;
  }

  public int getRowCount() {
    return ds.rowCount();
  }

  public void close() {
    ds = null;
  }

  //  public repM4main(int idx) {
  //    if (idx == 0){}
  //    ds.goToRow(idx);
  //  }
  //
  //  public java.util.Enumeration getData() {
  //    return new java.util.Enumeration() {
  //    {
  //      ds.open();
  //    }
  //    int indx=0;
  //    public Object nextElement() {
  //
  //      return new repM4main(indx++);
  //    }
  //    public boolean hasMoreElements() {
  //      return (indx < ds.getRowCount());
  //    }
  //    };
  //  }
  //
  //  public void close() {
  //  }
  public String getTITLE() {
    return "PRIJAVA O UTVRÐENOM STAŽU I PLAÆI, OSNOVICAMA OSIGURANJA I NAKNADAMA PLAÆE ZA GODINU "
        + getGODINA();
  }

  public String getCRADNIKA() {
    return ds.getString("CRADNIK");
  }

  public String getRADNIK() {
    return ds.getString("PREZIME").concat(" " + ds.getString("IME"));
  }

  public String getRADNOMJ() {
    return ds.getString("NAZIVRM");
  }

  public String getREGBRMIO() {
    return ds.getString("REGBRMIO");
  }

  public String getJMBG() {
    return ds.getString("JMBG");
  }

  public String getORGREGMIO() {
    return ds.getString("ORGREGMIO");
  }

  public short getGODSTAZ() {
    return ds.getShort("GODSTAZ");
  }

  public int getBENEFICIRANI() {
    return ds.getInt("BENSTAZ");
  }

  public BigDecimal getBRUTOOSN() {
    return ds.getBigDecimal("BRUTO");
  }

  public BigDecimal getHZZO() {
    return ds.getBigDecimal("BRUTO1");
  }

  public BigDecimal getRH() {
    return ds.getBigDecimal("BRUTO2");
  }

  public BigDecimal getSS() {
    return ds.getBigDecimal("BRUTO3");
  }

  public short getGODINA() {
    return fm4.getGodina();
  }

  public String getMB() {
    return ps.getString("MATBROJ");
  }

  public String getSD() {
    return ps.getString("SIFDJEL");
  }

  public String getFirstLine() {
    return re.getFirstLine();
  }

  public String getSecondLine() {
    return re.getSecondLine();
  }

  public String getThirdLine() {
    return re.getThirdLine();
  }

  public String getSecondAndThirdLine() {
    return re.getSecondLine().concat(", " + re.getThirdLine());
  }

  public String getDatumIspisa() {
    return rdu.dataFormatter(vl.getToday());
  }
}
Exemplo n.º 17
0
/**
 * Title: repOrgOS
 *
 * <p>Description:
 *
 * <p>Copyright: Copyright (c) 2002
 *
 * <p>Company:
 *
 * @author unascribed
 * @version 1.0
 */
public class repIspisOS_2 implements sg.com.elixir.reportwriter.datasource.IDataProvider {

  _Main main;
  DataSet ds = ispOS.getQdsIspis();
  hr.restart.util.Valid val = hr.restart.util.Valid.getValid();
  hr.restart.baza.dM dm = hr.restart.baza.dM.getDataModule();
  raDateUtil rdu = raDateUtil.getraDateUtil();
  String[] colname = new String[] {""};
  repUtil ru = repUtil.getrepUtil();
  repMemo rpm = repMemo.getrepMemo();

  boolean poPripCORG = ispOS.poPripCorg;
  double osn;
  double isp;
  int oblikListe = ispOS.getSelectedRB();
  // static int sumIdx = 0;
  int rowCount = 0;
  static String tempOL = "";

  public String getCOrg() {
    return ds.getString("corg");
  }

  public String getNazOrg() {
    ru.setDataSet(ds);
    colname[0] = "corg";
    String rez = ru.getSomething(colname, dm.getOrgstruktura(), "naziv").toString().trim();
    return rez;
  }

  public repIspisOS_2() {
    ru.setDataSet(ds);
  }

  public repIspisOS_2(int idx) {
    ds.goToRow(idx);
  }

  public java.util.Enumeration getData() {
    return new java.util.Enumeration() {
      {
        ds.open();
        rowCount = ds.getRowCount();
      }

      int indx = 0;

      public Object nextElement() {
        return new repIspisOS_2(indx++);
      }

      public boolean hasMoreElements() {
        return (indx < ds.getRowCount());
      }
    };
  }

  public void close() {}

  public String getNazSredstva() {
    return ds.getString("nazsredstva");
  }

  public String getFirstLine() {
    return rpm.getFirstLine();
  }

  public double getOsnVr() {
    if (ispOS.getSelectedRB2() == 0) {
      osn = ds.getBigDecimal("OSNPOCETAK").doubleValue();
    } else if (ispOS.getSelectedRB2() == 1 || ispOS.getSelectedRB2() == 2) {
      osn =
          (ds.getBigDecimal("OSNDUGUJE").add(ds.getBigDecimal("OSNPOTRAZUJE").negate()))
              .doubleValue();
    }
    return osn;
  }

  public double getIspVr() {
    if (ispOS.getSelectedRB2() == 0) {
      isp = ds.getBigDecimal("ISPPOCETAK").doubleValue();
    } else if (ispOS.getSelectedRB2() == 1 || ispOS.getSelectedRB2() == 2) {
      try {
        isp =
            (ds.getBigDecimal("ISPPOTRAZUJE")
                    .add(ds.getBigDecimal("ISPDUGUJE").negate())
                    .add(ds.getBigDecimal("AMORTIZACIJA"))
                    .add(ds.getBigDecimal("PAMORTIZACIJA")))
                .doubleValue();
      } catch (Exception ex) {
        System.err.println("EXCEPTION - radim bez amortizacije!!");
        isp =
            (ds.getBigDecimal("ISPPOTRAZUJE").add(ds.getBigDecimal("ISPDUGUJE").negate()))
                .doubleValue();
      }

      //      isp =
      // (ds.getBigDecimal("ISPPOTRAZUJE").add(ds.getBigDecimal("ISPDUGUJE").negate())).doubleValue();
    }
    return isp;
  }

  public double getSadVr() {
    return (osn - isp);
  }

  public String getFake() {
    return "a";
  }

  public String getOblikListe() {
    String ol = "";
    switch (oblikListe) {
      case 0:
        ol = ds.getString("brojkonta");
        break;
      case 1:
        ol = ds.getString("cgrupe");
        break;
      case 2:
        ol = ds.getString("clokacije");
        break;
      case 3:
        ol = ds.getString("cskupine");
        break;
      case 4:
        ol = ds.getString("cartikla");
        break;
    }
    return ol;
  }

  public String getLabelaListe() {
    String ll = "";
    switch (oblikListe) {
      case 0:
        ll = "Konto";
        tempOL = "kontu";
        break;
      case 1:
        ll = "Amor. grupa";
        tempOL = "amortizacijskim grupama";
        break;
      case 2:
        ll = "Lokacija";
        tempOL = "lokaciji";
        break;
      case 3:
        ll = "Rev. skupina";
        tempOL = "revalorizacijskim skupinama";
        break;
      case 4:
        ll = "Artikl";
        tempOL = "artiklu";
        break;
    }
    return ll;
  }

  public String getNazOblikListe() {
    ru.setDataSet(ds);
    String rez = "";

    switch (oblikListe) {
      case 0:
        colname[0] = "brojkonta";
        //        rez = ru.getSomething(colname,dm.getKonta() ,"nazivkonta").toString().trim();
        rez =
            ru.getSomething(colname, hr.restart.zapod.raKonta.getAnalitickaKonta(), "nazivkonta")
                .toString()
                .trim();
        break;
      case 1:
        colname[0] = "cgrupe";
        rez = ru.getSomething(colname, dm.getOS_Amgrupe(), "nazgrupe").toString().trim();
        break;
      case 2:
        colname[0] = "clokacije";
        rez = ru.getSomething(colname, dm.getOS_Lokacije(), "nazlokacije").toString().trim();
        break;
      case 3:
        colname[0] = "cskupine";
        rez = ru.getSomething(colname, dm.getOS_Revskupine(), "nazskupine").toString().trim();
        break;
      case 4:
        colname[0] = "cartikla";
        rez = ru.getSomething(colname, dm.getOS_Artikli(), "nazartikla").toString().trim();
        break;
    }

    return rez;
  }

  public int getRowNum() {
    return rowCount;
  }

  public String getSumLabela() {
    return "S V E U K U P N O";
  }

  public double getSumIsp() {
    return ispOS.sume[1];
  }

  public double getSumOsn_Isp() {
    return ispOS.sume[2];
  }

  public double getSumOsn() {
    return ispOS.sume[0];
  }

  public String getSecondLine() {
    return rpm.getSecondLine();
  }

  public String getThirdLine() {
    return rpm.getThirdLine();
  }

  public String getDatumIsp() {
    return rdu.dataFormatter(val.getToday());
  }

  public String getCaption() {
    return "ISPIS OSNOVNIH SREDSTAVA";
  }

  public String getCaption2() {
    if (poPripCORG) return "( po " + tempOL + " i pripadajuæim org. jedinicama )";
    else return "( po " + tempOL + " )";
  }

  public String getcaption3() {
    String vl = "";
    switch (ispOS.getSelectedRB2()) {
      case 0:
        vl = "Poèetno stanje";
        break;
      case 2:
        vl = "Stanje na dan " + formatDatum(ispOS.getDan());
        break;
      case 1:
        vl = "Trenutno stanje";
        break;
    }
    return vl;
  }

  public String getStatus() {
    String strStatus = "Sva OS";
    if (ispOS.status.equals("I")) strStatus = "Investicije u tijeku";
    else if (ispOS.status.equals("P")) strStatus = "OS u pripremi";
    else if (ispOS.status.equals("A")) strStatus = "OS u upotrebi";
    return strStatus;
  }

  public String getPorijeklo() {
    String strPorijeklo = "Sva porijekla";
    if (ispOS.porijeklo.equals("1")) strPorijeklo = "Tuzemstvo";
    else if (ispOS.porijeklo.equals("2")) strPorijeklo = "Inozemstvo";
    else if (ispOS.porijeklo.equals("3")) strPorijeklo = "Vrijednosnice";
    return strPorijeklo;
  }

  public String getAktivnost() {
    String strAktivnost = "Sva OS";
    if (ispOS.aktivnost.equals("D")) strAktivnost = "Aktivna OS";
    else if (ispOS.aktivnost.equals("N")) strAktivnost = "Neaktivna OS";
    return strAktivnost;
  }

  //  public String getAktivnost()
  // {
  //   String strAktivnost = "Sva OS";
  //   if(ispOS.aktivnost.equals("D"))
  //     strAktivnost = "Aktivna OS";
  //   else if (ispOS.aktivnost.equals("N"))
  //     strAktivnost = "Neaktivna OS";
  //   if(poPripCORG)
  //     return strAktivnost+"\n"+getCOrg()+" "+getNazOrg()+" sa pripadajuæim org. jedinicama";
  //   return strAktivnost;
  // }
  //
  // public String getAktivnostLab()
  // {
  //   if(poPripCORG)
  //     return "Aktivnost\nOrg.jed.";
  //   else
  //     return "Aktivnost";
  //  }

  private String formatDatum(String datum) {
    StringBuffer sb = new StringBuffer(datum);
    sb.replace(2, 3, ".");
    sb.replace(5, 6, ".");
    return sb.toString();
  }
}
Exemplo n.º 18
0
public class frmKamateUpl extends raMatPodaci {
  raCommonClass rcc = raCommonClass.getraCommonClass();
  dM dm = dM.getDataModule();
  Valid vl = Valid.getValid();

  hr.restart.robno.raDateUtil rdu = hr.restart.robno.raDateUtil.getraDateUtil();

  jpKamateUpl jpDetail;
  presKamate pres;

  static frmKamateUpl frm;

  boolean kupac, inedit;
  int cpar;
  String nazpar;
  Timestamp from, to;

  public frmKamateUpl() {
    super(2);
    try {
      frm = this;
      jbInit();
    } catch (Exception e) {
      e.printStackTrace();
    }
  }

  public static frmKamateUpl getInstance() {
    return frm;
  }

  public void setTitle() {
    VarStr title = new VarStr("Uplate");
    if (cpar != 0) {
      title.append(kupac ? " kupca " : " dobavlja\u010Du ").append(cpar);
      title.append(' ').append(nazpar);
    } else title.append(kupac ? " kupaca" : " dobavlja\u010Dima");
    title.append("  od ").append(rdu.dataFormatter(from));
    title.append(" do ").append(rdu.dataFormatter(to));
    this.setTitle(title.toString());
  }

  public void beforeShow() {
    from = pres.getSelRow().getTimestamp("DATDOK-from");
    to = pres.getSelRow().getTimestamp("DATDOK-to");
    cpar = pres.getSelRow().getInt("CPAR");
    nazpar = pres.jlrNazpar.getText();
    kupac = pres.rcbCpar.getSelectedIndex() == 0;
    //    if (kupac) jpMaster.jlrCpar.setRaDataSet(dm.getPartneriKup());
    //    else jpMaster.jlrCpar.setRaDataSet(dm.getPartneriDob());
    jpDetail.jlCpar.setText(kupac ? "Kupac" : "Dobavlja\u010D");
    setTitle();
  }

  public void EntryPoint(char mode) {
    if (mode == 'I') {
      rcc.setLabelLaF(jpDetail.jlrCpar, false);
      rcc.setLabelLaF(jpDetail.jlrNazpar, false);
      rcc.setLabelLaF(jpDetail.jbSelCpar, false);
      rcc.setLabelLaF(jpDetail.jlrBrojdok, false);
      rcc.setLabelLaF(jpDetail.jbSelBr, false);
    }
  }

  public void SetFokus(char mode) {
    if (mode == 'I') jpDetail.jraIznos.requestFocus();
    else if (mode == 'N') {
      pres.copySelValues();
      partnerChanged();
      getRaQueryDataSet().setTimestamp("DATDOK", vl.getToday());
      if (cpar == 0) {
        jpDetail.jlrCpar.forceFocLost();
        jpDetail.jlrCpar.requestFocus();
      } else {
        jpDetail.jlrNazpar.setText(nazpar);
        //        getRaQueryDataSet().setInt("CPAR", cpar);
        //        jpDetail.jlrCpar.forceFocLost();
        rcc.setLabelLaF(jpDetail.jlrCpar, false);
        rcc.setLabelLaF(jpDetail.jlrNazpar, false);
        rcc.setLabelLaF(jpDetail.jbSelCpar, false);
        jpDetail.jlrBrojdok.requestFocus();
      }
    }
  }

  public void afterSetMode(char oldm, char newm) {
    inedit = newm == 'N';
  }

  public void partnerChanged() {
    if (!inedit) return;
    jpDetail.jlrBrojdok.setRaDataSet(
        KamRac.getDataModule()
            .getTempSet(
                "knjig='"
                    + getRaQueryDataSet().getString("KNJIG")
                    + "' AND cpar="
                    + getRaQueryDataSet().getInt("CPAR")
                    + " AND dugpot="
                    + (kupac ? "'D'" : "'P'")));
    jpDetail.jlrBrojdok.getRaDataSet().open();
  }

  public boolean Validacija(char mode) {
    if (vl.isEmpty(jpDetail.jlrBrojdok)) return false;
    if (getRaQueryDataSet().getBigDecimal("IZNOS").signum() <= 0) {
      jpDetail.jraIznos.requestFocus();
      JOptionPane.showMessageDialog(
          this.getWindow(), "Pogrešan iznos uplate!", "Greška", JOptionPane.ERROR_MESSAGE);
      return false;
    }
    if (mode == 'N') {
      vl.execSQL(
          "SELECT MAX(rbr) AS num FROM kamupl WHERE knjig='"
              + getRaQueryDataSet().getString("KNJIG")
              + "' AND brojdok='"
              + getRaQueryDataSet().getString("BROJDOK")
              + "' AND cpar="
              + getRaQueryDataSet().getInt("CPAR"));
      vl.RezSet.open();
      if (vl.RezSet.rowCount() > 0) getRaQueryDataSet().setInt("RBR", vl.RezSet.getInt("NUM") + 1);
      else getRaQueryDataSet().setInt("RBR", 1);
    }
    return true;
  }

  private void jbInit() throws Exception {
    this.setRaQueryDataSet(dm.getKamUpl());
    this.setVisibleCols(new int[] {2, 4, 5});
    jpDetail = new jpKamateUpl(this);
    this.setRaDetailPanel(jpDetail);
    this.jpDetail.BindComponents(dm.getKamUpl());

    pres = new presKamate();
    pres.setOwner(this);

    this.addOption(
        new raNavAction("Predselekcija", raImages.IMGZOOM, KeyEvent.VK_F12) {
          public void actionPerformed(ActionEvent e) {
            pres.showPreselect(frmKamateUpl.this, "Uplate kupca ili dobavlja\u010Du");
          }
        },
        4,
        false);
  }
}
Exemplo n.º 19
0
public class repREVCorg implements sg.com.elixir.reportwriter.datasource.IDataProvider {

  _Main main;
  DataSet ds = reportsQuerysCollector.getRQCModule().getQueryDataSet();
  hr.restart.baza.dM dm = hr.restart.baza.dM.getDataModule();
  raDateUtil rdu = raDateUtil.getraDateUtil();
  String[] colname = new String[] {""};
  String[] colname2 = new String[] {""};
  repUtil ru = repUtil.getrepUtil();
  repMemo rm = repMemo.getrepMemo();
  Valid vl = Valid.getValid();
  hr.restart.util.Util ut = hr.restart.util.Util.getUtil();
  static BigDecimal suma;

  public repREVCorg() {
    suma = _Main.nul;
  }

  public repREVCorg(int idx) {
    if (idx == 0) {
      //      sysoutTEST ST = new sysoutTEST(false);
      //      ST.prn(ds);
      suma = _Main.nul;
    }
    ds.goToRow(idx);
  }

  public java.util.Enumeration getData() {
    return new java.util.Enumeration() {
      {
        ds.open();
        ru.setDataSet(ds);
      }

      int indx = 0;

      public Object nextElement() {

        return new repREVCorg(indx++);
      }

      public boolean hasMoreElements() {
        return (indx < ds.getRowCount());
      }
    };
  }

  public void close() {}

  public int getCPAR() {
    return ds.getInt("CPAR");
  }

  public String getNAZPAR() {
    ru.setDataSet(ds);
    colname[0] = "CPAR";
    return ru.getSomething(colname, dm.getPartneri(), "NAZPAR").getString();
  }

  public String getMJ() {
    ru.setDataSet(ds);
    colname[0] = "CPAR";
    return ru.getSomething(colname, dm.getPartneri(), "MJ").getString();
  }

  public String getADR() {
    ru.setDataSet(ds);
    colname[0] = "CPAR";
    return ru.getSomething(colname, dm.getPartneri(), "ADR").getString();
  }

  public int getPBR() {
    ru.setDataSet(ds);
    colname[0] = "CPAR";
    return ru.getSomething(colname, dm.getPartneri(), "PBR").getAsInt();
  }

  public String getMB() {
    ru.setDataSet(ds);
    colname[0] = "CPAR";
    return ru.getSomething(colname, dm.getPartneri(), "MB").getString();
  }

  public String getZR() {
    ru.setDataSet(ds);
    colname[0] = "CPAR";
    return ru.getSomething(colname, dm.getPartneri(), "ZR").getString();
  }

  public String getCSKL() {
    return ds.getString("CSKL");
  }

  public String getVRDOK() {
    return ds.getString("VRDOK");
  }

  public String getGOD() {
    return ds.getString("GOD");
  }

  public int getBRDOK() {
    return ds.getInt("BRDOK");
  }

  public String getUI() {
    return ds.getString("UI");
  }

  public Timestamp getSYSDAT() {
    return ds.getTimestamp("SYSDAT");
  }

  public String SgetSYSDAT() {
    return rdu.dataFormatter(getSYSDAT());
  }

  public Timestamp getDATDOK() {
    return ds.getTimestamp("DATDOK");
  }

  public String SgetDATDOK() {
    return rdu.dataFormatter(getDATDOK());
  }

  public int getPJ() {
    return ds.getInt("PJ");
  }

  public String getCORG() {
    return ds.getString("CORG");
  }

  public String getCVRTR() {
    return ds.getString("CVRTR");
  }

  public String getCRADNIKA() {
    return ds.getString("CRADNIK");
  }

  public String getIMEIBEZIME() {
    if (!ds.getString("CRADNIK").equals("")) {
      ru.setDataSet(ds);
      String ime = ru.getSomething(new String[] {"CRADNIK"}, dm.getRadnici(), "IME").getString();
      String prezime =
          ru.getSomething(new String[] {"CRADNIK"}, dm.getRadnici(), "PREZIME").getString();
      return ime.concat(" ".concat(prezime));
    }
    return "";
  }

  public String getNAZORG() {
    if (!ds.getString("CORG").equals("")) {
      ru.setDataSet(ds);
      return ru.getSomething(new String[] {"CORG"}, dm.getOrgstruktura(), "NAZIV").getString();
    }
    return "";
  }

  public String getORGLABEL() {
    if (!ds.getString("CORG").equals("")) {
      return "Org. jed.";
    }
    return "";
  }

  public String getCRADNIKLABEL() {
    if (!ds.getString("CRADNIK").equals("")) {
      return "Djelatnik";
    }
    return "";
  }

  public String getCUG() {
    return ds.getString("CUG");
  }

  public Timestamp getDATUG() {
    return ds.getTimestamp("DATUG");
  }

  public String SgetDATUG() {
    return rdu.dataFormatter(getDATUG());
  }

  public Timestamp getDVO() {
    return ds.getTimestamp("DVO");
  }

  public String SgetDVO() {
    return rdu.dataFormatter(getDVO());
  }

  public short getDDOSP() {
    return ds.getShort("DDOSP");
  }

  public Timestamp getDATDOSP() {
    return ds.getTimestamp("DATDOSP");
  }

  public String SgetDATDOSP() {
    return rdu.dataFormatter(getDATDOSP());
  }

  public String getBRDOKIZ() {
    return ds.getString("BRDOKIZ");
  }

  public Timestamp getDATDOKIZ() {
    return ds.getTimestamp("DATDOKIZ");
  }

  public String SgetDATDOKIZ() {
    return rdu.dataFormatter(getDATDOKIZ());
  }

  public String getBRPRD() {
    return ds.getString("BRPRD");
  }

  public Timestamp getDATPRD() {
    return ds.getTimestamp("DATPRD");
  }

  public String SgetDATPRD() {
    return rdu.dataFormatter(getDATPRD());
  }

  public String getBRNARIZ() {
    return ds.getString("BRNARIZ");
  }

  public Timestamp getDATNARIZ() {
    return ds.getTimestamp("DATNARIZ");
  }

  public String SgetDATNARIZ() {
    return rdu.dataFormatter(getDATNARIZ());
  }

  public String getOZNVAL() {
    return ds.getString("OZNVAL");
  }

  public BigDecimal getTECAJ() {
    return ds.getBigDecimal("TECAJ");
  }

  public String getBRNAL() {
    return ds.getString("BRNAL");
  }

  public Timestamp getDATKNJ() {
    return ds.getTimestamp("DATKNJ");
  }

  public String SgetDATKNJ() {
    return rdu.dataFormatter(getDATKNJ());
  }

  public String getCRADNAL() {
    return ds.getString("CRADNAL");
  }

  public Timestamp getDATRADNAL() {
    return ds.getTimestamp("DATRADNAL");
  }

  public String SgetDATRADNAL() {
    return rdu.dataFormatter(getDATRADNAL());
  }

  public String getSTATUS1() {
    return ds.getString("STATUS1");
  }

  public String getSTATKNJ() {
    return ds.getString("STATKNJ");
  }

  public String getSTATPLA() {
    return ds.getString("STATPLA");
  }

  public String getSTATIRA() {
    return ds.getString("STATIRA");
  }

  public String getCFRA() {
    return ds.getString("CFRA");
  }

  public String getCNACPL() {
    return ds.getString("CNACPL");
  }

  public String getCNAMJ() {
    return ds.getString("CNAMJ");
  }

  public String getCNAC() {
    return ds.getString("CNAC");
  }

  public String getCNAP() {
    return ds.getString("CNAP");
  }

  public BigDecimal getUPZT() {
    return ds.getBigDecimal("UPZT");
  }

  public String getCSHZT() {
    return ds.getString("CSHZT");
  }

  public BigDecimal getUPRAB() {
    return ds.getBigDecimal("UPRAB");
  }

  public String getCSHRAB() {
    return ds.getString("CSHRAB");
  }

  public String getOPIS() {
    return ds.getString("OPIS");
  }

  public String getNAPOMENAOPIS() {
    String nazOpis = getNAZNAP() + "\n" + getOPIS();
    return nazOpis;
  }

  public short getRBR() {
    return ds.getShort("RBR");
  }

  public String getCART() {
    return Aut.getAut().getCARTdependable(ds);
  }

  public String getCART1() {
    return ds.getString("CART1");
  }

  public String getBC() {
    return ds.getString("BC");
  }

  public String getNAZART() {
    return ds.getString("NAZART");
  }

  public String getJM() {
    return ds.getString("JM");
  }

  public BigDecimal getKOL() {
    return ds.getBigDecimal("KOL");
  }

  public BigDecimal getUPRAB1() {
    return ds.getBigDecimal("UPRAB1");
  }

  public double getUIRAB() {
    return ds.getBigDecimal("UIRAB").doubleValue();
  }

  public BigDecimal getUPZT1() {
    return ds.getBigDecimal("UPZT1");
  }

  public BigDecimal getUIZT() {
    return ds.getBigDecimal("UIZT");
  }

  public BigDecimal getFC() {
    return ds.getBigDecimal("FC");
  }

  public double getINETO() {
    return ds.getBigDecimal("INETO").doubleValue();
  }

  public BigDecimal getFVC() {
    return ds.getBigDecimal("FVC");
  }

  public double getIPRODBP() {
    return ds.getBigDecimal("IPRODBP").doubleValue();
  }

  public double getPOR1() {
    return ds.getBigDecimal("POR1").doubleValue();
  }

  public double getPOR2() {
    return ds.getBigDecimal("POR2").doubleValue();
  }

  public double getPOR3() {
    return ds.getBigDecimal("POR3").doubleValue();
  }

  public double getUKPOR3() {
    return getPOR1() + getPOR2() + getPOR3();
  }

  public BigDecimal getFMC() {
    return ds.getBigDecimal("FMC");
  }

  public double getIPRODSP() {
    return ds.getBigDecimal("IPRODSP").doubleValue();
  }

  public BigDecimal getNC() {
    return ds.getBigDecimal("NC");
  }

  public BigDecimal getINAB() {
    return ds.getBigDecimal("INAB");
  }

  public BigDecimal getIMAR() {
    return ds.getBigDecimal("IMAR");
  }

  public BigDecimal getVC() {
    return ds.getBigDecimal("VC");
  }

  public BigDecimal getIBP() {
    return ds.getBigDecimal("IBP");
  }

  public BigDecimal getIPOR() {
    return ds.getBigDecimal("IPOR");
  }

  public BigDecimal getMC() {
    return ds.getBigDecimal("MC");
  }

  public BigDecimal getISP() {
    return ds.getBigDecimal("ISP");
  }

  public BigDecimal getZC() {
    return ds.getBigDecimal("ZC");
  }

  public double getIRAZ() {
    suma = suma.add(ds.getBigDecimal("IRAZ"));
    return ds.getBigDecimal("IRAZ").doubleValue();
  }

  public String getBRPRI() {
    return ds.getString("BRPRI");
  }

  public short getRBRPRI() {
    return ds.getShort("RBRPRI");
  }

  public String getNAZNAP() {
    ru.setDataSet(ds);
    colname[0] = "CNAP";
    return ru.getSomething(colname, dm.getNapomene(), "NAZNAP").getString();
  }

  public String getNAZNACPL() {
    ru.setDataSet(ds);
    colname[0] = "CNACPL";
    return ru.getSomething(colname, dm.getNacpl(), "NAZNACPL").getString();
  }

  public String getNAZNAC() {
    ru.setDataSet(ds);
    colname[0] = "CNAC";
    return ru.getSomething(colname, dm.getNacotp(), "NAZNAC").getString();
  }

  public String getNAZFRA() {
    ru.setDataSet(ds);
    colname[0] = "CFRA";
    return ru.getSomething(colname, dm.getFranka(), "NAZFRA").getString();
  }

  public String getFormatBroj() {
    return ru.getFormatBroj();
  }

  public String getPorezPos() {
    ru.setDataSet(ds);
    colname[0] = "CART";
    return ru.getSomething(colname, dm.getArtikli(), "CPOR").getString();
  }

  public String getPor1Naz() {
    getPorezPos();
    colname[0] = "CPOR";
    return ru.getSomething2(colname, colname, dm.getArtikli(), dm.getPorezi(), "nazpor1")
        .getString();
  }

  public int getImaPor1() {
    return (getPor1Naz().equals("")) ? 0 : 1;
  }

  public String getPor2Naz() {
    ru.setDataSet(ds);
    getPorezPos();
    colname[0] = "CPOR";
    return ru.getSomething2(colname, colname, dm.getArtikli(), dm.getPorezi(), "nazpor2")
        .getString();
  }

  public int getImaPor2() {
    return (getPor2Naz().equals("")) ? 0 : 1;
  }

  public String getPor3Naz() {
    ru.setDataSet(ds);
    getPorezPos();
    colname[0] = "CPOR";
    return ru.getSomething2(colname, colname, dm.getArtikli(), dm.getPorezi(), "nazpor3")
        .getString();
  }

  public int getImaPor3() {
    return (getPor3Naz().equals("")) ? 0 : 1;
  }

  public BigDecimal getPOSPor1() {
    /*ru.setDataSet(ds);
    getPorezPos();
    colname[0] ="CPOR";
    return ru.getSomething2(colname,colname,dm.getArtikli(),dm.getPorezi(),"por1").getBigDecimal();
    */
    return ds.getBigDecimal("PPOR1");
  }

  public BigDecimal getPOSPor3() {
    /*ru.setDataSet(ds);
    getPorezPos();
    colname[0] ="CPOR";
    return ru.getSomething2(colname,colname,dm.getArtikli(),dm.getPorezi(),"por3").getBigDecimal();
    */
    return ds.getBigDecimal("PPOR3");
  }

  public BigDecimal getPOSPor2() {
    /*ru.setDataSet(ds);
    getPorezPos();
    colname[0] ="CPOR";
    return ru.getSomething2(colname,colname,dm.getArtikli(),dm.getPorezi(),"por2").getBigDecimal();
    */
    return ds.getBigDecimal("PPOR2");
  }

  public BigDecimal getPor1p2p3Naz() {
    /*
    ru.setDataSet(ds);
    getPorezPos();
    colname[0] ="CPOR";
    return ru.getSomething2(colname,colname,dm.getArtikli(),dm.getPorezi(),"ukupor").getBigDecimal();
    */
    return ds.getBigDecimal("PPOR1").add(ds.getBigDecimal("PPOR2")).add(ds.getBigDecimal("PPOR3"));
  }

  public String getSLOVIMA() {
    return ut.numToLet(suma.doubleValue());
    //	 return ut.numToLet(ds.getBigDecimal("UIRAC").doubleValue());
  }

  public int getLogoPotvrda() {
    if (rm.test()) return 1;
    return 0;
  }

  public String getLogoFullAdr() {
    if (!rm.test()) return "";
    else return rm.getLogoAdresa() + " ,  " + rm.getLogoPbr() + " " + rm.getLogoMjesto();
  }

  public String getLineName() {
    return ClassLoader.getSystemResource("hr/restart/robno/reports/line2.jpg").toString();
  }

  public String getLogoCorg() {
    return rm.getLogoCorg();
  }

  public String getLogoNazivlog() {
    return rm.getLogoNazivlog();
  }

  public String getLogoMjesto() {
    return rm.getLogoMjesto();
  }

  public String getLogoMjestoZarez() {
    lookupData
        .getlookupData()
        .raLocate(dm.getSklad(), new String[] {"CSKL"}, new String[] {ds.getString("CSKL")});
    String corg = dm.getSklad().getString("CORG"); // System.out.println("* CORG ---> " + corg);
    lookupData
        .getlookupData()
        .raLocate(dm.getOrgstruktura(), new String[] {"CORG"}, new String[] {corg});
    return dm.getOrgstruktura().getString("MJESTO");
  }

  public String getLogoPbr() {
    return rm.getLogoPbr();
  }

  public String getLogoAdresa() {
    return rm.getLogoAdresa();
  }

  public String getLogoZiro() {
    return rm.getLogoZiro();
  }

  public String getLogoMatbroj() {
    return rm.getLogoMatbroj();
  }

  public String getLogoSifdjel() {
    return rm.getLogoSifdjel();
  }

  public String getLogoPorisp() {
    return rm.getLogoPorisp();
  }

  public String getLogoFax() {
    return rm.getLogoFax();
  }

  public String getLogoTel1() {
    return rm.getLogoTel1();
  }

  public String getLogoTel2() {
    return rm.getLogoTel2();
  }

  //  public String getPrizemljiMeNjezno(){
  //    String razmak="";
  //    for (int i=0;i<rm.getTopMargin() ; i++ ) {
  //      System.out.println("i=" + i);
  //      razmak = razmak + " \n";
  //    }
  //    return razmak;
  //  }
}
Exemplo n.º 20
0
 public String getGodina() {
   if (godina == null) godina = Valid.getValid().findYear(getDatumDo());
   return godina;
 }