Package biz.wolschon.numbers

Examples of biz.wolschon.numbers.FixedPointNumber


        jsEngine.put("text", text);
        jsEngine.put("value", value);
        jsEngine.put("transaction", myAccountSplit.getTransaction());
        jsEngine.put("myAccountSplit", myAccountSplit);
        jsEngine.put("file", myAccountSplit.getWritableGnucashFile());
        FixedPointNumber ustValue = ((FixedPointNumber) value.clone())
                .divideBy(new FixedPointNumber("-1,19")).multiply(
                        new FixedPointNumber("0,19")); // TODO: get tax-% from
        // tax-config
        FixedPointNumber nettoValue = ((FixedPointNumber) value.clone())
                .negate().subtract(ustValue);
        jsEngine.put("USt", ustValue);
        jsEngine.put("Netto", nettoValue);
        jsEngine.put("Helper", new ScriptHelper());
        jsEngine.getContext().setAttribute(ScriptEngine.FILENAME, scriptPath,
View Full Code Here


                            "not balanced", JOptionPane.WARNING_MESSAGE);
                }

                GnucashWritableTransactionSplit otherSplit = transaction
                        .createWritingSplit(otherAccount);
                FixedPointNumber negatedValue = transaction.getNegatedBalance();
                otherSplit.setValue(negatedValue);
                otherSplit.setQuantity(negatedValue);
                otherSplit.setDescription(otherAccountText);
            }
            return transaction;
View Full Code Here

                .get(GregorianCalendar.DAY_OF_MONTH));
        long from = day.getTimeInMillis();
        day.add(GregorianCalendar.DAY_OF_MONTH, 1);
        long to = day.getTimeInMillis();

        FixedPointNumber zero = new FixedPointNumber();
        final String WARNING = "[did not happen in " + getPluginName().toUpperCase() + "-account";

        // TODO: ein getTransactionSplits(fromDate, toDate) w�re praktisch
        List<? extends GnucashTransactionSplit> splits = getMyAccount()
                .getTransactionSplits();
View Full Code Here

     *            the saldo on that date
     */
    protected void createSaldoEntry(final FixedPointNumber aValue, final Date timestamp) {

        try {
            FixedPointNumber saldo = aValue;

            String saldoOKStr = "OK";
            if (!getMyAccount().getBalance(timestamp).equals(saldo)) {
                saldoOKStr = "NAK ("
                        + getMyAccount().getBalance(timestamp).subtract(
                                saldo) + ")";
            }

            GnucashWritableTransaction transaction = getMyAccount()
                    .getWritableGnucashFile().createWritableTransaction();
            transaction.setDescription("Saldo: " + aValue + " "
                    + saldoOKStr + " (imported via script on " + DateFormat.getDateInstance().format(new Date()) + ")");
            transaction.setDatePosted(timestamp);
            transaction.setCurrencyNameSpace(getMyAccount()
                    .getCurrencyNameSpace());
            transaction.setCurrencyID(getMyAccount().getCurrencyID());

            // we always need the split on out account's side
            GnucashWritableTransactionSplit myAccountSplit = transaction
                    .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) {
            LOG.log(Level.SEVERE, "Exception while creating Saldo-transaction.", e);
        }

    }
View Full Code Here

     * to work around this.
     * @param value the value to assign
     * @return a new FixedPointNumber
     */
    public FixedPointNumber createNumber(final String value) {
        return new FixedPointNumber(value);
    }
View Full Code Here

     * to work around this.
     * @param value the value to clone
     * @return a new FixedPointNumber
     */
    public FixedPointNumber createNumber(final FixedPointNumber value) {
        return new FixedPointNumber(value);
    }
View Full Code Here

TOP

Related Classes of biz.wolschon.numbers.FixedPointNumber

Copyright © 2018 www.massapicom. 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.