Beispiel #1
0
 /**
  * Reset Display
  *
  * @param selIndex select index
  * @return selected activity
  */
 private MWFActivity resetDisplay(int selIndex) {
   fAnswerText.setVisible(false);
   fAnswerList.setVisible(false);
   fAnswerButton.setVisible(false);
   fAnswerButton.setImage("/images/mWindow.png");
   fTextMsg.setReadonly(!(selIndex >= 0));
   bZoom.setEnabled(selIndex >= 0);
   bOK.setEnabled(selIndex >= 0);
   fForward.setValue(null);
   fForward.setReadWrite(selIndex >= 0);
   //
   statusBar.setStatusDB(String.valueOf(selIndex + 1) + "/" + m_activities.length);
   m_activity = null;
   m_column = null;
   if (m_activities.length > 0) {
     if (selIndex >= 0 && selIndex < m_activities.length) m_activity = m_activities[selIndex];
   }
   //	Nothing to show
   if (m_activity == null) {
     fNode.setText("");
     fDescription.setText("");
     fHelp.setText("");
     fHistory.setContent(HISTORY_DIV_START_TAG + "&nbsp;</div>");
     statusBar.setStatusDB("0/0");
     statusBar.setStatusLine(Msg.getMsg(Env.getCtx(), "WFNoActivities"));
   }
   return m_activity;
 } //	resetDisplay
Beispiel #2
0
  /** Reload/Load file */
  private void cmd_reloadFile() {
    if (m_file_istream == null) return;

    m_data.clear();
    rawData.setText("");

    try {
      //  see NaturalAccountMap

      ListItem listitem = fCharset.getSelectedItem();
      Charset charset = null;

      if (listitem == null) return;

      charset = (Charset) listitem.getValue();
      BufferedReader in = new BufferedReader(new InputStreamReader(m_file_istream, charset), 10240);

      //	not safe see p108 Network pgm
      String s = null;
      String concat = "";

      while ((s = in.readLine()) != null) {
        m_data.add(s);

        concat += s;
        concat += "\n";

        if (m_data.size() < MAX_LOADED_LINES) {
          rawData.setValue(concat);
        }
      }
      in.close();
    } catch (Exception e) {
      log.log(Level.SEVERE, "", e);
      bFile.setLabel(Msg.getMsg(Env.getCtx(), "FileImportFile"));
    }

    int index = 1; // 	second line as first may be heading

    if (m_data.size() == 1) index = 0;

    int length = 0;

    if (m_data.size() > 0) length = m_data.get(index).toString().length();

    info.setValue(
        Msg.getMsg(Env.getCtx(), "Records")
            + "="
            + m_data.size()
            + ", "
            + Msg.getMsg(Env.getCtx(), "Length")
            + "="
            + length
            + "   ");

    // setCursor (Cursor.getDefaultCursor());

    log.config("Records=" + m_data.size() + ", Length=" + length);
  } //	cmd_loadFile
Beispiel #3
0
  /**
   * Static Init
   *
   * @throws Exception
   */
  private void jbInit() throws Exception {
    Charset[] charsets = Ini.getAvailableCharsets();

    for (int i = 0; i < charsets.length; i++)
      fCharset.appendItem(charsets[i].displayName(), charsets[i]);

    bFile.setLabel(Msg.getMsg(Env.getCtx(), "FileImportFile"));
    bFile.setTooltiptext(Msg.getMsg(Env.getCtx(), "FileImportFileInfo"));
    bFile.addEventListener(Events.ON_CLICK, this);

    fCharset.setMold("select");
    fCharset.setRows(0);
    fCharset.setTooltiptext(Msg.getMsg(Env.getCtx(), "Charset", false));

    info.setValue("   ");

    labelFormat.setValue(Msg.translate(Env.getCtx(), "AD_ImpFormat_ID"));

    pickFormat.setMold("select");
    pickFormat.setRows(0);

    bNext.setTooltiptext(Msg.getMsg(Env.getCtx(), "Next"));
    bNext.setLabel(">");
    bNext.addEventListener(Events.ON_CLICK, this);

    record.setValue("------");

    bPrevious.setTooltiptext(Msg.getMsg(Env.getCtx(), "Previous"));
    bPrevious.setLabel("<");
    bPrevious.addEventListener(Events.ON_CLICK, this);

    northPanel.appendChild(bFile);
    northPanel.appendChild(fCharset);
    northPanel.appendChild(info);
    northPanel.appendChild(labelFormat);
    northPanel.appendChild(pickFormat);
    northPanel.appendChild(bPrevious);
    northPanel.appendChild(record);
    northPanel.appendChild(bNext);

    rawData.setWidth("100%");
    rawData.setCols(80);
    rawData.setRows(MAX_SHOWN_LINES);
    rawData.setHeight("40%");

    previewPanel.setWidth("100%");
    previewPanel.setHeight("58%");
    previewPanel.setStyle("overflow: auto");

    centerPanel.setWidth("100%"); // Elaine 2008/11/07 - fix text area is not expanded in IE7
    centerPanel.setHeight("100%");
    centerPanel.appendChild(rawData);
    centerPanel.appendChild(new Separator());
    centerPanel.appendChild(previewPanel);

    confirmPanel.addActionListener(Events.ON_CLICK, this);
  }
  @Override
  public String getSQLWhere() {
    StringBuffer sql = new StringBuffer();
    if (txtDocumentNo.getText().length() > 0) sql.append(" AND UPPER(o.DocumentNo) LIKE ?");
    if (txtDescription.getText().length() > 0) sql.append(" AND UPPER(o.Description) LIKE ?");
    if (txtOrderRef.getText().length() > 0) sql.append(" AND UPPER(o.POReference) LIKE ?");
    //
    if (editorBPartner.getValue() != null) sql.append(" AND o.C_BPartner_ID=?");
    //
    Date fromDate = null;
    Date toDate = null;
    try {
      fromDate = dateFrom.getValue();
    } catch (WrongValueException e) {

    }
    try {
      toDate = dateTo.getValue();
    } catch (WrongValueException e) {

    }
    if (fromDate == null && toDate != null) {
      sql.append(" AND TRUNC(o.DateOrdered) <= ?");
    } else if (fromDate != null && toDate == null) {
      sql.append(" AND TRUNC(o.DateOrdered) >= ?");
    } else if (fromDate != null && toDate != null) {
      sql.append(" AND TRUNC(o.DateOrdered) BETWEEN ? AND ?");
    }
    //
    Double fromAmount = null;
    Double toAmount = null;
    if (amountFrom.getText() != null && amountFrom.getText().trim().length() > 0) {
      try {
        fromAmount = Double.parseDouble(amountFrom.getText());
      } catch (NumberFormatException e) {

      }
    }
    if (amountTo.getText() != null && amountTo.getText().trim().length() > 0) {
      try {
        toAmount = Double.parseDouble(amountTo.getText());
      } catch (NumberFormatException e) {

      }
    }
    if (fromAmount == null && toAmount != null) {
      sql.append(" AND o.GrandTotal <= ?");
    } else if (fromAmount != null && toAmount == null) {
      sql.append(" AND o.GrandTotal >= ?");
    } else if (fromAmount != null && toAmount != null) {
      sql.append(" AND o.GrandTotal BETWEEN ? AND ?");
    }
    sql.append(" AND o.IsSOTrx=?");

    log.finer(sql.toString());
    return sql.toString();
  }
Beispiel #5
0
  /** Display. Fill Editors */
  public void display(int index) {
    log.fine("Index=" + index);
    //
    m_activity = resetDisplay(index);
    //	Nothing to show
    if (m_activity == null) {
      return;
    }
    //	Display Activity
    fNode.setText(m_activity.getNodeName());
    fDescription.setValue(m_activity.getNodeDescription());
    fHelp.setValue(m_activity.getNodeHelp());
    //
    fHistory.setContent(HISTORY_DIV_START_TAG + m_activity.getHistoryHTML() + "</div>");

    //	User Actions
    MWFNode node = m_activity.getNode();
    if (MWFNode.ACTION_UserChoice.equals(node.getAction())) {
      if (m_column == null) m_column = node.getColumn();
      if (m_column != null && m_column.get_ID() != 0) {
        fAnswerList.removeAllItems();
        int dt = m_column.getAD_Reference_ID();
        if (dt == DisplayType.YesNo) {
          ValueNamePair[] values = MRefList.getList(Env.getCtx(), 319, false); // 	_YesNo
          for (int i = 0; i < values.length; i++) {
            fAnswerList.appendItem(values[i].getName(), values[i].getValue());
          }
          fAnswerList.setVisible(true);
        } else if (dt == DisplayType.List) {
          ValueNamePair[] values =
              MRefList.getList(Env.getCtx(), m_column.getAD_Reference_Value_ID(), false);
          for (int i = 0; i < values.length; i++) {
            fAnswerList.appendItem(values[i].getName(), values[i].getValue());
          }
          fAnswerList.setVisible(true);
        } else //	other display types come here
        {
          fAnswerText.setText("");
          fAnswerText.setVisible(true);
        }
      }
    }
    //	--
    else if (MWFNode.ACTION_UserWindow.equals(node.getAction())
        || MWFNode.ACTION_UserForm.equals(node.getAction())) {
      fAnswerButton.setLabel(node.getName());
      fAnswerButton.setTooltiptext(node.getDescription());
      fAnswerButton.setVisible(true);
    } else log.log(Level.SEVERE, "Unknown Node Action: " + node.getAction());

    statusBar.setStatusDB((m_index + 1) + "/" + m_activities.length);
    statusBar.setStatusLine(Msg.getMsg(Env.getCtx(), "WFActivities"));
  } //	display
  /** Initialize component & values from m_mAssignment */
  private void setDisplay() {
    m_setting = true;

    //	Set Resource
    int S_Resource_ID = m_mAssignment.getS_Resource_ID();
    KeyNamePair[] resources = new KeyNamePair[m_lookup.size()];
    m_lookup.keySet().toArray(resources);
    for (int i = 0; i < resources.length; i++) {
      if (resources[i].getKey() == S_Resource_ID) {
        fResource.setSelectedIndex(i);
        break;
      }
    }
    ListItem listItem = fResource.getSelectedItem();
    KeyNamePair check = new KeyNamePair((Integer) listItem.getValue(), listItem.getLabel());
    if (check == null || check.getKey() != S_Resource_ID) {
      if (m_mAssignment.getS_ResourceAssignment_ID() == 0) // 	new record select first
      fResource.setSelectedItem(fResource.getSelectedItem()); // 	initiates UOM display
      else log.log(Level.SEVERE, "Resource not found ID=" + S_Resource_ID);
    }

    //	Set Date, Qty
    fDateFrom.setValue(m_mAssignment.getAssignDateFrom());
    fTimeFrom.setValue(m_mAssignment.getAssignDateFrom());
    fQty.setValue(m_mAssignment.getQty());

    //	Name, Description
    fName.setValue(m_mAssignment.getName());
    fDescription.setValue(m_mAssignment.getDescription());

    //	Set Editor to R/O if confirmed
    boolean readWrite = true;
    if (m_mAssignment.isConfirmed()) readWrite = false;
    confirmPanel.getButton("Cancel").setVisible(readWrite);
    fResource.setEnabled(readWrite);
    fDateFrom.setReadonly(!readWrite);
    fQty.setEnabled(readWrite);

    m_setting = false;
  } //	dynInit
 protected InfoOrderPanel(
     int WindowNo, String value, boolean multiSelection, String whereClause, boolean lookup) {
   super(WindowNo, "o", "C_Order_ID", multiSelection, whereClause, lookup);
   log.info("InfoOrder");
   setTitle(Msg.getMsg(Env.getCtx(), "InfoOrder"));
   //
   initComponents();
   initLayout();
   p_loadedOK = initInfo();
   //
   int no = contentPanel.getRowCount();
   setStatusLine(
       Integer.toString(no) + " " + Msg.getMsg(Env.getCtx(), "SearchRows_EnterQuery"), false);
   setStatusDB(Integer.toString(no));
   //
   if (value != null && value.length() > 0) {
     String values[] = value.split("_");
     txtDocumentNo.setText(values[0]);
     executeQuery();
     renderItems();
   }
 }
  public void onEvent(Event e) throws Exception {
    if (m_setting) return;
    //	Update Assignment
    ListItem listItem = fResource.getSelectedItem();
    KeyNamePair resource =
        listItem != null
            ? new KeyNamePair((Integer) listItem.getValue(), listItem.getLabel())
            : null;
    if (resource != null) {
      int S_Resource_ID = resource.getKey();
      m_mAssignment.setS_Resource_ID(S_Resource_ID);
    }

    Calendar date = new GregorianCalendar();
    getDateAndTimeFrom(date);

    Timestamp assignDateFrom = new Timestamp(date.getTimeInMillis());
    if (assignDateFrom != null) m_mAssignment.setAssignDateFrom(assignDateFrom);
    if (fQty.getValue() != null) {
      BigDecimal qty = fQty.getValue();
      m_mAssignment.setQty(qty);
    }
    m_mAssignment.setName((String) fName.getValue());
    m_mAssignment.setDescription((String) fDescription.getValue());

    //	Resource - Look up UOM
    if (e.getTarget() == fResource) {
      Object o = m_lookup.get(fResource.getSelectedItem());
      if (o == null) lUOM.setValue(" ? ");
      else lUOM.setValue(o.toString());
    }

    //	Zoom - InfoResource
    else if (e.getTarget().getId().equals("Zoom")) {
      InfoSchedule is = new InfoSchedule(m_mAssignment, true);
      if (is.getMResourceAssignment() != null) {
        m_mAssignment = is.getMResourceAssignment();
        //	setDisplay();
        detach();
      }
      is = null;
    }

    //	cancel - return
    else if (e.getTarget().getId().equals("Cancel")) {
      m_cancel = true;
      detach();
    }

    //	delete - delete and return
    else if (e.getTarget().getId().equals("Delete")) {
      if (m_mAssignment.delete(true)) {
        m_mAssignment = null;
        detach();
      } else FDialog.error(0, this, "ResourceAssignmentNotDeleted");
    }

    //	OK - Save
    else if (e.getTarget().getId().equals("Ok")) {
      if (cmd_save()) detach();
    }
  }
  /**
   * Static Init
   *
   * @throws Exception
   */
  private void init() throws Exception {
    fResource.setMold("select");
    fResource.addEventListener(Events.ON_SELECT, this);
    delete.addEventListener(Events.ON_CLICK, this);
    confirmPanel.addComponentsLeft(delete);
    confirmPanel.addActionListener(Events.ON_CLICK, this);
    //
    this.appendChild(mainPanel);
    mainPanel.makeNoStrip();
    mainPanel.setStyle("background-color: transparent");

    Rows rows = new Rows();
    mainPanel.appendChild(rows);
    Row row = new Row();
    row.appendChild(LayoutUtils.makeRightAlign(lResource));
    row.appendChild(fResource);
    row.appendChild(new Label(" "));
    rows.appendChild(row);

    row = new Row();
    row.setSpans("1, 2");
    row.appendChild(LayoutUtils.makeRightAlign(lDate));
    Div div = new Div();
    div.appendChild(fDateFrom);
    div.appendChild(fTimeFrom);
    fTimeFrom.setStyle("margin-left: 5px");
    row.appendChild(div);
    rows.appendChild(row);

    row = new Row();
    row.appendChild(LayoutUtils.makeRightAlign(lQty));
    row.appendChild(fQty);
    row.appendChild(lUOM);
    rows.appendChild(row);

    row = new Row();
    row.setSpans("1, 2");
    row.appendChild(LayoutUtils.makeRightAlign(lName));
    row.appendChild(fName);
    fName.setStyle("width: 100%");
    rows.appendChild(row);

    row = new Row();
    row.setSpans("1, 2");
    row.appendChild(LayoutUtils.makeRightAlign(lDescription));
    row.appendChild(fDescription);
    fDescription.setMultiline(true);
    fDescription.setRows(3);
    fDescription.setStyle("width: 100%");
    rows.appendChild(row);

    row = new Row();
    row.setSpans("3");
    row.appendChild(new Label(" "));
    rows.appendChild(row);

    row = new Row();
    row.setSpans("3");
    row.appendChild(confirmPanel);
    rows.appendChild(row);
    //
  } //	jbInit
Beispiel #10
0
  /** Save */
  public void onOK() {
    log.config("Activity=" + m_activity);
    if (m_activity == null) {
      Clients.showBusy(null, false);
      return;
    }
    int AD_User_ID = Env.getAD_User_ID(Env.getCtx());
    String textMsg = fTextMsg.getValue();
    //
    MWFNode node = m_activity.getNode();

    Object forward = null; // fForward.getValue();

    // ensure activity is ran within a transaction - [ 1953628 ]
    Trx trx = null;
    try {
      trx = Trx.get(Trx.createTrxName("FWFA"), true);
      m_activity.set_TrxName(trx.getTrxName());

      if (forward != null) {
        log.config("Forward to " + forward);
        int fw = ((Integer) forward).intValue();
        if (fw == AD_User_ID || fw == 0) {
          log.log(Level.SEVERE, "Forward User="******"CannotForward");
          trx.rollback();
          trx.close();
          return;
        }
      }
      //	User Choice - Answer
      else if (MWFNode.ACTION_UserChoice.equals(node.getAction())) {
        if (m_column == null) m_column = node.getColumn();
        //	Do we have an answer?
        int dt = m_column.getAD_Reference_ID();
        String value = fAnswerText.getText();
        if (dt == DisplayType.YesNo || dt == DisplayType.List) {
          ListItem li = fAnswerList.getSelectedItem();
          if (li != null) value = li.getValue().toString();
        }
        if (value == null || value.length() == 0) {
          FDialog.error(m_WindowNo, this, "FillMandatory", Msg.getMsg(Env.getCtx(), "Answer"));
          trx.rollback();
          trx.close();
          return;
        }
        //
        log.config("Answer=" + value + " - " + textMsg);
        try {
          m_activity.setUserChoice(AD_User_ID, value, dt, textMsg);
        } catch (Exception e) {
          log.log(Level.SEVERE, node.getName(), e);
          FDialog.error(m_WindowNo, this, "Error", e.toString());
          trx.rollback();
          trx.close();
          return;
        }
      }
      //	User Action
      else {
        log.config("Action=" + node.getAction() + " - " + textMsg);
        try {
          // ensure activity is ran within a transaction
          m_activity.setUserConfirmation(AD_User_ID, textMsg);
        } catch (Exception e) {
          log.log(Level.SEVERE, node.getName(), e);
          FDialog.error(m_WindowNo, this, "Error", e.toString());
          trx.rollback();
          trx.close();
          return;
        }
      }

      trx.commit();
    } finally {
      Clients.showBusy(null, false);
      if (trx != null) trx.close();
    }

    //	Next
    loadActivities();
    display(-1);
  } //	onOK
Beispiel #11
0
  private void init() {
    Grid grid = new Grid();
    grid.setWidth("100%");
    grid.setHeight("100%");
    grid.setStyle("margin:0; padding:0; position: absolute; align: center; valign: center;");
    grid.makeNoStrip();
    grid.setOddRowSclass("even");

    Rows rows = new Rows();
    grid.appendChild(rows);

    Row row = new Row();
    rows.appendChild(row);
    Div div = new Div();
    div.setAlign("right");
    div.appendChild(lNode);
    row.appendChild(div);
    row.appendChild(fNode);
    fNode.setWidth("100%");
    fNode.setReadonly(true);

    row = new Row();
    rows.appendChild(row);
    row.setValign("top");
    div = new Div();
    div.setAlign("right");
    div.appendChild(lDesctiption);
    row.appendChild(div);
    row.appendChild(fDescription);
    fDescription.setMultiline(true);
    fDescription.setWidth("100%");
    fDescription.setReadonly(true);

    row = new Row();
    rows.appendChild(row);
    div = new Div();
    div.setAlign("right");
    div.appendChild(lHelp);
    row.appendChild(div);
    row.appendChild(fHelp);
    fHelp.setMultiline(true);
    fHelp.setWidth("100%");
    fHelp.setReadonly(true);
    fHelp.setRows(3);
    row.appendChild(new Label());

    row = new Row();
    rows.appendChild(row);
    div = new Div();
    div.setAlign("right");
    div.appendChild(lHistory);
    row.appendChild(div);
    row.appendChild(fHistory);
    row.appendChild(new Label());

    row = new Row();
    rows.appendChild(row);
    div = new Div();
    div.setAlign("right");
    div.appendChild(lAnswer);
    row.appendChild(div);
    Hbox hbox = new Hbox();
    hbox.appendChild(fAnswerText);
    hbox.appendChild(fAnswerList);
    hbox.appendChild(fAnswerButton);
    fAnswerButton.addEventListener(Events.ON_CLICK, this);
    row.appendChild(hbox);
    row.appendChild(bZoom);
    bZoom.addEventListener(Events.ON_CLICK, this);

    row = new Row();
    rows.appendChild(row);
    div = new Div();
    div.setAlign("right");
    div.appendChild(lTextMsg);
    row.appendChild(div);
    row.appendChild(fTextMsg);
    fTextMsg.setMultiline(true);
    fTextMsg.setWidth("100%");
    row.appendChild(new Label());

    row = new Row();
    rows.appendChild(row);
    div = new Div();
    div.setAlign("right");
    div.appendChild(lForward);
    row.appendChild(div);
    hbox = new Hbox();
    hbox.appendChild(fForward.getComponent());
    hbox.appendChild(lOptional);
    row.appendChild(hbox);
    row.appendChild(bOK);
    bOK.addEventListener(Events.ON_CLICK, this);

    Borderlayout layout = new Borderlayout();
    layout.setWidth("100%");
    layout.setHeight("100%");
    layout.setStyle("background-color: transparent; position: absolute;");

    North north = new North();
    north.appendChild(listbox);
    north.setSplittable(true);
    north.setFlex(true);
    north.setHeight("50%");
    layout.appendChild(north);
    north.setStyle("background-color: transparent");
    listbox.addEventListener(Events.ON_SELECT, this);

    Center center = new Center();
    center.appendChild(grid);
    layout.appendChild(center);
    center.setStyle("background-color: transparent");
    center.setFlex(true);

    South south = new South();
    south.appendChild(statusBar);
    layout.appendChild(south);
    south.setStyle("background-color: transparent");

    this.appendChild(layout);
    this.setStyle("height: 100%; width: 100%; position: absolute;");
  }
 /**
  * Get SQL WHERE parameter
  *
  * @param f field
  * @return sql
  */
 private String getSQLText(Textbox f) {
   String s = f.getText().toUpperCase();
   if (!s.endsWith("%")) s += "%";
   log.fine("String=" + s);
   return s;
 } //  getSQLText
  @Override
  protected void setParameters(PreparedStatement pstmt, boolean forCount) throws SQLException {
    int index = 1;
    if (txtDocumentNo.getText().length() > 0) pstmt.setString(index++, getSQLText(txtDocumentNo));
    if (txtDescription.getText().length() > 0) pstmt.setString(index++, getSQLText(txtDescription));
    if (txtOrderRef.getText().length() > 0) pstmt.setString(index++, getSQLText(txtOrderRef));
    //
    if (editorBPartner.getValue() != null) {
      Integer bp = (Integer) editorBPartner.getValue();
      pstmt.setInt(index++, bp.intValue());
      log.fine("BPartner=" + bp);
    }
    //

    Date fromD = null;
    Date toD = null;
    Timestamp from = null;
    Timestamp to = null;
    try {
      if (dateFrom.getValue() != null) {
        fromD = dateFrom.getValue();
        from = new Timestamp(fromD.getTime());
      }
    } catch (WrongValueException e) {

    }
    try {
      if (dateTo.getValue() != null) {
        toD = dateTo.getValue();
        to = new Timestamp(toD.getTime());
      }
    } catch (WrongValueException e) {

    }

    log.fine("Date From=" + from + ", To=" + to);
    if (from == null && to != null) {
      pstmt.setTimestamp(index++, to);
    } else if (from != null && to == null) {
      pstmt.setTimestamp(index++, from);
    } else if (from != null && to != null) {
      pstmt.setTimestamp(index++, from);
      pstmt.setTimestamp(index++, to);
    }

    //
    BigDecimal fromBD = null;
    BigDecimal toBD = null;
    Double fromAmt = null;
    Double toAmt = null;

    if (amountFrom.getText() != null && amountFrom.getText().trim().length() > 0) {
      try {
        fromAmt = Double.parseDouble(amountFrom.getText());
        fromBD = BigDecimal.valueOf(fromAmt);
      } catch (Exception e) {

      }
    }

    if (amountTo.getText() != null && amountTo.getText().trim().length() > 0) {
      try {
        toAmt = Double.parseDouble(amountTo.getText());
        toBD = BigDecimal.valueOf(toAmt);
      } catch (Exception e) {

      }
    }

    if (fromBD == null && toBD != null) {
      pstmt.setBigDecimal(index++, toBD);
    } else if (fromBD != null && toBD == null) {
      pstmt.setBigDecimal(index++, fromBD);
    } else if (fromBD != null && toBD != null) {
      pstmt.setBigDecimal(index++, fromBD);
      pstmt.setBigDecimal(index++, toBD);
    }

    pstmt.setString(index++, isSoTrx.isChecked() ? "Y" : "N");
  }
  private void initLayout() {
    txtDocumentNo.setWidth("100%");
    txtDescription.setWidth("100%");
    txtOrderRef.setWidth("100%");
    dateFrom.setWidth("165px");
    dateTo.setWidth("165px");
    amountFrom.getDecimalbox().setWidth("155px");
    amountTo.getDecimalbox().setWidth("155px");

    Grid grid = GridFactory.newGridLayout();

    Rows rows = new Rows();
    grid.appendChild(rows);

    Row row = new Row();
    rows.appendChild(row);
    row.appendChild(lblDocumentNo.rightAlign());
    row.appendChild(txtDocumentNo);
    row.appendChild(editorBPartner.getLabel().rightAlign());
    row.appendChild(editorBPartner.getComponent());
    row.appendChild(isSoTrx);

    row = new Row();
    row.setSpans("1, 1, 1, 2");
    rows.appendChild(row);
    row.appendChild(lblDescription.rightAlign());
    row.appendChild(txtDescription);
    row.appendChild(lblDateOrdered.rightAlign());
    Hbox hbox = new Hbox();
    hbox.appendChild(dateFrom);
    hbox.appendChild(new Label("-"));
    hbox.appendChild(dateTo);
    row.appendChild(hbox);

    row = new Row();
    row.setSpans("1, 1, 1, 2");
    rows.appendChild(row);
    row.appendChild(lblOrderRef.rightAlign());
    row.appendChild(txtOrderRef);
    row.appendChild(lblGrandTotal.rightAlign());
    hbox = new Hbox();
    hbox.appendChild(amountFrom);
    hbox.appendChild(new Label("-"));
    hbox.appendChild(amountTo);
    row.appendChild(hbox);

    layout = new Borderlayout();
    layout.setWidth("100%");
    layout.setHeight("100%");
    if (!isLookup()) {
      layout.setStyle("position: absolute");
    }
    this.appendChild(layout);

    North north = new North();
    layout.appendChild(north);
    north.appendChild(grid);

    Center center = new Center();
    layout.appendChild(center);
    center.setFlex(true);
    Div div = new Div();
    div.appendChild(contentPanel);
    if (isLookup()) contentPanel.setWidth("99%");
    else contentPanel.setStyle("width: 99%; margin: 0px auto;");
    contentPanel.setVflex(true);
    div.setStyle("width :100%; height: 100%");
    center.appendChild(div);

    South south = new South();
    layout.appendChild(south);
    southBody = new Vbox();
    southBody.setWidth("100%");
    south.appendChild(southBody);
    southBody.appendChild(confirmPanel);
    southBody.appendChild(new Separator());
    southBody.appendChild(statusBar);
  }