Examples of GnucashWritableAccount


Examples of biz.wolschon.fileformats.gnucash.GnucashWritableAccount

            myAccountSplit.setQuantity(value);
            myAccountSplit.setUserDefinedAttribute(getPluginName() + ".orig_description",
                    text);
            myAccountSplit.setDescription(text.replace('\n', ' '));

            GnucashWritableAccount otherAccount = getDefaultAccount();
            String otherAccountText = "automatically added";

            boolean scriptMatched = false;
            try {
                // look if there is a script matching,
                int scriptnum = 0;
                LOG.log(Level.FINEST, "Testing scripts for a match");
                while (getMyProperties().containsKey(
                        getPluginName() + SETTINGS_PREFIX_IMPORTSCRIPT_REGEXP + scriptnum)) {
                    String scriptFilenameKey = getPluginName() + SETTINGS_PREFIX_IMPORTSCRIPT + scriptnum;
                    String scriptAccountKey = getPluginName() + SETTINGS_PREFIX_IMPORTSCRIPT_ACCOUNT + scriptnum;
                    LOG.log(Level.FINEST, "Testing script number " + scriptnum + " for a match");

                    String regexp = getMyProperties().getProperty(
                            getPluginName() + SETTINGS_PREFIX_IMPORTSCRIPT_REGEXP + scriptnum);
                    if (text.matches(regexp)) {
                        scriptMatched = true;

                        // does a full script exist or only an alternate
                        // accountid?
                        if (getMyProperties().containsKey(scriptFilenameKey)) {
                            importViaScript(value, text, myAccountSplit, scriptnum);
                        } else {

                            String alternateAccountID = getMyProperties()
                                    .getProperty(scriptAccountKey);
                            otherAccount = getMyAccount().getWritableGnucashFile()
                                    .getAccountByID(alternateAccountID);

                            if (otherAccount == null) {
                                LOG.log(Level.SEVERE, "Error  Account " + otherAccount
                                        + " given in user-" + getPluginName() + "-rule #"
                                        + scriptnum + " not found");
                                JOptionPane
                                        .showMessageDialog(
                                                null,
                                                "Error  Account "
                                                        + otherAccount
                                                        + " given in user-" + getPluginName() + "-rule #"
                                                        + scriptnum
                                                        + " not found",
                                                "User-supplied target-account not found.",
                                                JOptionPane.ERROR_MESSAGE);
                            } else {
                                LOG.log(Level.INFO, "importing transaction using alternate target-account: "
                                                + alternateAccountID
                                                + "="
                                                + otherAccount
                                                        .getQualifiedName());
                                otherAccountText = "";
                            }

                        }
View Full Code Here

Examples of biz.wolschon.fileformats.gnucash.GnucashWritableAccount

                    .createWritingSplit(getMyAccount());
            myAccountSplit.setValue(new FixedPointNumber()); // 0
            myAccountSplit.setQuantity(new FixedPointNumber()); // 0

            // dummy-split on the other side
            GnucashWritableAccount otherAccount = getDefaultAccount();
            GnucashWritableTransactionSplit otherAccountSplit = transaction
                    .createWritingSplit(otherAccount);
            otherAccountSplit.setValue(new FixedPointNumber()); // 0
            otherAccountSplit.setQuantity(new FixedPointNumber()); // 0
        } catch (Exception e) {
View Full Code Here

Examples of biz.wolschon.fileformats.gnucash.GnucashWritableAccount

     */
    protected GnucashWritableAccount getDefaultAccount() throws JAXBException {
        GnucashWritableFile writableFile = getMyAccount().getWritableGnucashFile();
        String accountID = getMyProperties().getProperty(
                getPluginName() + SETTINGS_DEFAULTTARGETACCOUNT);
        GnucashWritableAccount account = accountID == null ? null
                : (GnucashWritableAccount) writableFile.getAccountByIDorName(
                        accountID, accountID);
        if (account == null) {
            account = writableFile.getAccountByName("Ausgleichskonto-EUR");
        }
        if (account == null) {
            account = writableFile.createWritableAccount();
            account.setName("Ausgleichskonto-EUR");
        }
        return account;
    }
View Full Code Here

Examples of biz.wolschon.fileformats.gnucash.GnucashWritableAccount

    /**
     * ${@inheritDoc}.
     */
    @Override
    public GnucashWritableAccount doTestRun(final GnucashWritableFile dummyFile) throws javax.xml.bind.JAXBException {
        GnucashWritableAccount bankAccount = dummyFile.createWritableAccount();
        bankAccount.setName("Dummy Bank-Account");
        bankAccount.setCurrencyNameSpace("ISO4217");
        bankAccount.setCurrencyID("EUR");

        // prepare dummy-transaction
        GnucashWritableTransaction transaction = dummyFile.createWritableTransaction();
        transaction.setDescription(getMyInputText().replace('\n', ' '));
        transaction.setDatePosted(getMyInputDate());
        transaction.setCurrencyNameSpace(bankAccount.getCurrencyNameSpace());
        transaction.setCurrencyID(bankAccount.getCurrencyID());

        // we always need the split on out account's side
        GnucashWritableTransactionSplit myAccountSplit = transaction.createWritingSplit(bankAccount);
        myAccountSplit.setValue(getMyInputValue());
        myAccountSplit.setQuantity(getMyInputValue());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.