use of jgnash.ui.account.AccountListDialog in project jgnash by ccavanaugh.
the class AdjustmentPanel method convertAction.
/**
* Helps convert an existing single entry transaction into a double entry transaction
*/
private void convertAction() {
AccountListDialog d = new AccountListDialog();
d.disableAccount(getAccount());
d.disablePlaceHolders();
d.setVisible(true);
if (!d.getReturnStatus()) {
return;
}
Account opp = d.getAccount();
Transaction t = new Transaction();
t.setDate(datePanel.getLocalDate());
t.setNumber(numberField.getText());
t.setPayee(payeeField.getText());
TransactionEntry entry = new TransactionEntry();
entry.setMemo(memoField.getText());
if (amountField.getDecimal().signum() >= 0) {
entry.setCreditAccount(getAccount());
entry.setDebitAccount(opp);
} else {
entry.setDebitAccount(getAccount());
entry.setCreditAccount(opp);
}
entry.setCreditAmount(amountField.getDecimal().abs());
entry.setDebitAmount(amountField.getDecimal().abs().negate());
ReconcileManager.reconcileTransaction(getAccount(), t, getReconciledState());
t.addTransactionEntry(entry);
Transaction tran = TransactionDialog.showDialog(getAccount(), t);
if (tran != null) {
if (getEngine().removeTransaction(modTrans)) {
getEngine().addTransaction(tran);
}
clearForm();
}
}
Aggregations