use of org.eevolution.util.HRPaymentExport in project adempiere by adempiere.
the class WHRPayPrint method cmd_export.
// loadPaymentRuleInfo
/**************************************************************************
* Export payments to file
*/
private void cmd_export() {
String PaymentRule = fPaymentRule.getSelectedItem().toValueNamePair().getValue();
log.info(PaymentRule);
if (!getChecks(PaymentRule))
return;
try {
// Get File Info
File tempFile = File.createTempFile("paymentExport", ".txt");
// Create File
int no = 0;
StringBuffer err = new StringBuffer("");
if (m_PaymentExportClass == null || m_PaymentExportClass.trim().length() == 0) {
m_PaymentExportClass = "org.eevolution.util.HRGenericPaymentExport";
}
// Get Payment Export Class
HRPaymentExport custom = null;
try {
Class<?> clazz = Class.forName(m_PaymentExportClass);
custom = (HRPaymentExport) clazz.newInstance();
no = custom.exportToFile(m_checks, tempFile, err);
} catch (ClassNotFoundException e) {
no = -1;
err.append("No custom PaymentExport class " + m_PaymentExportClass + " - " + e.toString());
log.log(Level.SEVERE, err.toString(), e);
} catch (Exception e) {
no = -1;
err.append("Error in " + m_PaymentExportClass + " check log, " + e.toString());
log.log(Level.SEVERE, err.toString(), e);
}
if (no >= 0) {
Filedownload.save(new FileInputStream(tempFile), "plain/text", "paymentExport.txt");
FDialog.info(m_WindowNo, form, "Saved", Msg.getMsg(Env.getCtx(), "NoOfLines") + "=" + no);
if (FDialog.ask(m_WindowNo, form, "VPayPrintSuccess?")) {
// int lastDocumentNo =
MHRPaySelectionCheck.confirmPrint(m_checks, m_batch);
// document No not updated
}
} else {
FDialog.error(m_WindowNo, form, "Error", err.toString());
}
dispose();
} catch (Exception e) {
log.log(Level.SEVERE, e.getLocalizedMessage(), e);
}
}
use of org.eevolution.util.HRPaymentExport in project adempiere by adempiere.
the class VHRPayPrint method cmd_export.
// loadPaymentRuleInfo
/**************************************************************************
* Export payments to file
*/
private void cmd_export() {
String PaymentRule = ((ValueNamePair) fPaymentRule.getSelectedItem()).getValue();
log.info(PaymentRule);
if (!getChecks(PaymentRule))
return;
try {
JFileChooser fc = new JFileChooser();
fc.setDialogTitle(Msg.getMsg(Env.getCtx(), "Export"));
fc.setFileSelectionMode(JFileChooser.FILES_ONLY);
fc.setMultiSelectionEnabled(false);
fc.setSelectedFile(new java.io.File("paymentExport.txt"));
if (fc.showSaveDialog(panel) != JFileChooser.APPROVE_OPTION)
return;
// Create File
int no = 0;
StringBuffer err = new StringBuffer("");
if (m_PaymentExportClass == null || m_PaymentExportClass.trim().length() == 0) {
m_PaymentExportClass = "org.eevolution.util.HRGenericPaymentExport";
}
// Get Payment Export Class
HRPaymentExport custom = null;
try {
Class<?> clazz = Class.forName(m_PaymentExportClass);
custom = (HRPaymentExport) clazz.newInstance();
no = custom.exportToFile(m_checks, fc.getSelectedFile(), err);
} catch (ClassNotFoundException e) {
no = -1;
err.append("No custom PaymentExport class " + m_PaymentExportClass + " - " + e.toString());
log.log(Level.SEVERE, err.toString(), e);
} catch (Exception e) {
no = -1;
err.append("Error in " + m_PaymentExportClass + " check log, " + e.toString());
log.log(Level.SEVERE, err.toString(), e);
}
if (no >= 0) {
//Filedownload.save(new FileInputStream(fc.getSelectedFile()), "plain/text", "paymentExport.txt");
ADialog.info(m_WindowNo, panel, "Saved", Msg.getMsg(Env.getCtx(), "NoOfLines") + "=" + no);
if (ADialog.ask(m_WindowNo, panel, "VPayPrintSuccess?")) {
// int lastDocumentNo =
MHRPaySelectionCheck.confirmPrint(m_checks, m_batch);
// document No not updated
}
} else {
ADialog.error(m_WindowNo, panel, "Error", err.toString());
}
dispose();
} catch (Exception e) {
log.log(Level.SEVERE, e.getLocalizedMessage(), e);
}
}
Aggregations