}
@Action
public void ProcessInbox() {
try {
OpenTransactionAccount openTransaction = new OpenTransactionAccount();
Map selectedIndices = new HashMap();
List finalReceiptRefNo = new ArrayList();
for (int i = 0; i < jTable_Inbox.getRowCount(); i++) {
String key = (String) jTable_Inbox.getModel().getValueAt(i, 9);
if (!Utility.VerifyStringVal(key)) key = new String("");
if ((Boolean) jTable_Inbox.getModel().getValueAt(i, 7)) {
selectedIndices.put(key, true);
}
if ((Boolean) jTable_Inbox.getModel().getValueAt(i, 8)) {
selectedIndices.put(key, false);
}
if ("finalReceipt".equalsIgnoreCase((String) jTable_Inbox.getModel().getValueAt(i, 3)) && (Boolean) jTable_Inbox.getModel().getValueAt(i, 7)) {
finalReceiptRefNo.add((String) jTable_Inbox.getModel().getValueAt(i, 1));
}
}
System.out.println("selectedIndices:" + selectedIndices.entrySet());
if (jTable_Inbox.getRowCount() < 1 || selectedIndices.size() < 1) {
JOptionPane.showMessageDialog(this, "Please check some transactions to process", "Error", JOptionPane.ERROR_MESSAGE);
return;
}
for (int j = 0; j < finalReceiptRefNo.size(); j++) {
String referenceNo = (String) finalReceiptRefNo.get(j);
for (int i = 0; i < jTable_Inbox.getRowCount(); i++) {
if (referenceNo.equals((String) jTable_Inbox.getModel().getValueAt(i, 1)) && !(Boolean) jTable_Inbox.getModel().getValueAt(i, 7)) {
JOptionPane.showMessageDialog(this, "To close a finalReceipt, you must also close the other receipts that have the same reference number", "Error", JOptionPane.ERROR_MESSAGE);
return;
}
}
}
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
boolean success = openTransaction.processInbox(accountID, selectedIndices);
if (success) {
JOptionPane.showMessageDialog(this, "Inbox processed successfully", "Processing Success", JOptionPane.INFORMATION_MESSAGE);
Helpers.reloadOTDetails(accountID);
MainPage.reLoadAccount();
Helpers.setLoadNymTrades(true);