private void exportFile() { try { boolean currentRowOnly = chkCurrentRow.isSelected(); File file = File.createTempFile("Export", "." + cboType.getSelectedItem().getValue().toString()); childs.clear(); for (Checkbox chkSeletionTab : chkSelectionTabForExport) { if (chkSeletionTab.isChecked()) { childs.add((GridTab) chkSeletionTab.getAttribute("tabBinding")); } } exporter.export(panel.getActiveGridTab(), childs, currentRowOnly, file, indxDetailSelected); winExportFile.onClose(); winExportFile = null; AMedia media = null; media = new AMedia( exporter.getSuggestedFileName(panel.getActiveGridTab()), null, exporter.getContentType(), file, true); Filedownload.save(media); } catch (Exception e) { throw new AdempiereException(e); } finally { if (winExportFile != null) winExportFile.onClose(); } }
@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"); }